Notifications
Clear all

[Closed] How to get self node in a scripted object?

I have a scripted plugin helper in maxscript and need to get the node that is the object. How can I archieve it inside the scripted plugin?

12 Replies
1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

if you want to get the correct answer on your question please ask the question clear …
show the “header” of your plugin, specify the moment when you want to know about which node uses this plugin…

Klvnk
attachtoNode doesn’t work for object plugins

use the on attachToNode event

local thisnode = undefined;

on attachtoNode n do  thisnode = n;
on detachedFromNode n do thisnode  = undefined;

then when ever you want to use it

if thisnode != undefined then ...

It´s more or les still about that modifier helper example, I would like to rotate the trimesh in the local coordsys of the node. At the moment I am only able to rotate the trimesh in world coordsys and even using “in coordsys local” doesn´t worck. I was thinking to use “in coordsys theNode” where theNode is my node.

 MZ1

You can retrieve the node that this plugin is attached to:
(refs.dependentnodes this)[1]

OK thanks, I try it.

1 Reply
(@gtafan)
Joined: 11 months ago

Posts: 0

Geting this error mesage:

It first appeared in

What was New in MAXScript in 3ds Max 2008

ps. All of your threads should probably mention right in the first post that you need a working solution for a pretty ancient max version. Otherwise most of the answers may be useless for you and pure waste of time for those who answer them.

1 Reply
(@gtafan)
Joined: 11 months ago

Posts: 0

Sorry I forgot to mention it this time again. I am even using max 9, which was befor max 2008.

 MZ1

Nice point, Thank You!
I never thought someone still uses Max 2008.

 MZ1

use this:

ThisNode = undefined
for o in refs.dependents this while ThisNode == undefined where isvalidnode o do ThisNode = o

Will it worck with older max versions? At least version 9.

So the code from MZ with some small changes worcked:

nodes=for o in refs.dependents this where isvalidnode o collect o