Notifications
Clear all

[Closed] Access to Modifier's object

Hi everyone,
i would have a question connected to the custom modifier and access to the node that the modifier is being used on.

if I use #node it screems with the dependecy loop
if I use #maxObject it does not asign the object but just the Sphere in this case

plugin modifier test
name:"test"
classID:#(125317,117629) (
	local params

	parameters main (
		obj type:#maxObject --#node
	)

	on attachedToNode theNode do (
		this.obj = theNode
		print "***"
		print theNode
		print this.obj -- WUT? 
		print "***"
	)
)

try(delete (GetNodeByName "mysphere"))catch()
addModifier (a = sphere name:"mysphere" radius:10) (test())
select a

eventually, is there any other way how to access modifiers object without having it saved inside? I would really like to not go trough all modifiers in the scene and search for it.

Thanks
TM

1 Reply

ok, I just found the answer to this :applause:. I will not delete the post, at last it might be helpful for someone in the future.

--for getting the modifiers object directly
refs.dependentnodes $.test

--or assign trough the weak referencing inside of modifier, which is probably useless when having the refs.dependentnodes stuff
this.obj = nodeTransformMonitor node:theNode forwardTransformChangeMsgs:true

TM