PDA

View Full Version : Two questions


d3coy
03-22-2007, 01:10 AM
Hi guys,

Just two quick questions,

1: Is there an elegant way to get the base object from within a scripted modifier? I'd like to be able to manipulate some properties of the baseobject from my modifier (namely vertex coloring toggle), but I don't want to use "$" for fear of the user "pinning" the stack, changing the currently selected object but leaving the modifier open. Using "$" also disallows maxscript access since any code in the modifier referencing "$" could be potentially anything (dangerous). I'm finding myself scope-blocked, as it were.

And 2: Is there any MXS access to the "pinned" state of the modifier panel? I can't find anything in the docs, and searching here yields nothing. I'm thinking there isn't any access, but just want to make sure.

I've coded around these problems for now, but its led to a bunch of convoluted if conditionals that I'd rather avoid... if only there was a this.node property :) or something similar. Thanks for any help you can give.

kees
03-22-2007, 02:25 AM
this.delegate

d3coy
03-22-2007, 02:40 PM
Hey kees,

this.delegate yields the modifier that the scripted modifier inherits, but not the underlying object that the modifier is applied to, unless I'm misusing it? There is also the attachedToNode event which yields the node the modifier is applied to, but its not possible to store this as a parameter as it would create a circular dependency. So I'm looking for a reference similar to "this," "delegate," etc that gives me the node, but maybe it doesn't exist.

PEN
03-22-2007, 03:26 PM
You can store it in the modifier but you will have to use a weak reference and store it in a maxObject and not as a node.

Have a look on my site here (http://paulneale.com/tutorials/Scripting/weakReferences/weakReferences.htm) for a tutorial that uses weak referencing.

d3coy
03-22-2007, 03:58 PM
ahhh excellent! thanks Paul

kees
03-22-2007, 04:47 PM
ok...I must understood.

You said 'base object'.
The INode (scene node) is not the base object.

-Kees

CGTalk Moderation
03-22-2007, 04:47 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.