[Closed] How to verify hierarchy?
Hello everybody! Iam João from Brazil and I have a doubt about maxscript which unfortunately I am not able to solve.
I have an array with some objects. I want to hide objects in this array. But only on objects which are within the hierarchy of the current selected obj!
I’m not getting check if the object is in the hierarchy of the selected. I do not know if there is any keyword that helps me do this, or is there another way. I searched on Google, on MSHelp, but is hard to find some way.
I tryed to make a for loop: for i in selection do (selectmore i.children)
and then put all in array, and then deselect all, and then… and then… but dont works…
Thanks so much for attention!
João
Here’s a function to get you started. It checks if the provided node b is above node a in its hierarchy.
function isParentOf a b =
(
if (not (isValidNode a) OR not (isValidNode b) OR a == b) do
return false;
local p = a.parent;
local parentFound = false;
while (not parentFound AND isValidNode p) do
(
if (p == b) then
parentFound = true;
else
p = p.parent;
)
parentFound;
)
I hope this gives you some ideas on how to check the hierarchy of nodes.
Hi Pjanssen! Thanks a lot for your help! I copied your script and i will work based on it!
Cheers!
João