|10-21-2005, 01:52 PM||#1|
Join Date: Oct 2005
Problem in locking attributes
I can't for the life of me figure out what I'm doing wrong.
I've looked at the example flags and reference and it looks fine
but I keep getting no attribute specified and I'm thinking...yes I'm locking translate X...
here's the sample code
string $name = "bob";
rename $name; //I've renamed it this way as I can't see how in the camera create command where I can specify a name
setAttr -lock true $name.tx;
The other problem I'm having is in creating new group nodes..
I can't find the right command to select the top most group node.
example when I create a 2node Camera..it also creates a camera1_group node.
I want to be able to create new group nodes above this node.
I know I can simply select this...but if the script is creating multiple cameras, this group node name will change.
Thanks for the help on these 2 problems
|10-21-2005, 03:51 PM||#2|
Join Date: Feb 2002
setAttr -lock true ($name+".tx");
You have the name stored in a string variable, and you need to put the two pieces of string data together. This is called string catenation.
What is going on is you are saying to take what is in the variable $name (bob) and add (.tx) to it, giving you "bob.tx".
For your second issue, capture the results from the camera; command into a varible. The camera command returns a string that contains the camera name, and the camera shape node.
Add this into your code:
$cam = `camera`;
This will show you the names after they are created. You then rename the camera to "bob". This will change the name of the shape node as well to "bobShape". If you want to create a group....
select -r "bob";
Does that help?
lead technical artist
Life beats down and crushes the soul... art reminds you that you have one. - Stella Adler
Last edited by mhovland : 10-21-2005 at 03:58 PM.
|10-21-2005, 04:32 PM||#3|
Join Date: Oct 2005
Thanks, thata's awesome...
the second solution doesn't work as I tried that. The problem is I can change the name of the camera and the shapenode ok...it's the camera1_group node above it..
it looks lihe this
When I add a group it adds the group above the camera "bob" and not above camera1_group where I want it..I can simply select -r camera1_group..this works till I create another camera from the script..then I have a conflict.
|10-21-2005, 06:01 PM||#4|
Join Date: Aug 2005
You have two options to get the parent:
1) `select camera1`
2) `pickWalk -d up`
This will select the parent to camera1. Of course in this case you still need to know how many times you want to traverse up the DAG.
You will need to make use of the listRelatives command to determine the parents to the given transform. If you have camera1 selected, for instance, then you would need to call `listRelatives -p camera1` or alternatively `listRelatives -ap camera1` depending on the DAG layout. This will return the name of the parent transform and you can check the name to see if that's the one you're looking for or not. I can't really elaborate much further without more info on what the scenario is.
|10-21-2005, 06:01 PM||#5|
Lord of the posts
Join Date: Sep 2003
Thread automatically closed
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
|Thread Closed share thread|
|Thread Tools||Search this Thread|