[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?
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.
You can retrieve the node that this plugin is attached to:
(refs.dependentnodes this)[1]
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.
Sorry I forgot to mention it this time again. I am even using max 9, which was befor max 2008.
use this:
ThisNode = undefined
for o in refs.dependents this while ThisNode == undefined where isvalidnode o do ThisNode = o
So the code from MZ with some small changes worcked:
nodes=for o in refs.dependents this where isvalidnode o collect o