Add Point At Null

ebergerlyebergerly Posts: 3,033

So I'm writing a script where you select a character in the scene and then run a script that:

  1. Adds a null to the scene and names it "EyeGoalNull"
  2. Sets the Point At property of the character's Left Eye and Right Eye to the EyeGoalNull

I've got step 1 completed, but can't figure how to do step 2. Here's what I have so far:

	var n = new DzNode();
	Scene.addNode( n );
	n.setName( "EyeGoalNull" ); 
	n.setLabel( "EyeGoalNull" );

 

Anyone? I wish it's as simple as SelectedNode.LeftEye.PointAt = EyeGoalNull  

Post edited by ebergerly on

Comments

  • ebergerlyebergerly Posts: 3,033
    edited February 14

    Okay, getting closer I think...

    This seems to successfully find the left eye node as a child of the selected parent:

    	var n = new DzNode();
    	Scene.addNode( n );
    	n.setName( "EyeGoalNull" ); 
    	n.setLabel( "EyeGoalNull" );
    	
    	// Print name of selected node type
    	node = Scene.getPrimarySelection()
    	print("Node Name =" + node.name)
    	var foundit = node.findNodeChild("lEye", true);

     

    Now I just need to know how to access the Point At property of the eye nodes....

    Post edited by ebergerly on
  • ebergerlyebergerly Posts: 3,033
    edited February 14

    Hey, I think I've got it !!!

    	var n = new DzNode();
    	Scene.addNode( n );
    	n.setName( "EyeGoalNull" ); 
    	n.setLabel( "EyeGoalNull" );
    	
    	// Print name of selected node type
    	node = Scene.getPrimarySelection()
    	print("Node Name =" + node.name)
    	
    	// Recursively look for the left eye child node
    	var foundit = node.findNodeChild("lEye", true);
    	
    	// Set eye to point at eye goal null we added
    	foundit.setPointAtTarget(n);

     

    Post edited by ebergerly on
  • ebergerlyebergerly Posts: 3,033

    So if you renamed the character from say Genesis3Female to say Girl1, how do you access that new name? Seems like node.name gives you the Genesis3Female as opposed to the name you applied. And it seems "node.alias" doesn't do it...

  • ebergerlyebergerly Posts: 3,033

    Ahh, okay, it's node.getLabel()...

Sign In or Register to comment.