<?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: Scripted Custom Attributes &amp;amp; DropDownLists in 3ds Max Programming Forum</title>
    <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/scripted-custom-attributes-amp-dropdownlists/m-p/4059051#M25176</link>
    <description>Thanx Randall and Dan.&lt;BR /&gt;That worked.</description>
    <pubDate>Fri, 06 Feb 2009 11:49:51 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2009-02-06T11:49:51Z</dc:date>
    <item>
      <title>Scripted Custom Attributes &amp; DropDownLists</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/scripted-custom-attributes-amp-dropdownlists/m-p/4059048#M25173</link>
      <description>Hi Everyone,&lt;BR /&gt;First of all, if anything I mention here sounds inefficient please feel free point it out...&lt;BR /&gt;&lt;BR /&gt;I'm working on a game and I need to pass information defined by the Art Team (in Max) out to our game engine.&lt;BR /&gt;So, I'm using &lt;FONT color="green"&gt;Scripted Custom Attributes&lt;/FONT&gt; as a holders for this new info (that way everything gets saved with their associated object.)&lt;BR /&gt;&lt;BR /&gt;The first test I did, was with a simple &lt;FONT color="red"&gt;checkbox&lt;/FONT&gt;. It worked just fine.&lt;BR /&gt;&lt;BR /&gt;Then, (because need to represent a list of predefined choices) I tried using a &lt;FONT color="red"&gt;dropdownlist&lt;/FONT&gt;.&lt;BR /&gt;Here is the script...&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;&lt;BR /&gt;-- ========================================&lt;BR /&gt;-- Define&lt;BR /&gt;-- ========================================&lt;BR /&gt;NewAttrs = attributes MyNewAttrs --attribID:#(0x9cf491c, 0x4c7a0cf0) --generated by genClassID()&lt;BR /&gt;    (&lt;BR /&gt;    parameters params rollout:MyAttrs_rollout&lt;BR /&gt;        (&lt;BR /&gt;        Item_Things type:#string ui:ddl_Things&lt;BR /&gt;        )&lt;BR /&gt;        &lt;BR /&gt;    rollout MyAttrs_rollout "My Attributes"&lt;BR /&gt;        (&lt;BR /&gt;        -- ----------------------------------------&lt;BR /&gt;        -- UI Controls&lt;BR /&gt;        -- ----------------------------------------&lt;BR /&gt;        dropdownlist ddl_Things "Pick Thing" \&lt;BR /&gt;                    items:#("First Thing", "Second Thing", "Third Thing")&lt;BR /&gt;        -- ----------------------------------------&lt;BR /&gt;        -- Event Handlers&lt;BR /&gt;        -- ----------------------------------------&lt;BR /&gt;        on ddl_Things selected ddl_ret do&lt;BR /&gt;            (&lt;BR /&gt;            Item_Things = ddl_Things.items&lt;BR /&gt;            format "Item_Things: %\n" Item_Things&lt;BR /&gt;            )&lt;BR /&gt;        )&lt;BR /&gt;    )&lt;BR /&gt;-- ========================================&lt;BR /&gt;-- Assign&lt;BR /&gt;-- ========================================&lt;BR /&gt;custAttributes.add $ NewAttrs&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;The problem is that the selection that I make in the dropdownlist get's lost as soon as I change selections.&lt;BR /&gt;However, if I select the object and execute the following in the Max Script Listener...&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;&lt;BR /&gt;$.Item_Things&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;The attribute that I defined is still correct, just not represented in the dropdownlist UI anymore.&lt;BR /&gt;&lt;BR /&gt;Am I missing something simple here?&lt;BR /&gt;Because, no other UI Control lost track of it's data.&lt;BR /&gt;&lt;BR /&gt;Thanx for any help you can provide.&lt;BR /&gt;-Red</description>
      <pubDate>Thu, 05 Feb 2009 08:24:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/scripted-custom-attributes-amp-dropdownlists/m-p/4059048#M25173</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-02-05T08:24:39Z</dc:date>
    </item>
    <item>
      <title>Re: Scripted Custom Attributes &amp; DropDownLists</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/scripted-custom-attributes-amp-dropdownlists/m-p/4059049#M25174</link>
      <description>Just thinking off the top of my head but could you drop some code into an on rollout open event to force it to be the right selection.</description>
      <pubDate>Thu, 05 Feb 2009 20:55:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/scripted-custom-attributes-amp-dropdownlists/m-p/4059049#M25174</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-02-05T20:55:45Z</dc:date>
    </item>
    <item>
      <title>Re: Scripted Custom Attributes &amp; DropDownLists</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/scripted-custom-attributes-amp-dropdownlists/m-p/4059050#M25175</link>
      <description>The problem I see immediately is that you are not storing your selection and since this UI is not persistant it doesnt remember anything.  When you switch back to it, it will re-evaluate everything that you have defined there but it will not set anything because you are not setting anything in your initial evaluation here.  What you need to do is add additional parameters and reference those when setting and updating your UI.&lt;BR /&gt;&lt;BR /&gt;So add the new parameter storing your selection here.&lt;BR /&gt;&lt;PRE&gt;&lt;BR /&gt; parameters params rollout:MyAttrs_rollout&lt;BR /&gt;        (&lt;BR /&gt;        Item_Things type:#string ui:ddl_Things&lt;BR /&gt;        // New parameter used to store your selection index&lt;BR /&gt;        DropDown_Selection type:#int &lt;BR /&gt;        )&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Now reference that when updating your selection.&lt;BR /&gt;&lt;PRE&gt;&lt;BR /&gt;        on ddl_Things selected ddl_ret do&lt;BR /&gt;         (&lt;BR /&gt;           Item_Things = ddl_Things.items&lt;BR /&gt;           format "Item_Things: %\n" Item_Things&lt;BR /&gt;           // Update the new Parameter&lt;BR /&gt;           DropDown_Selection = selected&lt;BR /&gt;          )&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Depending on how you want to access this value when you load the UI and selections you can call the following.&lt;BR /&gt;&lt;PRE&gt;&lt;BR /&gt;  on MyAttrs_rollout open do &lt;BR /&gt;(&lt;BR /&gt;   if (DropDown_Selection != undefined) then &lt;BR /&gt;    (&lt;BR /&gt;       ddl_Things.selection = DropDown_Selection&lt;BR /&gt;    )&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Feb 2009 01:35:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/scripted-custom-attributes-amp-dropdownlists/m-p/4059050#M25175</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-02-06T01:35:32Z</dc:date>
    </item>
    <item>
      <title>Re: Scripted Custom Attributes &amp; DropDownLists</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/scripted-custom-attributes-amp-dropdownlists/m-p/4059051#M25176</link>
      <description>Thanx Randall and Dan.&lt;BR /&gt;That worked.</description>
      <pubDate>Fri, 06 Feb 2009 11:49:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/scripted-custom-attributes-amp-dropdownlists/m-p/4059051#M25176</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-02-06T11:49:51Z</dc:date>
    </item>
  </channel>
</rss>

