<?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 MEL basics - please help in Maya Programming Forum</title>
    <link>https://forums.autodesk.com/t5/maya-programming-forum/mel-basics-please-help/m-p/10726112#M3398</link>
    <description>&lt;P&gt;Hello, I'm a fairly young 3D artist with no experience with coding/scripting, I'm currently working on experiences for AR (scenes exported form maya as glb) and some functions like MotionPath Flow or extruding curves do not export, so I found a way to get similar effects with the animation by rigging meshes and attaching locators to the curve. Unfortunately it's a very long and time consuming process especially with things like ribbons or growing vines, so I wanted to create a command in MEL that would do it all for me (assign motionpath to selected curve and locator, break the u value connection of the motionpath, assign new expression to it that is dependable on 2 attributes of the curve). So the MEL command is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;pathAnimation -fractionMode true -follow true -followAxis x -upAxis y -worldUpType "vector" -worldUpVector 0 1 0 -inverseUp false -inverseFront false -bank false -startTimeU 45 -endTimeU 58;&lt;BR /&gt;disconnectAttr motionPathX_uValue.output motionPathX.uValue;&lt;BR /&gt;expressionEditor EE "motionPath" "uValue";&lt;BR /&gt;expression -s "motionPathX.uValue = curve1.Pos - curve1.Gap*X-1" -o motionPath -ae 1 -uc all ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so if instead of X i fill in the numbers myself the command works - of course since i copy-pasted from script editor, but manually inserting the number of the next motionpath to be created doesn't save me any time at all, so my question is to anyone with a basic understanding of MEL that would be kind enough to answer:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How am i supposed to phrase the commend so that the next motionpath automatically generates it's number "x" and then uses this number in all the other lines of the command and uses this number minus&amp;nbsp; 1 "x-1" in the line "- curve1.Gap*x-1;"?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Anita&lt;/P&gt;</description>
    <pubDate>Sun, 31 Oct 2021 19:26:22 GMT</pubDate>
    <dc:creator>anita.wiatr</dc:creator>
    <dc:date>2021-10-31T19:26:22Z</dc:date>
    <item>
      <title>MEL basics - please help</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/mel-basics-please-help/m-p/10726112#M3398</link>
      <description>&lt;P&gt;Hello, I'm a fairly young 3D artist with no experience with coding/scripting, I'm currently working on experiences for AR (scenes exported form maya as glb) and some functions like MotionPath Flow or extruding curves do not export, so I found a way to get similar effects with the animation by rigging meshes and attaching locators to the curve. Unfortunately it's a very long and time consuming process especially with things like ribbons or growing vines, so I wanted to create a command in MEL that would do it all for me (assign motionpath to selected curve and locator, break the u value connection of the motionpath, assign new expression to it that is dependable on 2 attributes of the curve). So the MEL command is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;pathAnimation -fractionMode true -follow true -followAxis x -upAxis y -worldUpType "vector" -worldUpVector 0 1 0 -inverseUp false -inverseFront false -bank false -startTimeU 45 -endTimeU 58;&lt;BR /&gt;disconnectAttr motionPathX_uValue.output motionPathX.uValue;&lt;BR /&gt;expressionEditor EE "motionPath" "uValue";&lt;BR /&gt;expression -s "motionPathX.uValue = curve1.Pos - curve1.Gap*X-1" -o motionPath -ae 1 -uc all ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so if instead of X i fill in the numbers myself the command works - of course since i copy-pasted from script editor, but manually inserting the number of the next motionpath to be created doesn't save me any time at all, so my question is to anyone with a basic understanding of MEL that would be kind enough to answer:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How am i supposed to phrase the commend so that the next motionpath automatically generates it's number "x" and then uses this number in all the other lines of the command and uses this number minus&amp;nbsp; 1 "x-1" in the line "- curve1.Gap*x-1;"?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Anita&lt;/P&gt;</description>
      <pubDate>Sun, 31 Oct 2021 19:26:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/mel-basics-please-help/m-p/10726112#M3398</guid>
      <dc:creator>anita.wiatr</dc:creator>
      <dc:date>2021-10-31T19:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: MEL basics - please help</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/mel-basics-please-help/m-p/10726507#M3399</link>
      <description>&lt;P&gt;There are several ways to cycle the x, one of those is&amp;nbsp; &lt;EM&gt;for&lt;/EM&gt; cycle.&amp;nbsp; Taking as an example from your code, the line will look something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;for ( $x=0; $x&amp;lt;=10; $x++ ) {  // iterate x from 0 to 10 with step 1
    ...
    expressionEditor EE ( "motionPath" + $x ) "uValue" ; // commands withing brackets are executed before the line itself
    ...
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 31 Oct 2021 19:24:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/mel-basics-please-help/m-p/10726507#M3399</guid>
      <dc:creator>hamsterHamster</dc:creator>
      <dc:date>2021-10-31T19:24:57Z</dc:date>
    </item>
    <item>
      <title>Re: MEL basics - please help</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/mel-basics-please-help/m-p/10726592#M3400</link>
      <description>&lt;P&gt;Thank you so much for the reply and your help!&lt;/P&gt;&lt;P&gt;I tried changing the command as the example you've given but I must be doing something wrong as i'm only getting an error message of "Invalid use of Maya object "motionPath"."&lt;/P&gt;&lt;P&gt;I wrote it like this :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;pathAnimation -fractionMode true -follow true -followAxis x -upAxis y -worldUpType "vector" -worldUpVector 0 1 0 -inverseUp false -inverseFront false -bank false -startTimeU 45 -endTimeU 58;&lt;BR /&gt;for ( $x=0; $x&amp;lt;=10; $x++ ) {&lt;BR /&gt;disconnectAttr (motionPath + $x)_uValue.output (motionPath + $x).uValue;&lt;BR /&gt;}&lt;BR /&gt;expressionEditor EE "motionPath" "uValue";&lt;BR /&gt;for ( $x=0; $x&amp;lt;=10; $x++ ) {&lt;BR /&gt;expression -s "(motionPath + $x).uValue = curve1.Pos - curve1.Gap*($x-1)" -o motionPath -ae 1 -uc all ;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What am I doing wrong?&lt;/P&gt;</description>
      <pubDate>Sun, 31 Oct 2021 20:35:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/mel-basics-please-help/m-p/10726592#M3400</guid>
      <dc:creator>anita.wiatr</dc:creator>
      <dc:date>2021-10-31T20:35:58Z</dc:date>
    </item>
    <item>
      <title>Re: MEL basics - please help</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/mel-basics-please-help/m-p/10727275#M3401</link>
      <description>&lt;P&gt;Setting aside that I am not getting into what are you trying to achieve, the syntax itself is wrong, as you are skipping quotes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;...
disconnectAttr ("motionPath"+ $x +"_uValue.output") ("motionPath"+ $x +".uValue") ;
...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;.. thou, I am not sure about that underscore; if that line is causing an error, then find what is precise name of the attribute you are trying to disconnect.&lt;/P&gt;&lt;P&gt;Similarly:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;...
expression -s ("motionPath"+ $x +".uValue = curve1.Pos - curve1.Gap*("+ $x +"-1)") -o motionPath -ae 1 -uc all ;
...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I believe, you don't need two cycles: the disconnection and expression creation can be done immediately one after another, within one &lt;EM&gt;for&lt;/EM&gt; cycle.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If unsure about the brackets and quotes, use &lt;EM&gt;print&lt;/EM&gt; command to ensure the resulting string will be correct:&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;$x = 1 ;
print("motionPath"+ $x +".uValue = curve1.Pos - curve1.Gap*("+ $x +"-1)") ;&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 01 Nov 2021 08:07:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/mel-basics-please-help/m-p/10727275#M3401</guid>
      <dc:creator>hamsterHamster</dc:creator>
      <dc:date>2021-11-01T08:07:25Z</dc:date>
    </item>
    <item>
      <title>Re: MEL basics - please help</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/mel-basics-please-help/m-p/10727451#M3402</link>
      <description>&lt;P&gt;Thank you so much!&lt;/P&gt;&lt;P&gt;I realize I'm lacking the very basic understanding of MEL language and that's why I'm struggling so much with it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for correcting me, it does work now! The only thing is that each time I click on it with another locator selected it generates exactly the same (lowest) x for all the lines so even though motionpath generated gets the next available number all the other lines still turn out as "motionPath0.uValue" so they come out as error, but i can just change lowest x myself manually each time for the next available number of motionpath to be generated and that works so it's already saving me so much time!&lt;/P&gt;&lt;P&gt;Thank you once again!&lt;/P&gt;</description>
      <pubDate>Mon, 01 Nov 2021 09:51:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/mel-basics-please-help/m-p/10727451#M3402</guid>
      <dc:creator>anita.wiatr</dc:creator>
      <dc:date>2021-11-01T09:51:31Z</dc:date>
    </item>
    <item>
      <title>Re: MEL basics - please help</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/mel-basics-please-help/m-p/10727486#M3403</link>
      <description>&lt;P&gt;That's ok - everyone was beginner at some point, I consider myself too. &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt; &lt;A href="https://knowledge.autodesk.com/support/maya/learn-explore/caas/CloudHelp/cloudhelp/2020/ENU/Maya-Scripting/files/GUID-E206E618-2307-45E6-A383-7D561234285A-htm.html" target="_blank" rel="noopener"&gt;Here&lt;/A&gt;, read more about &lt;EM&gt;for&lt;/EM&gt; cycle in Maya Help articles. And, my pardons, the numbers in &lt;EM&gt;for&lt;/EM&gt; brackets were set JUST as an example, for you to change according the need.. I thought you will notice the comments after //.&lt;/P&gt;&lt;P&gt;Best wishes in your use of Mel/Python&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Nov 2021 10:18:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/mel-basics-please-help/m-p/10727486#M3403</guid>
      <dc:creator>hamsterHamster</dc:creator>
      <dc:date>2021-11-01T10:18:18Z</dc:date>
    </item>
    <item>
      <title>Re: MEL basics - please help</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/mel-basics-please-help/m-p/10727534#M3404</link>
      <description>&lt;P&gt;Yes, I did notice the comments after, I tried to adjust it to my scene so x was supposed to be between 52 and 103 so i swapped 0 for 52 and 10 for 103, but each time I ran the command x came out as 52&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&amp;nbsp;but i'm assuming it's just my complete lack of understanding how cycles are supposed to work, so I'm really grateful for the linked article, I'll study the cycles and hopefully figure it out! I've been using maya without using commands at all, but now that I've discovered how much time it can save me especially with repetitive tasks, I definitely want to learn more about it!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Nov 2021 10:48:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/mel-basics-please-help/m-p/10727534#M3404</guid>
      <dc:creator>anita.wiatr</dc:creator>
      <dc:date>2021-11-01T10:48:50Z</dc:date>
    </item>
  </channel>
</rss>

