Advertisement Jump to content
  • Advertisement

malu

Member
  • Content Count

    5
  • Joined

  • Last visited

Community Reputation

122 Neutral

About malu

  • Rank
    Newbie
  1. Hi! I need to create an array attribute, which defines a value per vertex in a Mesh. My goal is to define a initial value for each vertex in the array attribute and later on, trough the paintable system of Maya change this values to another ones. I can't do this because I have the following issues: If I create an attribute "paintAttr" and make it paintable: addAttr -ln "paintAttr" -dataType "doubleArray"; makePaintable "mesh" "paintAttr"; I'm able to paint the vertex attribute with the values that I choose. But if I want to start the attribute with a default value, and later on to change its values with the instruction makePaintable I can't do it. I tried two approaches in c++, the first one: MPointArray particles; newMesh.getPoints(particles); MGlobal::executeCommand( MString( "addAttr -ln paintAttr -dataType doubleArray " + newMesh.fullPathName(&stat))); MFnDependencyNode fnNode(newMesh.object()); MPlug f = fnNode.findPlug("paintAttr "); int d; MPlug is; for( d = 0; d < particles.length(); d++) { is = f.elementByLogicalIndex(d); is.setValue(0.5); } The program creates the attribute, but it doesn't add the value 0.5 to each position of the array. In the second approach: MPointArray particles; newMesh.getPoints(particles); MObject test; MFnNumericAttribute numFn; test = numFn.create("paintAttr ", "pt", MFnNumericData::kDouble); numFn.setArray(true); newMesh.addAttribute(test); MFnDependencyNode fnNode(newMesh.object()); MPlug f = fnNode.findPlug("paintAttr "); int d; MPlug is; for( d = 0; d < particles.length(); d++) { is = f.elementByLogicalIndex(d); is.setValue(0.5); } The attribute "paintAttr" is defined with the initial value of 0.5 for each vertex, and apparently it can be paintable with: makePaintable "mesh" "paintAttr"; But in reality, when I try to paint the vertex with the Maya painting system, to change the value 0.5 for another, it doesn't change the values at all. Can you help me to solve this problem? Thanks, Malu
  2. Hi, When i create a mesh, modelling in Maya, i can add paintable attributes whith MEL instructions: select pPlaneShape1; addAttr -ln "paintAttr" -dataType "doubleArray"; makePaintable "mesh" "paintAttr"; But when i create a mesh in C++ Maya with the create function and i try to aply the same MEL instructions: select pPlaneShape2; addAttr -ln "paintAttr" -dataType "doubleArray"; makePaintable "mesh" "paintAttr"; Maya let me create the attribute but don't let me paint it... it says that: // Warning: |polySurface2|polySurfaceShape2 is missing attribute paintAttr. That's because Maya adds the attribute to polySurface2 but it doesn't to polySurfaceShape2. The new attribute "paintAttr" has to be in polySurfaceShape to make it possible to paint. I'm wonder if there's an instruction C++ or MEL that i can use in the Mesh created in C++ to make this possible? Any suggestion? Thanks, Malu
  3. Hi! I’m doing a plugin for Maya where I convert a Mesh into a type of triangular mesh and export the resulting Mesh with a specific format. I have this two functionalities in a single plugin. I have to separate these two functionalities, I’ve got to create one plugin for conversion and one other for exportation. The problem is when I make the conversion of a Mesh I need to keep some data that don’t belong to the Mesh itself to do the exportation. My question is: how can I add data to a Mesh in the plugin of conversion? And later on, how can I access this data of the converted Mesh in another plugin? The only functions that I have found was this two: MStatus MFnMesh:: setDoubleBlindData ( MIntArray & compIDs, MFn::Type compType, int blindDataId, MString attrName, MDoubleArray & data) And MStatus MFnMesh:: getDoubleBlindData ( MFn::Type compType, int blindDataId, MString attrName, MIntArray & compIDs, MDoubleArray & data) const I can use the setDoubleBlindData in the Mesh Converted object and the getDoubleBlindData in the exporter plugin to access the data that I need… But the problem is that in this way I just can associate data to the Mesh that are in a MDoubleArray vector, so I can’t associate to the Mesh another type of data. Any suggestion? Can you help me? Thanks, Malu
  4. Hi! I'm doin' a plug-in for meshes in Maya in C++, and i´ve got a question: In Maya modelling i can add a new attribute to one object with MEL commands: select pPlaneShape1; addAttr - ln " paintAttr" - dataType " doubleArray" ; I can add a paintable attribute to "paintAttr" with this instruction: makePaintable " mesh" " paintAttr" ; In this way i can give different values to " painAttr", using the paintable brush of Maya, in the mesh. My problem is to access these values through the API C++. I tried some functions but I did not obtain the desired result. With the functions of MFnMesh i tried: MFnMesh fnMesh (dagPath); MObjectArray atrraf; MObject o; MString test = MString (" paintAttr"); o = fnMesh.attribute (test); fnMesh.getAffectedAttributes ( o, atrraf); But I did not get nothing in the variable atrraf… I can´t obtain the values that I applied in the model. I tried also with the classes MPlug: MFnDependencyNode nodeFn (); MPlug mass = nodeFn.findPlug (" paintAttr"); double m; mass.getValue (m); But I come across with a problem, the function getValue only returns double values, and it does not return doubleArrays. Do you have a suggestion? Can anybody help me? Thanks, Malu
  5. Hi! I'm doin' a plug-in for meshes in Maya in C++, and i´ve got a question: In Maya modelling i can add a new attribute to one object with MEL commands: select pPlaneShape1; addAttr - ln " paintAttr" - dataType " doubleArray" ; I can add a paintable attribute to "paintAttr" with this instruction: makePaintable " mesh" " paintAttr" ; In this way i can give different values to " painAttr", using the paintable brush of Maya, in the mesh. My problem is to access these values through the API C++. I tried some functions but I did not obtain the desired result. With the functions of MFnMesh i tried: MFnMesh fnMesh (dagPath); MObjectArray atrraf; MObject o; MString test = MString (" paintAttr"); o = fnMesh.attribute (test); fnMesh.getAffectedAttributes ( o, atrraf); But I did not get nothing in the variable atrraf… I can´t obtain the values that I applied in the model. I tried also with the classes MPlug: MFnDependencyNode nodeFn (); MPlug mass = nodeFn.findPlug (" paintAttr"); double m; mass.getValue (m); But I come across with a problem, the function getValue only returns double values, and it does not return doubleArrays. Do you have a suggestion? Can anybody help me? Thanks, Malu
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!