Notifications
Clear all

[Closed] modfiers parent

Hi all,

I have added a maxscript-plugin to a Physical Camera in 3dsmax. How can I find the object (the camera) under this modifier, i.e. basically the parent object.
I hope you understand.

6 Replies
1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

the really sure way to say that some modifier applied to a specified node is to check all node’s modifier and see if any of them is what we test…


fn doesNodeHasModifier node modi = 
(
   has = off
   for m in node.modifiers while not has do has = (m == modi)  
   has
)

but we can minimize the list of nodes in the scene searching into only nodes those dependent to the modiifier


nodes = refs.dependentnodes modi
nodes_with_this_modifier = for node in nodes where (doesNodeHasModifier node modi) collect node

Hi DenisT,

thank you very much for your answere. my problem is the modifer himself needs to know which camera he’s sitting on. With “this” I can access the modifier itself, I would have to go one step deeper in the modifier stack to access the root object? Is that possible and if so, how?

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

if it’s your custom modifier you know the way how a node, which this modifier applied to, is dependent.
so you can use:


fn getNode = (refs.dependentnodes this)[1]

but it’s correct only in case when the modifier is applied to only one node

Hi denisT,

It looks good, it works!

thank you very much!

Hi denisT,

It doesn’t work properly, sometimes the script doesn’t find the object. If I assign the modifier (on attachedToNode nodevar do) I get the object. On load, I used your function, but sometimes it’s empty. Is there another way for the script to determine on which object it is sitting, or what I’m doing wrong?