create color set

35 views
Skip to first unread message

miarmy

unread,
Oct 5, 2018, 8:13:28 PM10/5/18
to Python Programming for Autodesk Maya
hi!...i want create color set for my shape;
but below C++ API code don't work!(The important thing is that, output geometry attribute of one deformer node is connected to inMesh attribute of my shape)

MSelectionList sel_list;
 sel_list
.add(mesh_n);
 
MDagPath dag_path;
 sel_list
.getDagPath(0, dag_path);
 
MFnMesh shape(dag_path);


 shape
.createColorSetWithName(colorSetName);
 shape
.createColorSet(colorSetName);
 shape
.setCurrentColorSetName(colorSetName);

Michael Boon

unread,
Oct 16, 2018, 1:34:26 AM10/16/18
to Python Programming for Autodesk Maya
The documentation for MFnMesh::createColorSetWithName() says
This operation will only work when the MFnMesh refers to a shape.
I never understood what that meant. I now guess it means that you can't use that function on an object which is the output of a deformer node. There must be some way to do it, since I assume it's possible to create a custom node which adds a color set to its input, but I've never had to do it.

Sorry, that's probably not any help. It might trigger a brainwave for someone though.
Reply all
Reply to author
Forward
0 new messages