*found a way* get corrective morph assignement to a joint via script?

Singular3DSingular3D Posts: 529

Genesis 3 Female has corrective morphs assigned to the joints via add multiply or spline (e.g. pJCMPelvisFwd_25)

In the file pJCMPelvisFwd_25.dsf theer are parameters like type, label, min/max, but also the values in "formulas" available.

	"formulas" : [		{			"output" : "Genesis3Female:#pJCMPelvisFwd_25?value",			"operations" : [				{ "op" : "push", "url" : "pelvis:/data/DAZ%203D/Genesis%203/Female/Genesis3Female.dsf#pelvis?rotation/x" },				{ "op" : "push", "val" : -0.04 },				{ "op" : "mult" }			]		}	],

Is there a method to get all these values from the bone via script and how? Any idea or hint into the right direction and where to look?

Thanks and best regards

Walter

Post edited by Singular3D on

Comments

  • Richard HaseltineRichard Haseltine Posts: 100,842

    I'm not sure. It's possible to get controllers, but I can't recall how (or if it is possible) to get the controlled proerpties, which is what you want here. Going from the figure, you could get its shape, then the shape's modifiers, then the vlaue channel, then its controller list, then get the properties for those and look for those that are the bends on your bone.

  • Singular3DSingular3D Posts: 529

    Thanks for your reply. I hoped that there will be an attribute of the DzNode that I missed. I don't need the morph data itself, but only the assignement. I have a similar issue with lFoot and lHeel that have interconnected rotations and I wonder, if I can get these things from Daz Studio with a script. I'll have a look at the figure/shape thing too.

  • Singular3DSingular3D Posts: 529

    Hi Richard,

    I did a little search and maybe somewhere here is the information I'm seraching for

    http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/property_dz

    There is a method getControllerList() for a specific property, which may cover the ERC stuff I'm after. The Methods of DzNumericProperty and DzFloatProperty are interesting as well. I'll let you know, when I find something.

  • Richard HaseltineRichard Haseltine Posts: 100,842

    Yes, that's what I was sugesting using - but it gives you the list of cotnrollers, not the list of controlled proerpties, so you need the corrective morphs (from the figure node) and then you can go from those to the bends that control them and check to see if they are the bone of interest.

  • Singular3DSingular3D Posts: 529

    I'm a little stuck at the moment.

    I select a bone/joint and then I use this script

    // DAZ Studio version 4.8.0.59 filetype DAZ Scriptvar nodes = Scene.getSelectedNodeList();var n = nodes.lengthfor (var i=0; i<n; i++){	print("====================================================")	print (nodes[i].getLabel())	var props = nodes[i].getPropertyList()	var lProps = props.length	//go through all properties of the bone and print the label of the property	for (var j=0; j<lProps; j++)    {	    print("----------------------------------------------------")		print ("Property ", j, ": ", props[j].getLabel())		var controls = props[j].getControllerList()	    var lControls = controls.length	    // get all controllers for the property	    for (var k=0; k<lControls; k++)        {		    print ("Controller ", k, ": ", controls[k])        }    }}

    The result is the following output for the lThighBend

    Executing Script...====================================================Left Thigh Bend----------------------------------------------------Property  0 :  X Translate----------------------------------------------------Property  1 :  Y Translate----------------------------------------------------Property  2 :  Z Translate----------------------------------------------------Property  3 :  BendController  0 :  [object Object]Controller  1 :  [object Object]Controller  2 :  [object Object]----------------------------------------------------Property  4 :  Y Rotate----------------------------------------------------Property  5 :  Side-SideController  0 :  [object Object]Controller  1 :  [object Object]Controller  2 :  [object Object]----------------------------------------------------

    getControllerList() probably provides an array of controller_dz objects, but I cannot find any definition of this type. So I'm a bit lost how to continue.

    controller_dz : getController( Number idx )

    Return Value:

    • The i'th controller on this property


    Array : getControllerList()

    Return Value:

    • A list of the controllers on this property

  • Richard HaseltineRichard Haseltine Posts: 100,842
    edited April 2017

    You could get getClassName() to find out which kind of controller it was - the DS3 scripting docs http://docs.daz3d.com/doku.php/public/software/dazstudio/3/start should fill in the gaps but name should work on the controllers.

    Post edited by Richard Haseltine on
  • Singular3DSingular3D Posts: 529

    Wow, you're fast

    I used

    print ("Controller ", k, ": ", controls[k].className())

    and I get

    Controller  0 :  DzERCLink

    I will have a look at the old 3.x documentation.

     

  • Singular3DSingular3D Posts: 529

    The 3.x docs are very helpful. I found

    String DzController::descriptionThe description of the controller (Read Only) 

    If I change the script,

    		    print ("Controller ", k, ": ", aControls[k].className())		    print ("Controller ", k, ": ", aControls[k].description)

    I get

    Property  3 :  DzBone  :  BendController  0 :  DzERCLinkController  0 :  ERC [DeltaAdd] > Genesis 3 Female:Knees Up Left

    Nice!

  • Singular3DSingular3D Posts: 529

    Now I wonder where the sub-components can be found wink

    e.g. ERC [Delta-Add] > Genesis 3 Female:pJCMThighFwd_115_L

  • Richard HaseltineRichard Haseltine Posts: 100,842

    I don't see a way to go from controller to sub-component, though I did think it was possible (and that I'd done it).

  • Singular3DSingular3D Posts: 529

    The node should be a controller for the sub-component, so maybe I have to go through all ERCLinks and find out if a specific node is the controller.

    Rob should know.. laugh

  • Richard HaseltineRichard Haseltine Posts: 100,842

    The node should be a controller for the sub-component, so maybe I have to go through all ERCLinks and find out if a specific node is the controller.

    Rob should know.. laugh

    Yes, that's what I meant (going through the links checking the controller - Rob's knowing goes without saying).

  • Singular3DSingular3D Posts: 529

    The node should be a controller for the sub-component, so maybe I have to go through all ERCLinks and find out if a specific node is the controller.

    Rob should know.. laugh

    Yes, that's what I meant (going through the links checking the controller - Rob's knowing goes without saying).

    Hmm, but how do I get all ERCLinks? Is there a function somewhere? The morph is linked to a node. Is there a function to get all morphs in a scene, so that I can go through them. Thanks for your great help by the way!

  • Richard HaseltineRichard Haseltine Posts: 100,842

    The morphs belong to the shape, which in turn belongs to the figure (not the bones). So go through the modifiers on the figure and you will get the morphs (among other things).

  • Singular3DSingular3D Posts: 529

    By figure you mean a DzSkeleton or simply a DzObject, which has methods like getModifier and getShape? The question is how do I get DzObject? Via the DzScene?

  • Richard HaseltineRichard Haseltine Posts: 100,842

    In the case of rigged figures the geometry (which has the shape modifiers) is owned by the figure node (Genesis 3 female or whatever) rather than by a bone. So you need the figure (DzNode.getSkeleton()), then from that you get the DzObject (.getObject()), then you use getNumModifiers() for that and iterate using getModifier( n )

  • Singular3DSingular3D Posts: 529

    Thanks a lot. By the way: I wrote a PDF with 28 pages so far about joints and some basic technical information. I'd like to share this here as sort of give-back. What would be the best place to do so?

    Maybe in a thread in the technical discussion?

  • Richard HaseltineRichard Haseltine Posts: 100,842

    That would be very welcome to a lot of people. Technical Discussion might work, or Daz Studio Discussion since it is application-specific, or the Freebies forum.

  • Singular3DSingular3D Posts: 529
    edited April 2017

    Uploaded the first 5 chapters in Daz Studio Discussion. Thanks again for your help and guidence.

    I also attached a little script and the result/dump in the log file to this post. Might be helpful as well for someone.

    I just selected the Left Thigh Bend and executed the script.

    dsa
    dsa
    Exporter0001.dsa
    2K
    txt
    txt
    Exporter0001-Dump.txt
    39K
    Post edited by Singular3D on
  • drzapdrzap Posts: 795

    Uploaded the first 5 chapters in Daz Studio Discussion. Thanks again for your help and guidence.

    I also attached a little script and the result/dump in the log file to this post. Might be helpful as well for someone.

    I just selected the Left Thigh Bend and executed the script.

    Thank you for this.  Does this list include all the JCMs on the figure?

Sign In or Register to comment.