How to setOverrideControllers for a JCM morph
CStrat
Posts: 30
So, I have some code to find things like CTRL morphs if I want to change their values. I think this is actually from the sample scripts IIRC:
var oPropertyGroupTree = oElement.getPropertyGroups(); if (bUseLabel) { oProperty = oPropertyGroupTree.findPropertyByLabel(sProperty); } else { oProperty = oPropertyGroupTree.findProperty(sProperty); }
This works great for CTRL morphs and allows me to do things like
prop.setValue(1.0);
or
prop.setOverrideControllers(false);
But what I want to do is `setOverrideControllers` for JCM morphs. However my script is not finding those morphs. Why not?
Comments
Weirdly, my script finds a single JCM morph in the Genesis 8 model, `pJCMNeckTwist_Reverse` but I have no idea why that one is different. All of the other JCM's can be found via `obj.getModifier` but I'm not understanding why I can find the JCM under modifiers when everything suggests it should be a property.
So I adjusted the script to search for properties by label instead of by name, and that allowed me to find the JCMs I was missing. However, I can't seem to get the `setOverrideControllers` to do anything. It doesn't give an error in the IDE, so it seems to accept the method as valid. But when I actually run the script, I can see that it's not working because the little "link" icon on the morph isn't changing.
Ok so for anyone else, I answered my own questions.
First, JCM's (by name, if looking at the morph properties) have a Modifier and a Property. The modifier name is the JCM name. The property LABEL is the JCM name. The property NAME is just `Value`.
Secondly, maybe I'm just not understanding what the little "Chain" or "Link" icon means regarding overriding controllers. I assumed "Chain" means "Overriding" and "Unlinked Chain" means Not Overriding. But I would be wrong.
setOverrideControllers(true) = unlinked chain
setOverrideController(false) = linked chain (default state)
You can't find the controllers or there is an issue with adjusting them? Do you have a concrete example?
I got it. I couldn't find specific JCMs when I was looking for a `DzProperty` by name. Eventually I realized for JCMs specifically, the name attribute is `Value` and it is the label attibute that has the morph's name when dealing with the DzProperty. For DzModifier, the JCMs name attribute is the name of the morph, so this was a little confusing to me before I figured it out.