Change shapes value
semidieu
Posts: 26
I want to work with the Genesis shapes.
Looking for the samples, it's easy to get all the shapes (Property) of the currently selected figure.
Now, I can't seem to find a way to:
Get the current value of a shape
Get the minimum and maximum value of a shape
Set a value for a shape
Thanks for your help!
Basil
Comments
For a morph oModifier,
oControl = oModifier.getValueChannel();
will give you the parameter. then you can get values, limits and whether they are on with
value = oControl.getValue();
limited = oControl.isClamped();
max = oControl.getMax();
min = oControl.getMin();
and set the vlue, or change the limits, with
oControl.setValue( value );
oControl.setMax( max );
oControl.setMin( min );
oControl.setIsClamped( true );
Thanks for the reply... Now... I'm discovering that I'm really missing something.
I used the sample: Node Properties.dsa
This displays the list of morphs. But I can't get further from here... I'm thinking I'm doing the things wrong here...
So, I think I must handle things differently... if I start with:
oSkel = Scene.getPrimarySelection().getSkeleton();
Is there a way from here to get the list of all morphs and then handle the values ?
When I look at the sample (Node properties.dsa), it looks to me very complicated to get all the morphs like this... I'm sure there must be a much easier way...
One last thing: Is it possible, in the Script IDE, to run a command to list the available functions for an object ?
Something like: help(oNode);
Ok... found it! But why does this code generate an error at the end ?
And there error is:
... lots of line above...
FBMBasicChild0 1
CloneVictoria40 0
CloneTheGirl40 0
CloneStephanie40 0
CloneRebySky0 0
CloneMichael40 0
CloneKids40 0
CloneHiro40 0
CloneFreak40 0
CloneAiko40 0
Script Error: Line 10
TypeError: Result of expression 'modifier.getValueChannel' [undefined] is not a function.
Stack Trace:
()@:10
Error executing script on line: 10
Script executed in 1 secs 172 msecs.
Notice that the error happens for
i=926
And for information: obj.getNumModifiers() --> 927
I'm posting too fast - found the solution! getModifier can also be something else than a DzMorph. Added a check for this and it's working now!
Heh, well you saved me from having to reply - but yes, you do need to check the type of the modifier.