Notifications
Clear all

[Closed] Getting attached node in scripted plugin

I have a little block in most of my scripted plugins that says:


 <plugin>
 local theNode
 
 on attachedToNode obj do
 (
 	 theNode = obj
 )
 
 <parameter block>
 <rollout>
 <end of plugin>
 

this lets us store the node that a scripted plugin is attached to inside the plugin itself. this is great, except for that attachedToNode doesn’t seem to get called until we select the object and go to the modify panel… and there are lots of times that this is not cool.

So does anyone have a craftier, more bulletproof way of storing this?

Thanks!

-b

2 Replies

Well, I used

refs.dependents this

and that seemed to do the trick. I dont think it can always give you the “exact” node if you have several instanced nodes, but in my case it’s alright.

Still, any other methods are welcome.

I have the same problem recently and I’ve resolved this way…

 plugin pitipun bla,bla,bla... 
(
	local thenode = undefined
	bla,bla,bla...
 
	on postcreate do thenode = execute (exprForMAXObject this explicitNames:true)
)

It seems to work fine till now.

(forgive my veeery bad english)