<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Selecting just the parent in 3ds Max Programming Forum</title>
    <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/selecting-just-the-parent/m-p/12781648#M1031</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;select $&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it doesn't make sense. $ in MaxScript means "current selection". It can be a single node or a collection of nodes.&lt;/P&gt;&lt;P&gt;... or it can &lt;EM&gt;undefined.&lt;/EM&gt;&amp;nbsp;So,&amp;nbsp;there is no point in making a selection in any of these three cases.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another question is how to get only the root objects from a given collection of nodes.&lt;/P&gt;&lt;P&gt;In this example, we will use $ in the sense of "multiple selection" when we want to leave only the roots of the collection selected:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;fn filterRoots nodes = 
(
	for node in nodes where node.parent == undefined or (finditem nodes node.parent == 0) collect node 
)

select (filterRoots ($ as array))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="denisTMaxDoctor_0-1716000760942.gif" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1364082i3CD6E206B9748892/image-size/medium?v=v2&amp;amp;px=400" role="button" title="denisTMaxDoctor_0-1716000760942.gif" alt="denisTMaxDoctor_0-1716000760942.gif" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 18 May 2024 02:52:46 GMT</pubDate>
    <dc:creator>denisT.MaxDoctor</dc:creator>
    <dc:date>2024-05-18T02:52:46Z</dc:date>
    <item>
      <title>Selecting just the parent</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/selecting-just-the-parent/m-p/12780014#M1030</link>
      <description>&lt;P&gt;select $&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&amp;nbsp;&lt;/P&gt;&lt;P&gt;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)&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2024 10:03:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/selecting-just-the-parent/m-p/12780014#M1030</guid>
      <dc:creator>M_J_ARSHAD</dc:creator>
      <dc:date>2024-05-17T10:03:28Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting just the parent</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/selecting-just-the-parent/m-p/12781648#M1031</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;select $&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it doesn't make sense. $ in MaxScript means "current selection". It can be a single node or a collection of nodes.&lt;/P&gt;&lt;P&gt;... or it can &lt;EM&gt;undefined.&lt;/EM&gt;&amp;nbsp;So,&amp;nbsp;there is no point in making a selection in any of these three cases.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another question is how to get only the root objects from a given collection of nodes.&lt;/P&gt;&lt;P&gt;In this example, we will use $ in the sense of "multiple selection" when we want to leave only the roots of the collection selected:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;fn filterRoots nodes = 
(
	for node in nodes where node.parent == undefined or (finditem nodes node.parent == 0) collect node 
)

select (filterRoots ($ as array))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="denisTMaxDoctor_0-1716000760942.gif" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1364082i3CD6E206B9748892/image-size/medium?v=v2&amp;amp;px=400" role="button" title="denisTMaxDoctor_0-1716000760942.gif" alt="denisTMaxDoctor_0-1716000760942.gif" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 18 May 2024 02:52:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/selecting-just-the-parent/m-p/12781648#M1031</guid>
      <dc:creator>denisT.MaxDoctor</dc:creator>
      <dc:date>2024-05-18T02:52:46Z</dc:date>
    </item>
  </channel>
</rss>

