Zero specified node Pose script

TimingisEverythingTimingisEverything Posts: 112
edited December 1969 in Daz Script Developer Discussion

Hello, I'm trying to zero the pose of 2 specific nodes (leye, reye) could somebody assist me with this script?

Comments

  • Richard HaseltineRichard Haseltine Posts: 97,321
    edited December 1969

    Just the transforms, or are you wanting to zero morphs shaping those areas - and if so, which figure is it? Getting the nodes if you have the figure or any aprt of it selected is fairly simple -if your node doesn't .inherit( "DzSkeleton" ) then .getSkeleton(), then on that .fingNodeChild( "Name" , true ), then use the .setXRotControl() etc. to get the parameters and .setValue( 0 ) to zero them.

  • TimingisEverythingTimingisEverything Posts: 112
    edited May 2015

    Just the transforms, or are you wanting to zero morphs shaping those areas - and if so, which figure is it? Getting the nodes if you have the figure or any aprt of it selected is fairly simple -if your node doesn't .inherit( "DzSkeleton" ) then .getSkeleton(), then on that .fingNodeChild( "Name" , true ), then use the .setXRotControl() etc. to get the parameters and .setValue( 0 ) to zero them.

    The figure is Genesis 2, and I'm only wanting to zero the transforms.


    here is the script I've came up with but I just can't get it to work.

    var item = Scene.getPrimarySelection()

    item.inherit( "DzSkeleton" )

    var bones = item.fingNodeChild( "Right Eye" , true )

    control = bones.setXRotControl()

    control.setValue(0)

    Post edited by TimingisEverything on
  • Richard HaseltineRichard Haseltine Posts: 97,321
    edited December 1969

    Just the transforms, or are you wanting to zero morphs shaping those areas - and if so, which figure is it? Getting the nodes if you have the figure or any aprt of it selected is fairly simple -if your node doesn't .inherit( "DzSkeleton" ) then .getSkeleton(), then on that .fingNodeChild( "Name" , true ), then use the .setXRotControl() etc. to get the parameters and .setValue( 0 ) to zero them.

    The figure is Genesis 2, and I'm only wanting to zero the transforms.


    here is the script I've came up with but I just can't get it to work.

    var item = Scene.getPrimarySelection()

    item.inherit( "DzSkeleton" )

    var bones = item.fingNodeChild( "Right Eye" , true )

    control = bones.setXRotControl()

    control.setValue(0)

    I mistyped -should have been findNodeChild, which works on names and not labels. And it's getXRotControl and so on that you want

    var item = Scene.getPrimarySelection()
    // The inherit command is a check - it returns true if it does, false otherwise
    if ( ! item.inherits( "DzSkeleton" ) ) {
     // If item doesn't inherit DzSkeleton try getting its parent skeleton
     item = item.getSkeleton();
    }
    // If item wasn't a skeleton or a bone it will now by null, so we need to check before proceeding
    if ( item ) {
     // Find the bone - true tells it to scan, otherwise it would check only the first step of the hierarchy (hip on a human)
     var bone = item.findNodeChild( "rEye" , true )
     // Get the control
     var control = bone.getXRotControl()
     // Check to see we got the control, if so zero it 
     if ( control ) {
      control.setValue(0)
     }
     // Don't need to decalre the variable twice
     control = bone.getYRotControl() 
     if ( control ) {
      control.setValue(0)
     }
     control = bone.getZRotControl() 
     if ( control ) {
      control.setValue(0)
     }
    }
  • TimingisEverythingTimingisEverything Posts: 112
    edited December 1969

    Thank you for helping me with this Richard, I still recieve a error when using this code. I copied the exact code you posted.

    my error log reads

    F:/OLD HD/DAZ4/Content/ABCDAZ/Testscript.duf (1,1): Syntax error - expected '{' or '['
    Error reading file, see log for more details.

  • Richard HaseltineRichard Haseltine Posts: 97,321
    edited May 2015

    Hmm, works for me pasted into the ScriptIDE window - try that with the code from your file (Window>Panes(Tabs)>Script IDE and click the Execute button)

    Post edited by Richard Haseltine on
  • TimingisEverythingTimingisEverything Posts: 112
    edited May 2015

    Hmm, works for me pasted into the ScriptIDE window - try that with the code from your file (Window>Panes(Tabs)>Script IDE and click the Execute button)

    nevermind my mistake, it was because I saved it to a .duf file instead of .dsa.

    It works perfectly, Many thanks for helping me with this!

    Post edited by TimingisEverything on
Sign In or Register to comment.