Community
3ds Max Programming
Welcome to Autodesk’s 3ds Max Forums. Share your knowledge, ask questions, and explore popular 3ds Max SDK, Maxscript and Python topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Selecting just the parent

1 REPLY 1
Reply
Message 1 of 2
M_J_ARSHAD
341 Views, 1 Reply

Selecting just the parent

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)

Labels (3)
1 REPLY 1
Message 2 of 2

 

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

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report