DAZ Script: DSA file animation confusion...

Artman009Artman009 Posts: 33

Hi, everyone. I'm new to DAZ Scripting so please forgive my ignorance but I have a few specific questions to some code.

I'm attempted to examine and understand morph animation data when exported to a .DSA file. I understand the .DSA format is being retired but I believe my code questions relate to general DAZ scripting.

Anyway, here's my project:

1) Start with a new scene
2) Used the built-in lip sync plugin on a default Genesis figure to have key framed facial animation.
3) I then exported the animation to a .DSA file, exporting only the visemes morphs, nothing else.

When I open the .DSA file in a text editor, I can find the section where the morphs are being animated (see below) but I do not understand how the file is making sense of the morph's strength (0 to 1) as it relates to the frame number of the animation.

Here's the relevant code:

 g_oPresetHelper.checkAnimationRange( 18000 );
 for( var i = 0; i < this.m_aNodes.length; i++ ){
  this.setProperties( this.m_aNodes[ i ].getSkeleton(), this.m_aNodes[ i ], bRecurse );
 }
 acceptUndo( String( "\"%1\"" ).arg( g_sSCRIPT_NAME ) );
 clearBusyCursor();
}

DsActions.prototype.setProperties =function( oSkeleton, oNode, bRecurse ){
 var sSkeleton = "";
 if( oSkeleton ){
  this.m_oSkeleton = oSkeleton;
  sSkeleton = this.m_oSkeleton.name;
 }
 this.m_oElement = oNode;
 g_oPresetHelper.setTargetElement( this.m_oElement );
 switch( this.m_oElement.name ){
  case "head":
    g_oPresetHelper.setNumericProperty( "CTRLVSMW",  [ 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, 0,
 1800, 0, 7600, 0, 10000, 0, 11600, 0, 15800, 0, 18000, 0 ] );
    g_oPresetHelper.setNumericProperty( "CTRLVSMUW",  [ 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, 0,
 1800, 0, 7600, 0, 10000, 0, 11600, 0, 15800, 0, 18000, 0 ] );
    g_oPresetHelper.setNumericProperty( "CTRLVSMTH",  [ 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, 0,
 1800, 0, 7600, 0, 10000, 0, 11600, 0, 15800, 0, 18000, 0 ] );
    g_oPresetHelper.setNumericProperty( "CTRLVSMT",  [ 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, 0,
 1800, 0, 7600, 0, 10000, 0, 11600, 0, 15800, 0, 18000, 0 ] );
    g_oPresetHelper.setNumericProperty( "CTRLVSMSH",  [ 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, 0,
 1800, 0, 7600, 0, 10000, 0, 11600, 0, 15800, 0, 18000, 0 ] );
    g_oPresetHelper.setNumericProperty( "CTRLVSMS",  [ 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, 0,
 1800, 0, 7600, 0, 10000, 0, 11600, 0, 15800, 0, 18000, 0 ] );
    g_oPresetHelper.setNumericProperty( "CTRLVSMOW",  [ 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, 0,
 1800, 0, 3200, 0, 3800, 1, 4400, 0, 7600, 0, 10000, 0, 11600, 0, 12400, 1, 13600, 0, 15800, 0, 18000, 0 ] );
    g_oPresetHelper.setNumericProperty( "CTRLVSMM",  [ 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, 0,
 1800, 0, 2400, 0, 3200, 1, 3800, 0, 5000, 0, 5600, 1, 6600, 0, 7600, 0, 10000, 0, 10800, 0, 11600, 1, 12400, 0, 15800, 0, 18000, 0 ] );
    g_oPresetHelper.setNumericProperty( "CTRLVSML",  [ 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, 0,
 1800, 0, 7600, 0, 10000, 0, 11600, 0, 15800, 0, 18000, 0 ] );
    g_oPresetHelper.setNumericProperty( "CTRLVSMK",  [ 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, 0,
 1800, 0, 7600, 0, 10000, 0, 11600, 0, 15800, 0, 18000, 0 ] );
    g_oPresetHelper.setNumericProperty( "CTRLVSMIY",  [ 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, 0,
 1800, 0, 7600, 0, 10000, 0, 11600, 0, 15800, 0, 18000, 0 ] );
    g_oPresetHelper.setNumericProperty( "CTRLVSMIH",  [ 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, 0,
 1800, 0, 7600, 0, 10000, 0, 11600, 0, 15800, 0, 18000, 0 ] );
    g_oPresetHelper.setNumericProperty( "CTRLVSMF",  [ 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, 0,
 1800, 0, 3800, 0, 4400, 1, 5000, 0, 7600, 0, 10000, 0, 11600, 0, 12400, 0, 13600, 1, 14800, 0, 15800, 0, 18000, 0 ] );
    g_oPresetHelper.setNumericProperty( "CTRLVSMER",  [ 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, 0,
 1800, 0, 7600, 0, 10000, 0, 11600, 0, 15800, 0, 18000, 0 ] );
    g_oPresetHelper.setNumericProperty( "CTRLVSMEH",  [ 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, 0,
 1800, 0, 2400, 1, 3200, 0, 4400, 0, 5000, 1, 5600, 0, 7600, 0, 10000, 0, 10800, 1, 11600, 0, 13600, 0, 14800, 1, 15800, 0, 18000, 0 ] );
    g_oPresetHelper.setNumericProperty( "CTRLVSMAA",  [ 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, , 0, 0,
 1800, 0, 5600, 0, 6600, 1, 7600, 0, 10000, 0, 11600, 0, 15800, 0, 18000, 0 ] );
    break;
  default:
   break;
 }
 if( bRecurse ){
  var aStack = [ oNode ];
  while( aStack.length > 0 ){
   var oParent = aStack.pop();
   var nNodes = oParent.getNumNodeChildren();
   var oChild;
   for( var n = 0; n < nNodes; n++ ){
    oChild = oParent.getNodeChild( n );
    if( oChild.inherits( "DzBone" ) ){
     if( oChild.getNumNodeChildren() > 0 ){
      aStack.push( oChild );
     }
     this.setProperties( oSkeleton, oChild, false );
    }
   }
  }
 }
}

Can anyone help me make sense of the numbers to the left of the morph controller as it relates to the timing/frame of the animation?

Post edited by Richard Haseltine on

Comments

  • Richard HaseltineRichard Haseltine Posts: 100,913
    edited December 1969

    The DS3 documentation isn't exactly helpful, most of the DzPresetHelper functions are undefined. For trying to figure the details out like this it would probably be better to start with a simpler example, such as having a single morph go from 0 in frame 0 to .5 in frame 15 to 1 in frame 30 - that gives

    g_oPresetHelper.setMorphProperty( "FBMFaerie", [ 0, , 0, , 0, , 0, 0, 2400, 0.5, 4800, 1 ] );

    So the second half of the array, after the 0s interspersed with empty entries, is the time index of the key (in 4,800ths of a second - see the entry for DzTime in the DS3 docs, according to which that's a Tick and is what DS uses) followed by the keyed value of the morph. I don't know what the first block of numbers is - I seem to recall Rob explaining it all once, presumably on the old forum - but I suspect that it may be a place-holder that would otherwise hold the type of key; however that's a pretty wild guess.
Sign In or Register to comment.