How do I get dsa script to run in every frame?

I am new to daz scripting.

Simple question.- I have DSA script that I would like to run in every frame.

What is the easiest way to do that besides clicking  F5 and going to the next frame?

-J

Thanks in advance!

 

Comments

  • Richard HaseltineRichard Haseltine Posts: 100,879

    Do you mean you want to run the script in one go to do something with every frame, or do you mean you want the script to run each tiem you change a frame as you are interacting with the scene?

  • jhandyjhandy Posts: 23

    in one go in every frame

     

  • Richard HaseltineRichard Haseltine Posts: 100,879

    Scene gives you access to the information and functions you need - just get the number of frames from Scene.getPlayRange() and Scene.getTimeStep(), then use Scene.setFrame( frame ) to iterate through the frames doinf whatever it is you want to do at each.

  • jhandyjhandy Posts: 23

    hmm..  something  like this

    Scene.getPlayRange()

    Scene.getTimeStep()

    Scene.setFrame( frame ){

    <<<my script >>>                                 

                                      }

  • Richard HaseltineRichard Haseltine Posts: 100,879

    Yes, though you will need to get the actual time interval from the play range and then divide by the TimeStep to get a frame count, then use a loop (for n = 0 ; n < maxFrames ; n++ ) { My Script } to do the iteration.

  • jhandyjhandy Posts: 23

    thank you, so what would that  look like?

     

  • jhandyjhandy Posts: 23

    Thank you, but I still haven't gotten it to work. Can you show me how that might look like?

    here is the script I am trying to iterate per every frame.

     

    --

    // DAZ Studio version 4.8.0.59 filetype DAZ Script

     

     

    var oSkeleton = Scene.getSelectedNode( 0 );

    if( oSkeleton.inherits( "DzBone" ) )

    {

    oSkeleton = oSkeleton.getSkeleton();

    }

    beginUndo();

    oNode = oSkeleton.findNodeChild( "rThighBend", true );

    oZRotCtrl = oNode.findPropertyByLabel( "Side-Side" );

    nZRot = oZRotCtrl.getValue();

    oZRotCtrl.setValue( nZRot + 6 );

    oNode = oSkeleton.findNodeChild( "lThighBend", true );

    oZRotCtrl = oNode.findPropertyByLabel( "Side-Side" );

    nZRot = oZRotCtrl.getValue();

    oZRotCtrl.setValue( nZRot - 6 );

    oNode = oSkeleton.findNodeChild( "rShldrBend", true );

    oZRotCtrl = oNode.findPropertyByLabel( "Bend" );

    nZRot = oZRotCtrl.getValue();

    oZRotCtrl.setValue( nZRot - 45 );

    oNode = oSkeleton.findNodeChild( "lShldrBend", true );

    oZRotCtrl = oNode.findPropertyByLabel( "Bend" );

    nZRot = oZRotCtrl.getValue();

    oZRotCtrl.setValue( nZRot + 45 );

    acceptUndo( "G3F G8F pose adjust" );

     

    --

Sign In or Register to comment.