access my name, transform etc from script

access my name, transform etc from script

Anonymous
Not applicable
230 Views
2 Replies
Message 1 of 3

access my name, transform etc from script

Anonymous
Not applicable
Aplogies for green question, but I have searched for an answer and can't find it .....

How do I access my name, transform etc from withing a SimpleObject plugin?
I would expect to use this.name and this.transform, but they don't work,
even though this.localVariable or (classOf this) work as I would expect.

Thanks
0 Likes
231 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
It's not easy. I posed the same question a while back and got an answer that works, but it is a bit messy. This was the thread:

area.autodesk.com/forum/Autodesk-3ds-Max/maxscript/getting-the-object-itself-in-a-scripted-plug-in/
0 Likes
Message 3 of 3

Anonymous
Not applicable
Thankyou. Very unsavoury, but ...

Here is an alternative that seems to work and (to me) is not QUITE as bad, still terrible.
Keep a local variable me that refers to my node, and early on in creation make sure I find myself by calling findMe().
This relies on the way the name of a new node is generated.

local me  -- until I find out how to refer to my transform etc properly
function findMe =
(
if me != undefined then return "" -- in case called twice
me = $myClass01 -- find me, the new one will always be 01
me.name = uniqueName "myClass" -- so next new one is 01 as well
)

Once I have called findMe() I can use me.transform etc
0 Likes