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

ERCFreeze naming difficulties

$
0
0

I've been working on a script to automatically align the bones of Antenna to the head of whatever model they are attached to, then ERC freeze them, and Save the morph.

I've modified two of the Sample Scripts:

http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/properties/erc_freeze/start

http://docs.daz3d.com/doku.php/artzone/wiki/user/rbtwhiz/technotes/daz_script/node_properties/start

I use the Node Properties script to find and isolate and FHM head morphs, then pass them onto the ERCFreeze function.

			for( var i = 0; i < aPROPERTIES.length; i++ ){
				oProperty = aPROPERTIES[ i ];
				oOwner = oProperty.getOwner();
								
				if( oOwner.className() == "DzMorph" && (oProperty.getValue() != 0) ){
					sMorphName = oOwner.getName();
					sMorphName = sMorphName.toUpperCase();
					
					if ( (sMorphName.slice(0, 3)) == "FHM") {
					      oHeadMorph[nHeadMorphNum] = oProperty;

==================================================================================================

			// Define a controller;
 			oControllerNode = (oTrgtNode);
	 
			// Create and setup a controller property
			oControllerProperty = ( oHeadMorph[i] );
 			oControllerNode.addProperty( oControllerProperty );

While this technically works, it changes the NAME of the Controlling Property to VALUE, which is the actual name of the property. The real name is found by using oProperty.getOwner(). I don't want to create a NEW property, because then I'll have duplicate properties.

Using the oHeadMorph[i].getOwner() throws a null error, so I assume the FHM property is not compatible as an addProperty, while the child IS, but it's name is VALUE.

I still don't have an innate grasp of classes yet, so hard to wrap my head around. =/

Does anyone know how to attach an ERC Freeze to an Existing Controller? or how to REMOVE the current Morph controller, so I can just make a new one?


Viewing all articles
Browse latest Browse all 1036

Trending Articles



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