PDA

View Full Version : Super easy script question (i think)


pete
11-09-2008, 10:42 PM
Hi there,

I am a pretty naff scripter but from time to time i need to do this and I can't figure it out. (it's a hard one to search for but i'm sure it's dead simple)
If i had a sphere, say and I wanted to change it's name via scripting to 'ball', I could
put:
SetValue("sphere.Name", "Ball", null); How could I do something like that, but to whatever the currently selected item was?
I guess it would look something like this? - SetValue("SELECTED.Name", "Ball", null);

Thanks
Pete

greyface
11-10-2008, 12:09 AM
This is how I do it:

var o = GetValue("SelectionList");

o(0).name = "foo";

A

Chinny
11-10-2008, 12:45 AM
You can also use the Object Model

Selection(0).Name = "Ball";

ThE_JacO
11-10-2008, 04:16 AM
There's a scripting subforum for such threads.
Moving it for you, next time please post in the correct forum.

pete
11-10-2008, 04:40 AM
Cool, thanks guys!
It was killing me trying to search for that :)
And I hadn't realised there was a scripting subforum here. Cool.

pete
11-27-2008, 03:37 AM
Just expanding on this a bit, would there be a way to use this script
Selection(0).Name = "Ball";
but make it so it appends the name that is already there?

ThE_JacO
11-27-2008, 04:35 AM
yes, how you do it depends from the language.

the pseudo code would be in form:
obj.name += "suffix"
or
obj.name = obj.name + "suffix"

pete
11-27-2008, 04:57 AM
Awesome that works great! This is going to make it heaps easier when i am naming hundreds of rigging nodes!
Thankyou

CGTalk Moderation
11-27-2008, 04:57 AM
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.