Selecting just the parent

Selecting just the parent

M_J_ARSHAD
Explorer Explorer
685 Views
1 Reply
Message 1 of 2

Selecting just the parent

M_J_ARSHAD
Explorer
Explorer

select $ 

selects the parent and the immediate children. How to just select the parent alone. Lets say Name1 is the parent. And the children contains Name1 and Name 2. When we do select $, it selects the Name1 parent and also the child Name1. 

But what if I want to select only the parent Name1 and not any of the child objects even one or more child objects have the same name (Name1 in this case)

0 Likes
686 Views
1 Reply
Reply (1)
Message 2 of 2

denisT.MaxDoctor
Advisor
Advisor

 

select $

 

it doesn't make sense. $ in MaxScript means "current selection". It can be a single node or a collection of nodes.

... or it can undefined. So, there is no point in making a selection in any of these three cases.

 

Another question is how to get only the root objects from a given collection of nodes.

In this example, we will use $ in the sense of "multiple selection" when we want to leave only the roots of the collection selected:

 

fn filterRoots nodes = 
(
	for node in nodes where node.parent == undefined or (finditem nodes node.parent == 0) collect node 
)

select (filterRoots ($ as array))

 

 

denisTMaxDoctor_0-1716000760942.gif

 

0 Likes