Quantcast
Channel: Daz Script Developer Discussion - Daz 3D Forums
Viewing all articles
Browse latest Browse all 1038

Updating an NaN script to 4.9?

$
0
0

I've been using 'Not A Number' pose presets for a long time now (to move pieces in modular sets). They applythe trans/rot value ad infinitum, so it's not a fixed value - it just keeps adding the same value to the existing one. The ones I have are .dsa files (DS3.1) and although they still work perfectly well, I want to have them conform properly to 4.9 standards. Does anyone know how I would go about it?

Here are 2 samples - a 3.1 script and a 4.9 (a normal fixed value pose preset)

// DAZ Studio version 3.1  filetype DAZ Script

var xPos = 170;
var yPos = NaN;
var zPos = NaN;
function moveObject( object )
{
	if( object == undefined )
		return;
	if( !isNaN( xPos ) )
		object.getXPosControl().setValue( object.getXPosControl().getValue() + xPos );
	if( !isNaN( yPos ) )
		object.getYPosControl().setValue( object.getYPosControl().getValue() + yPos );
	if( !isNaN( zPos ) )
		object.getZPosControl().setValue( object.getZPosControl().getValue() + zPos );
}
beginUndo();
for( var i = 0; i < Scene.getNumSelectedNodes(); i++ )
moveObject( Scene.getSelectedNode( i ) );
acceptUndo( "Move selected object(s)" );

 

{
	"file_version" : "0.6.0.0",
	"asset_info" : {
		"id" : "/Props/Maclean/Interiors/Corridors/Corridors%20Iray/Pose%20Presets/150.duf",
		"type" : "preset_pose",
		"contributor" : {
			"author" : "maclean",
			"email" : "",
			"website" : "http://www.daz3d.com/maclean"
		},
		"revision" : "1.0",
		"modified" : "2020-09-07T20:14:32Z"
	},
	"scene" : {
		"animations" : [
			{
				"url" : "name://@selection:?translation/x/value",
				"keys" : [ [ 0, -150 ] ]
			}
		]
	}
}

TIA

mac

Edit - Can't get 2nd code snippet to Word Wrap - No idea why


Viewing all articles
Browse latest Browse all 1038

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>