I generated some instances via OpenMaya API but the connections to the 
shader are not automatically created. For the case where this is a single 
shader assigned to the whole object I can connect the instObjectGroups 
attribute to the shading engine node and everything is great.

I'm running into an issue when I have two shading engines attached to the 
original geo. I have tried to recreate the connections I see when I 
duplicate special through the menu, by adding a new groupId node and 
copying the objectGrpCompList data from the first instance of the shape. I 
must be doing it wrong, because the shader is not working in the viewport. 
When I save and re-open the Maya scene without changing anything, the 
shader is displayed in the viewport correctly, so Maya must be fixing 
something for me automatically when it opens again. 

I used MFnComponentListData to get the faces and set them manually on all 
the corresponding objectGrpCompList. I can verify with a get that they are 
correct, but not sure if it's actually the proper way to set them based off 
this post from many years 
ago. 
https://forums.cgsociety.org/t/objectgroups-groupid-and-multi-shader-assignment/1213536/4

I cannot figure out how to do what is in the example they posted with 
MFnMeshData. If anyone could give an explanation how to achieve this it 
would be great. Thank you!

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/261abb30-6e77-4aee-a980-35f5c3b62c7bn%40googlegroups.com.

Reply via email to