<?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: Uncle Max' Oddities in 3ds Max Programming Forum</title>
    <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/uncle-max-oddities/m-p/4216871#M19711</link>
    <description>Hello Steve,&lt;BR /&gt;&lt;BR /&gt;I was afraid to consume to much of your time with that question.&lt;BR /&gt;&lt;BR /&gt;I have tried out your solution. It works with "copy" instead of "maxops.clonenodes"&lt;BR /&gt;&lt;BR /&gt;Using "maxops.clonenodes" it denies "obedience" either. Though it was a good approach, the reason must lie deeper.&lt;BR /&gt;&lt;BR /&gt;Within the original context some functions, relating on the shape, follow. This seems to be the cause (in combination with the rollout scope).&lt;BR /&gt;&lt;BR /&gt;So I think it's a question for mother Autodesk.&lt;BR /&gt;&lt;BR /&gt;If I get a valuable answer, I'll let you know and post it here.&lt;BR /&gt;&lt;BR /&gt;Kind regards&lt;BR /&gt;Arnim</description>
    <pubDate>Thu, 18 Aug 2011 17:21:43 GMT</pubDate>
    <dc:creator>info</dc:creator>
    <dc:date>2011-08-18T17:21:43Z</dc:date>
    <item>
      <title>Uncle Max' Oddities</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/uncle-max-oddities/m-p/4216866#M19706</link>
      <description>Hello Community,&lt;BR /&gt;&lt;BR /&gt;I have found an odd effect in Maxscript:&lt;BR /&gt;&lt;BR /&gt;I have scripted a simple function that re-sets the first vertex of a closed shape to the middle of the spline.&lt;BR /&gt;&lt;BR /&gt;If the function is called outside of a rollout it works very well.&lt;BR /&gt;&lt;BR /&gt;But if it is &lt;B&gt;called inside of rollout&lt;/B&gt; by an event handler (on test_button pressed do...) the function is not executed anymore.&lt;BR /&gt;&lt;BR /&gt;For having a look at this phenomenon please do the following:&lt;BR /&gt;&lt;BR /&gt;Create a closed spline. If you want to, you can mark the beginning with a point-helper with a pathconstraint as position controller.&lt;BR /&gt;&lt;BR /&gt;Select the closed spline.&lt;BR /&gt;&lt;BR /&gt;Then start the core-function, to see that function itselve works:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;clearspline = $&lt;BR /&gt;&lt;BR /&gt; function set_start_fn clearspline_var: =&lt;BR /&gt; &lt;BR /&gt;(&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; max modify mode&lt;BR /&gt; select clearspline_var&lt;BR /&gt; subObjectLevel = 1&lt;BR /&gt; &lt;BR /&gt; --if set_start_at == undefined then set_start_at = 1&lt;BR /&gt; &lt;BR /&gt; set_start_at = (numknots clearspline_var) / 2 as integer&lt;BR /&gt; &lt;BR /&gt; setknotselection clearspline_var 1 #(set_start_at)&lt;BR /&gt; -- clearspline_var.makefirst 1 53&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; splineOps.makeFirst clearspline_var&lt;BR /&gt; updateshape clearspline_var&lt;BR /&gt; &lt;BR /&gt; subObjectLevel = 0&lt;BR /&gt; &lt;BR /&gt; updateshape clearspline_var&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;) --  function set_start_fn clearspline_var: = &lt;BR /&gt; &lt;BR /&gt;set_start_fn clearspline_var: clearspline&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Now you probably see that the start point jumps each time the function is called.&lt;BR /&gt;&lt;BR /&gt;So far so good.&lt;BR /&gt;&lt;BR /&gt;Now, please start the bound-in-function:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;&lt;BR /&gt;&lt;BR /&gt;clearspline = $&lt;BR /&gt;&lt;BR /&gt; function set_start_fn clearspline_var: =&lt;BR /&gt; &lt;BR /&gt;(&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; max modify mode&lt;BR /&gt; select clearspline_var&lt;BR /&gt; subObjectLevel = 1&lt;BR /&gt; &lt;BR /&gt; --if set_start_at == undefined then set_start_at = 1&lt;BR /&gt; &lt;BR /&gt; set_start_at = (numknots clearspline_var) / 2 as integer&lt;BR /&gt; &lt;BR /&gt; setknotselection clearspline_var 1 #(set_start_at)&lt;BR /&gt; -- clearspline_var.makefirst 1 53&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; splineOps.makeFirst clearspline_var&lt;BR /&gt; updateshape clearspline_var&lt;BR /&gt; &lt;BR /&gt; subObjectLevel = 0&lt;BR /&gt; &lt;BR /&gt; updateshape clearspline_var&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;) --  function set_start_fn clearspline_var: = &lt;BR /&gt;&lt;BR /&gt;rollout test_roll "Test"&lt;BR /&gt; &lt;BR /&gt;(&lt;BR /&gt; &lt;BR /&gt;button test_but "Move First-Point"&lt;BR /&gt;&lt;BR /&gt; on test_but pressed do&lt;BR /&gt; &lt;BR /&gt; (&lt;BR /&gt; &lt;BR /&gt; clearspline = $&lt;BR /&gt; max create mode&lt;BR /&gt;&lt;BR /&gt; set_start_fn clearspline_var: clearspline&lt;BR /&gt;&lt;BR /&gt; updateshape clearspline&lt;BR /&gt;&lt;BR /&gt; --/*&lt;BR /&gt;&lt;BR /&gt;maxops.clonenodes $ newnodes: &amp;amp;copynode&lt;BR /&gt;&lt;BR /&gt;copynode .name = "Copy-Spline EX"&lt;BR /&gt;&lt;BR /&gt;in coordsys world move copynode  &lt;BR /&gt;-- */&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt; ) --  on toll_but pressed do&lt;BR /&gt; &lt;BR /&gt;) -- rollout toll_roll "Test"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;createdialog test_roll&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/*&lt;BR /&gt;&lt;BR /&gt;maxops.clonenodes $ newnodes: &amp;amp;copynode&lt;BR /&gt;&lt;BR /&gt;copynode .name = "Copy-Spline EX"&lt;BR /&gt;&lt;BR /&gt;in coordsys world move copynode  &lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;segment_laengen = getseglengths clearspline 1 cum: false byVertex:false&lt;BR /&gt;print segment_laengen&lt;BR /&gt;&lt;BR /&gt;*/&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Run the script and press the button ("Move First-Point"). You probably see the spline to be copied (which is intended). But you do not see the start-point moved.&lt;BR /&gt;&lt;BR /&gt;I have implemented the copy-function, to see the phenomenon. There must be done something with the spline after the reset of the startpoint. When you comment-out the copy-code it works as intended.&lt;BR /&gt;&lt;BR /&gt;The conclusion: The combination of a scope within a rollout-event (button pressed) and something done to the spline after the reset-first-point-function causes max to ignore splineops.makefirst within the function call.&lt;BR /&gt;&lt;BR /&gt;Does anybody have a clue, why this occurs? Does anybody have a solution or a workaround? I am working on this for days to find a solution...&lt;BR /&gt;&lt;BR /&gt;Kind regards&lt;BR /&gt;Arnim</description>
      <pubDate>Tue, 16 Aug 2011 09:43:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/uncle-max-oddities/m-p/4216866#M19706</guid>
      <dc:creator>info</dc:creator>
      <dc:date>2011-08-16T09:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: Uncle Max' Oddities</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/uncle-max-oddities/m-p/4216867#M19707</link>
      <description>It's strange, isn't it?&lt;BR /&gt;&lt;BR /&gt;But does nobody has an idea why this happens? Does no-one know how to work around this effect?&lt;BR /&gt;&lt;BR /&gt;Kind regards&lt;BR /&gt;Arnim</description>
      <pubDate>Thu, 18 Aug 2011 08:28:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/uncle-max-oddities/m-p/4216867#M19707</guid>
      <dc:creator>info</dc:creator>
      <dc:date>2011-08-18T08:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: Uncle Max' Oddities</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/uncle-max-oddities/m-p/4216868#M19708</link>
      <description>Yes. Very.&lt;BR /&gt;&lt;BR /&gt;The following code works, but...&lt;BR /&gt;If you implement a copy of the object (uncomment the 2 copy lines) then the copy of the object is not identical to the currently selected object. The correct knot is selected, but the 1st vertex is always the previous one, which is really strange.&lt;BR /&gt;If you comment the "subObjectLevel = 0" line then you can see the 1st vertex moving.&lt;BR /&gt;&lt;BR /&gt;Slightly OT - why are you using named parameters, especially with a name like "clearspline_var" in a function call which is entirely internal to a rollout? There's only one parameter, so a normal "by position" parameter is all that is needed. Named parameters would normally only be needed in a situation where the parameter name is relevent, as in "s = sphere radius:10 pos:" (radius and pos being named parameters).&lt;BR /&gt;&lt;BR /&gt;Also, you never seem to enclose your code in parentheses - that means that in your above code you are creating a global variable called clearspline_var which is not good practice. Always start with an empty pair of parenteses and put the entire script in between them. There are exceptions such as when defining a Macroscript, but they are the exception rather than the rule (a Macroscript HAS to be globally defined or it could not be tied to a shortcut or toolbar button).&lt;BR /&gt;&lt;PRE&gt;&lt;BR /&gt;(&lt;BR /&gt;rollout test_roll "Test"&lt;BR /&gt;   (&lt;BR /&gt;   button test_but "Move First-Point"&lt;BR /&gt;&lt;BR /&gt;   function set_start_fn clearspline_var =&lt;BR /&gt;      (&lt;BR /&gt;      max modify mode&lt;BR /&gt;      subObjectLevel = 1&lt;BR /&gt;      set_start_at = ((numknots clearspline_var) / 2) as integer&lt;BR /&gt;      setknotselection clearspline_var 1 #(set_start_at)&lt;BR /&gt;      splineOps.makeFirst clearspline_var&lt;BR /&gt;      updateshape clearspline_var&lt;BR /&gt;      subObjectLevel = 0&lt;BR /&gt;      ) &lt;BR /&gt;&lt;BR /&gt;   on test_but pressed do&lt;BR /&gt;      (&lt;BR /&gt;      set_start_fn $&lt;BR /&gt;--      a = copy $&lt;BR /&gt;--      a.pos = &lt;BR /&gt;      )&lt;BR /&gt;   )&lt;BR /&gt;&lt;BR /&gt;try DestroyDialog test_roll catch()&lt;BR /&gt;createdialog test_roll&lt;BR /&gt;)&lt;BR /&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 Aug 2011 10:39:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/uncle-max-oddities/m-p/4216868#M19708</guid>
      <dc:creator>Steve_Curley</dc:creator>
      <dc:date>2011-08-18T10:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: Uncle Max' Oddities</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/uncle-max-oddities/m-p/4216869#M19709</link>
      <description>Hello Steve,&lt;BR /&gt;&lt;BR /&gt;thank you very much for your reply. As always, I learn a lot from your hints. What you said about the parentheses was absolutely new to me. &lt;BR /&gt;&lt;BR /&gt;The script only was made up to demonstrate the phenomenon. The function, that doesn't work, is embedded in a larger complex. &lt;BR /&gt;&lt;BR /&gt;The phenomenon occurs always when other functions follow and relate to the shape.&lt;BR /&gt;&lt;BR /&gt;So the solution works in this special case. But I need to explore the phenomenon even deeper.&lt;BR /&gt;&lt;BR /&gt;So I will show it to my resseller, who will contact Autodesk directly. Let's see what they can tell me.&lt;BR /&gt;&lt;BR /&gt;But anyway, your answere helped me a lot.&lt;BR /&gt;&lt;BR /&gt;Kind regards&lt;BR /&gt;Arnim</description>
      <pubDate>Thu, 18 Aug 2011 12:58:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/uncle-max-oddities/m-p/4216869#M19709</guid>
      <dc:creator>info</dc:creator>
      <dc:date>2011-08-18T12:58:31Z</dc:date>
    </item>
    <item>
      <title>Re: Uncle Max' Oddities</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/uncle-max-oddities/m-p/4216870#M19710</link>
      <description>You're welcome.&lt;BR /&gt;&lt;BR /&gt;I understand what you're saying about it being part of a larger script, but as presented here it is  a stand-alone fully (well, almost) functional script. Remember that anyone copy/pasting the script to test it will be creating globals - which might conflict with (valid) existing globals in their environment.&lt;BR /&gt;&lt;BR /&gt;It will be interesting to know just what AD say about it - it is certainly rather odd behaviour.</description>
      <pubDate>Thu, 18 Aug 2011 14:03:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/uncle-max-oddities/m-p/4216870#M19710</guid>
      <dc:creator>Steve_Curley</dc:creator>
      <dc:date>2011-08-18T14:03:22Z</dc:date>
    </item>
    <item>
      <title>Re: Uncle Max' Oddities</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/uncle-max-oddities/m-p/4216871#M19711</link>
      <description>Hello Steve,&lt;BR /&gt;&lt;BR /&gt;I was afraid to consume to much of your time with that question.&lt;BR /&gt;&lt;BR /&gt;I have tried out your solution. It works with "copy" instead of "maxops.clonenodes"&lt;BR /&gt;&lt;BR /&gt;Using "maxops.clonenodes" it denies "obedience" either. Though it was a good approach, the reason must lie deeper.&lt;BR /&gt;&lt;BR /&gt;Within the original context some functions, relating on the shape, follow. This seems to be the cause (in combination with the rollout scope).&lt;BR /&gt;&lt;BR /&gt;So I think it's a question for mother Autodesk.&lt;BR /&gt;&lt;BR /&gt;If I get a valuable answer, I'll let you know and post it here.&lt;BR /&gt;&lt;BR /&gt;Kind regards&lt;BR /&gt;Arnim</description>
      <pubDate>Thu, 18 Aug 2011 17:21:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/uncle-max-oddities/m-p/4216871#M19711</guid>
      <dc:creator>info</dc:creator>
      <dc:date>2011-08-18T17:21:43Z</dc:date>
    </item>
    <item>
      <title>Re: Uncle Max' Oddities</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/uncle-max-oddities/m-p/4216872#M19712</link>
      <description>Hello Steve, hello community,&lt;BR /&gt;&lt;BR /&gt;it was a long and winding road, but here is the solution:&lt;BR /&gt;&lt;BR /&gt;setfirstknot &amp;lt;spline&amp;gt; &amp;lt;spline index&amp;gt; &amp;lt;knot index&amp;gt;&lt;BR /&gt;&lt;BR /&gt;Thanks to the support of Autodesk. The support needed three attempts for this answer (it was a tricky problem &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; )&lt;BR /&gt;&lt;BR /&gt;You have no chance to find this function in the manual, if you do not know it excists. A proposal to Autodesk: Please invest more time into your software documentation. The Max Script Manual still has a lot space to improve.&lt;BR /&gt;&lt;BR /&gt;Kind regards&lt;BR /&gt;Arnim</description>
      <pubDate>Wed, 07 Sep 2011 08:49:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/uncle-max-oddities/m-p/4216872#M19712</guid>
      <dc:creator>info</dc:creator>
      <dc:date>2011-09-07T08:49:02Z</dc:date>
    </item>
    <item>
      <title>Re: Uncle Max' Oddities</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/uncle-max-oddities/m-p/4216873#M19713</link>
      <description>Glad you found a solution, and thanks for posting it.</description>
      <pubDate>Wed, 07 Sep 2011 10:39:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/uncle-max-oddities/m-p/4216873#M19713</guid>
      <dc:creator>Steve_Curley</dc:creator>
      <dc:date>2011-09-07T10:39:15Z</dc:date>
    </item>
  </channel>
</rss>

