How to get only modifiers of current selection?
mikek
Posts: 195
I'm trying to get the modifiers(morphs) of the current selected item (which is usually a cloth piece). Code looks like this:
var oNode=Scene.getPrimarySelection();var oObj = oNode.getObject(); var nShapes = oObj.getNumShapes();for (var j=0; j < nShapes; j++) { var oShape = oObj.getShape(j); var nMod= oObj.getNumModifiers(); for (var k=0; k < nMod; k++) { var oMod = oObj.getModifier( k ); //filter if(oMod.getTypeLabel()!="Morph") continue; if(oMod.getValueChannel().isHidden()) continue; if(oMod.getValueChannel().isNumeric()==false) continue; //.. //do something }}
This works to get the modifiers. But when selecting a cloth item which is attached to a character the code returns as well morphs from the character. How can those be filtered to have only modifiers connected to the selected item?
Comments
The morphs from the character are usually hidden.
Perhaps if you unfit / unparent the clothing from the character in your code? Then refit after.
Thanks for the suggestions. Moving them out of the character would work but I have found another solution to filter them:
The ones creating the issue aren't hidden but it looks like they don't have a controller set.