Assigning materials to components of custom MPxComponentShape?

Assigning materials to components of custom MPxComponentShape?

Anonymous
Not applicable
298 Views
1 Reply
Message 1 of 2

Assigning materials to components of custom MPxComponentShape?

Anonymous
Not applicable
Hi there! I've created a custom MPxComponentShape-derived shape in Maya, and I have drawing and component selection all working. Now I'd like to be able to assign materials to my kMeshPolygonComponent component selections. I'm not really sure how to go about this though. I imagine I need to create an output array attribute that holds my "faces", but what type etc do I need to make this so that Maya will allow me to assign materials to my "faces"?

Is this even possible using the API?
0 Likes
299 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
This is not a definitive answer, as I've not done this myself, but I believe you would use groupId and groupParts nodes to identify component groups within your shape, and associate them with a shading group. Take a close look at the network Maya generates when you make a component material assignment and also look at the mesh data when you save an ASCII file. You'll see groups within the mesh that correspond to the assignments you've made, and the groupParts/groupId nodes in the resulting network.

Good luck.

-Judah
0 Likes