Digital Art Zone

 
     
Change shapes value
Posted: 22 August 2012 08:13 AM   [ Ignore ]
New Member
Avatar
Total Posts:  10
Joined  2003-10-09

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

Profile
 
 
Posted: 22 August 2012 12:42 PM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  14430
Joined  2003-10-09

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 );

 Signature 

DAZ Studio Frequently Asked Questions

Index of free DAZ Studio scripts and plugins list

Profile
 
 
Posted: 22 August 2012 01:48 PM   [ Ignore ]   [ # 2 ]
New Member
Avatar
Total Posts:  10
Joined  2003-10-09

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);

Profile
 
 
Posted: 22 August 2012 02:32 PM   [ Ignore ]   [ # 3 ]
New Member
Avatar
Total Posts:  10
Joined  2003-10-09

Ok… found it! But why does this code generate an error at the end ?

// DAZ Studio version 4.5.0.114 filetype DAZ Script
oNode Scene.getPrimarySelection().getSkeleton();
var 
obj oNode.getObject();
for (var 
i=0;i<obj.getNumModifiers();i++){
 
var modifier obj.getModifier(i);
 var 
va modifier.getValueChannel();
 print (
modifier.name+'   '+va.getValue()+'   '+va.getMax());
 

 

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:
<anonymous>()@:10
Error executing script on line: 10
Script executed in 1 secs 172 msecs.

Profile
 
 
Posted: 22 August 2012 02:46 PM   [ Ignore ]   [ # 4 ]
New Member
Avatar
Total Posts:  10
Joined  2003-10-09

Notice that the error happens for
i=926

And for information: obj.getNumModifiers()—> 927

Profile
 
 
Posted: 22 August 2012 02:55 PM   [ Ignore ]   [ # 5 ]
New Member
Avatar
Total Posts:  10
Joined  2003-10-09

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!

Profile
 
 
Posted: 22 August 2012 03:21 PM   [ Ignore ]   [ # 6 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  14430
Joined  2003-10-09

Heh, well you saved me from having to reply - but yes, you do need to check the type of the modifier.

 Signature 

DAZ Studio Frequently Asked Questions

Index of free DAZ Studio scripts and plugins list

Profile