RotoHelper for DS 2,3,4

Rotohelper is a DazStudio script i created very quickly to help someone, it's not really user friendly
but after a few minutes of learning it does the job :)

There is no user interface, you must modify the code using a text editor like notepad or wordpad
( make a backup first )

the instructions are part of the script's code

Download links at the bottom of this web page




// DAZ Studio version 3.0 filetype DAZ Script

//--------------------------------------------------------------------

//------------------------- rotohelp v1.2 --------------------------

//--------------------------------------------------------------------

// lets say the timeline is at frame 7

//

// launching this script will load the image

// c:\job001\bkgpics\pic7.bmp

//

// ( note that since padds[0]=0, then number 7 is not padded with zeros )

//

// then this image will be applied to the "Diffuse Color" channel

// of the material named "Default"

// of the node named "Plane"

//

// and

//

// the script will load the image

// c:\job001\frgpics\pic07.png

//

// note how number 7 is padded with 2 zeros, as specified by padds[1]=2

//

// then apply it to the "Diffuse Color" channel

// of the material named "Default"

// of the node named "Plane 2"

//

// on a Mac, the values of paths[] should look something like

//var paths = new Array(

// "/Users/markv/Desktop/movie1/test",

// "/Users/markv/Desktop/movie2/test"

// );

//--------------------------------------------------------------------

// section to be modified by you!

//--------------------------------------------------------------------

var paths = new Array(

"C:\\job001\\bkgpics\\pic",

"C:\\job001\\frgpics\\pic"

);

var padds = new Array(

0,

2

);

var suffixes = new Array(

".bmp",

".png"

);

var nodenames = new Array(

"Plane",

"Plane 2"

);

var matnames = new Array(

"Default",

"Default"

);

var propnames = new Array(

"Diffuse Color",

"Diffuse Color"

);

//--------------------------------------------------------------------

// normally you dont need to modify anything below this line

//--------------------------------------------------------------------

var msg = "";

var num = Scene.getFrame();

for( var i = 0; i < 2; i++ )

{

processMaterials( paths[i], num, padds[i], suffixes[i], nodenames[i], matnames[i], propnames[i] );

}

App.statusLine( msg );

//------------------------------------------------------------------------------------

//----------------------------- end of program run -------------------------------

//------------------------------------------------------------------------------------

//--------------------------------------------------------------------------------------------------

// build an image filename using path,num,suffix

//num is zero padded with the number of zeros specified in [padd]

// apply this image to property [propname] of material [matname]

// of the node named [nodename]

//--------------------------------------------------------------------------------------------------

function processMaterials( path, num, padd, suffix, nodename, matname, propname )

{

var oNode = Scene.findNodeByLabel( nodename );

if( !oNode )

{

msg = "cant find node named" + nodename;

return( false );

}

var mgr = App.getImageMgr();

var inPic = path + paddthis( num, padd ) + suffix;

var img = mgr.getImage( inPic );

if( !img )

{

msg = "cant find image" + inPic;

return( false );

}

var oObject = oNode.getObject(); //no errorcheck

var nShapes = oObject.getNumShapes();

for( var s = 0; s < nShapes; s++ )

{

var oShape = oObject.getShape( s );

if( oShape != undefined )

{

var oMaterial = oShape.findMaterial( matname );

if( oMaterial != undefined )

{

var oProperty = oMaterial.findProperty( propname );

if( oProperty != undefined )

{

oProperty.setMap( img );

}

return( true );

}

}

}

msg = "the property " + propname + " does not exist for the surface named " + matname + ".";

return( false );

}

//=============================================================

// zero-pad a number

//=============================================================

function paddthis( i, padd )

{

if( padd <= 1 )

return( i );

var str = "";

var decade = Math.pow(10,padd-1);

for( j = padd-1; j > 0; j-- )

{

if( i < decade )

{

str = str + "0";

}

decade = decade / 10;

}

str = str + i;

return( str );

}


ċ
rotohelper_ds2.ds
(4k)
mCasual Jacques,
Nov 27, 2009, 1:32 PM
ċ
rotohelper_ds3.dsa
(4k)
mCasual Jacques,
Nov 27, 2009, 1:29 PM
Comments