Super easy script question (i think)


#1

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


#2

This is how I do it:

var o = GetValue("SelectionList");

o(0).name = "foo";

A


#3

You can also use the Object Model

Selection(0).Name = “Ball”;


#4

There’s a scripting subforum for such threads.
Moving it for you, next time please post in the correct forum.


#5

Cool, thanks guys!
It was killing me trying to search for that :slight_smile:
And I hadn’t realised there was a scripting subforum here. Cool.


#6

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?


#7

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”


#8

Awesome that works great! This is going to make it heaps easier when i am naming hundreds of rigging nodes!
Thankyou


#9

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.