Digital Art Zone

 
     
Setting parameters of a figure in script
Posted: 05 February 2013 08:48 AM   [ Ignore ]
Member
Avatar
Rank
Total Posts:  54
Joined  2006-09-17

Hi, I am just starting with a little scripting and just needed some pointers please.

I would like to make a script that programmatically changes the values of the head bend and twist, but don’t really know where to start.

See my image, I have V4.2 loaded and those are the dials I want to change,

How would I go about selecting the actor and then changing setting the value of those dials in my script ?

In the meantime I will keep hunting, I found some useful things but am a bit stuck on this bit. atm

Cheers smile

Image Attachments
chchchchanges.jpg
Profile
 
 
Posted: 05 February 2013 09:05 AM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  15296
Joined  2003-10-09

You need to identify your figure - usually by selecting it and using Sceen.getPrimarySelection() or Scene.getSelectedFigureList(). Then you can use figure.findNodeChild( “name” , true ) to get the ehad and neck. For each of those use node.getXRotControl() and so on to get the parameters. For the controls you then use control.getValue() and control.setValue( val ) to make the changes.

 Signature 

DAZ Studio Frequently Asked Questions

Index of free DAZ Studio scripts and plugins list

Profile
 
 
Posted: 05 February 2013 09:35 AM   [ Ignore ]   [ # 2 ]
Member
Avatar
Rank
Total Posts:  54
Joined  2006-09-17

Great thanks, figured it out thanks to you smile

Profile
 
 
Posted: 14 February 2013 05:26 AM   [ Ignore ]   [ # 3 ]
Member
Avatar
Rank
Total Posts:  54
Joined  2006-09-17

OK, I got that working.  Now I have got the head (I’m using V5) I would also like to set the mouth shape.

So it seems I find the head node again as the Visemes are in the head.

How do I select, for example; ‘IY’ and set it’s value please ?

Cheers smile

Profile
 
 
Posted: 14 February 2013 07:00 AM   [ Ignore ]   [ # 4 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  15296
Joined  2003-10-09

The head “morphs” atr actually not true morphs, those are on the root node, they are properties. This should work:

var prop node.findPropertyByLabel"IY" );
if ( 
prop {
 prop
.setValue);
 Signature 

DAZ Studio Frequently Asked Questions

Index of free DAZ Studio scripts and plugins list

Profile
 
 
Posted: 15 February 2013 10:40 AM   [ Ignore ]   [ # 5 ]
Member
Avatar
Rank
Total Posts:  54
Joined  2006-09-17

Thanks Richard that worked a treat smile

Profile
 
 
Posted: 15 May 2014 11:46 AM   [ Ignore ]   [ # 6 ]
Power Member
Avatar
RankRankRank
Total Posts:  1881
Joined  2012-03-24

(I have only simple java-script knowledge,, so that please forgive me to join this forum,,
and If modelator think,, there is more good place for “me” to ask about ds scripts basics , and
plug in with Qt creator, and C++ for daz studio, send me the forum please,,

Then,,,I want to know clear, how to access each properties (in parameter tab) of each Node,
and just set value, (get value too) by “property path and name”  which can see in parameter tab.

Now I get Node, like that (to test , just get top node of Nodelist in the scene)

var nArray = Scene.getNodeList();
var tNode = nArray[0];
var tPropTree = tNode.getPropertyGroups();
var allPropertyPaths = tPropTree.getAllPaths();
print(allPropertyPaths)

it can tell me all property Paths ,,(not property name,,)

I want to find way to get all “Paths and property names” of Node.

and hope to access and set each proeprty value by using “path and name” or “name” only if I can,,

eg,, now there is one property ,,  Mymorphs/morph1
how can I achieve it?

================
edit,, ah,,OK I could not find the method to get property of DazNode,,
DazNode seems have no method to find property,,

but all DzElements method can use for children too?
maybe I can use “var tProp = node.findProperty(morph1) “? 
then,, tProp.setValue() ?

then why Rechard can find setvalue()  method,, frome where^^;
because,, I can not find the method in DzProperty methods,,
I want to understand more about setValue(),,, where can I find ti,,??

 

Profile
 
 
Posted: 15 May 2014 12:19 PM   [ Ignore ]   [ # 7 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  15296
Joined  2003-10-09

Yes, children inherit (or rewrite) the methods of all their parents. Properties are (usually) DzFloatProperty (use .inherits( “DzFloatProperty” ) to check) and setValue() belongs to that.

 Signature 

DAZ Studio Frequently Asked Questions

Index of free DAZ Studio scripts and plugins list

Profile
 
 
Posted: 15 May 2014 12:58 PM   [ Ignore ]   [ # 8 ]
Power Member
Avatar
RankRankRank
Total Posts:  1881
Joined  2012-03-24

Richard Thanks to teach me so many things everytime I asked .. (T T)

Profile