[Help] How to make a script to load DS materials with a PP2/CR2 figure?

MBuschMBusch Posts: 547

There are a lot of older DAZ products that comes with the traditional Poser files and DS companion files to apply materials. Currently I know that is possible to load a CR2 or PP2 with the correct materials for DAZ Studio. Cyborg Model 4 from DzFire is one example. You just load the Cr2 character and the companion script just apply the correct material for DS. Are there some template to get this done on other products? From which version DS supports this feature?

Comments

  • fixmypcmikefixmypcmike Posts: 19,582
    edited December 1969

    Copy the .dsa file which would apply the mat to an object already loaded in the scene and make the following change:

    Find the line reading:

     
    DsActions.prototype.begin = function()
    

    BEFORE that line insert the following code:

     
    DsActions.prototype.collectNodes = function( bSelected, bRecurse, bFromRoot ){ 
          var origNodes, ourNode; 
          var n , m; 
    
          if ( getArguments().length == 0 ) 
             return []; 
    
          origNodes = Scene.getNodeList(); 
          if ( App.getImportMgr().readFile( getArguments()[0] ) == 0 ) { 
             var newNodes =  Scene.getNodeList(); 
             ourNode = undefined; 
             for( n = 0; n < newNodes.length && !ourNode ; n++ ) { 
                ourNode = newNodes[ n ]; 
                for ( m = 0 ; m < origNodes.length && ourNode ; m++ ) { 
                   if ( ourNode == origNodes[ m ] ) 
                      ourNode = undefined; 
                } 
             } 
             if ( ourNode ) 
                  return [ ourNode ]; 
          } 
          return []; 
       } 
    

    Then find the line:

    
    this.m_aNodes = g_oSceneHelper.collectNodes( true, true, true );
    

    and replace it with:

    
    this.m_aNodes = this.collectNodes( true, true, true );
    

    and put the new whatever.dsa file in the same Poser library as whatever.cr2 (or.pp2 or .hr2).

    This method works in DS3 and up; there's a similar process for DS2 if you need it.

  • MBuschMBusch Posts: 547
    edited December 1969


    ...

    This method works in DS3 and up; there's a similar process for DS2 if you need it.

    Thank you so much! It works like a charm.

Sign In or Register to comment.