PDA

View Full Version : Maxscript - Override default object creation names


stigatle
10-19-2010, 11: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.

Wheiraucher
10-19-2010, 01:37 PM
Hi

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

stigatle
10-20-2010, 05: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-20-2010, 05: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.