ScriptSpot

Forum topic · General Scripting

Scripted Modifier - Get reference to object it is applied to?

By br0t · 2014-07-03

Description

How can I get a reference to the object my scripted modifier is applied to?

I know there is the


on attachedTo nodeVar do (...)

event handler, but when I try to store nodeVar as a #node parameter, it crashes with a DependencyLoop warning.

Any ideas?

Cheers

Comments (3)

br0t · 2014-07-04

Awesome that works, thanks! Still wondering why there is nothing like 'this' or 'delegate' that refers to the object the modifier is applied to and we have to do this kind of hack.

barigazy · 2014-07-04

I asked same question when I tryed to write my first scripted plugin but till this day I not know the answer :)

barigazy · 2014-07-03

Are you tried something like this

plugin someModifier name:"someModifier"
(
local theNode

parameters main rollout:params
(
-- ... parametersBlock
)

rollout params "Something"
(
-- ... rollout controls
)
on params open do theNode = (refs.dependentNodes this)[1]
)