View Full Version : Maxscript - Override default object creation names

10 October 2010, 10:06 AM
In the current work I do it's very important that no objects is named "box 01, shape 02" etc.
But the thing is that it's very easy to forget,
so the question is: How can one hook into the "creation" process of an object, to prefix the names and\or change it while I create the object?

I would prefer a way to do so without re-making the existing GUI with new buttons in a script,
I just want to fetch it while you create, change what I need.

Any hints on how this can be done?

Thanks in advance.

10 October 2010, 12:37 PM

Do you know callbacks? They are perfect for these kind of things. There is one called #scenenodeadded which is called right after a node has been added to the scene. The notificationparam will give you the node, and from there changing the name is easy.

something like this

fn renameobject =
(callbacks.notificationparam()).name = "MySpecialName"

callbacks.addscript #sceneNodeAdded "renameobject()" id:#tests

10 October 2010, 04:40 AM
thank you very much, this is exactly what I needed!

I knew callbacks, but have not used them before, so I was a bit unsure on how that worked,
your answer clears out my questions about it. Thanks again!

CGTalk Moderation
10 October 2010, 04:40 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.