Problem in locking attributes

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  10 October 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";
camera;
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

Troy
 
  10 October 2005
Try this:

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`;
print $cam;

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";
group;

Or

group "bob";

Does that help?
__________________
mike hovland
lead technical artist
Robomodo

Life beats down and crushes the soul... art reminds you that you have one. - Stella Adler

Last edited by mhovland : 10 October 2005 at 03:58 PM.
 
  10 October 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
camera1_group
camera "bob"
locator aim

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.

Thanks,
Troy
 
  10 October 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.

-OR-

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.

HTH.
 
  10 October 2005
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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 10:08 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.