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

11 November 2008, 11: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
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);


11 November 2008, 01:09 AM
This is how I do it:

var o = GetValue("SelectionList");

o(0).name = "foo";


11 November 2008, 01:45 AM
You can also use the Object Model

Selection(0).Name = "Ball";

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

11 November 2008, 05: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.

11 November 2008, 04: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?

11 November 2008, 05:35 AM
yes, how you do it depends from the language.

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

11 November 2008, 05:57 AM
Awesome that works great! This is going to make it heaps easier when i am naming hundreds of rigging nodes!

CGTalk Moderation
11 November 2008, 05: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.