Setting parameters of a figure in script

mrmorphmrmorph Posts: 131

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


  • Richard HaseltineRichard Haseltine Posts: 20,459
    edited December 1969

    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.

  • mrmorphmrmorph Posts: 131
    edited February 2013

    Great thanks, figured it out thanks to you :)

    Post edited by mrmorph on
  • mrmorphmrmorph Posts: 131
    edited December 1969

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

  • Richard HaseltineRichard Haseltine Posts: 20,459
    edited December 1969

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

  • mrmorphmrmorph Posts: 131
    edited December 1969

    Thanks Richard that worked a treat :)

  • kitakoredazkitakoredaz Posts: 2,141
    edited May 2014

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

    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,,??

    Post edited by kitakoredaz on
  • Richard HaseltineRichard Haseltine Posts: 20,459
    edited December 1969

    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.

  • kitakoredazkitakoredaz Posts: 2,141
    edited December 1969

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

Sign In or Register to comment.
Rocket Fuel