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)
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))
Can't find what you're looking for? Ask the community or share your knowledge.