<?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: Update Expression automatically when value changes in another attribute in Maya Programming Forum</title>
    <link>https://forums.autodesk.com/t5/maya-programming-forum/update-expression-automatically-when-value-changes-in-another/m-p/9039703#M7326</link>
    <description>&lt;P&gt;Expressions are different to scripts, and you usually try to avoid using things like getAttr and setAttr.&lt;/P&gt;&lt;P&gt;Instead, you access the attribute directly, and I think it will provide the behaviour you are looking for.&lt;/P&gt;&lt;P&gt;if torso_CTL.twist &amp;lt; -10 {&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;</description>
    <pubDate>Mon, 23 Sep 2019 01:12:42 GMT</pubDate>
    <dc:creator>lee.dunham</dc:creator>
    <dc:date>2019-09-23T01:12:42Z</dc:date>
    <item>
      <title>Update Expression automatically when value changes in another attribute</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/update-expression-automatically-when-value-changes-in-another/m-p/9035927#M7325</link>
      <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I'd like to do is control the translation limits for a control based on the &lt;EM&gt;twist&lt;/EM&gt; attribute of a second control. I've created an expression within the Expression Editor and it works once when I hit Edit. However, I want it to evaluate every time the&amp;nbsp;&lt;EM&gt;twist&amp;nbsp;&lt;/EM&gt;value changes. I'm pretty sure I've seen it done before but I'm drawing a blank on how to do it.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;float $twistValue = `getAttr("torso_CTL.twist")`;

if ($twistValue &amp;lt; -10) 
	transformLimits -tz 0 200 -etz 1 1 CTRL_throttleHandle;
else if ($twistValue &amp;gt;= -10 || $twistValue &amp;lt;= 10) 
	transformLimits -tz 50 250 -etz 1 1 CTRL_throttleHandle;
else 
	transformLimits -tz 100 300 -etz 1 1 CTRL_throttleHandle;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Sep 2019 19:43:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/update-expression-automatically-when-value-changes-in-another/m-p/9035927#M7325</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-09-19T19:43:59Z</dc:date>
    </item>
    <item>
      <title>Re: Update Expression automatically when value changes in another attribute</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/update-expression-automatically-when-value-changes-in-another/m-p/9039703#M7326</link>
      <description>&lt;P&gt;Expressions are different to scripts, and you usually try to avoid using things like getAttr and setAttr.&lt;/P&gt;&lt;P&gt;Instead, you access the attribute directly, and I think it will provide the behaviour you are looking for.&lt;/P&gt;&lt;P&gt;if torso_CTL.twist &amp;lt; -10 {&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2019 01:12:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/update-expression-automatically-when-value-changes-in-another/m-p/9039703#M7326</guid>
      <dc:creator>lee.dunham</dc:creator>
      <dc:date>2019-09-23T01:12:42Z</dc:date>
    </item>
    <item>
      <title>Re: Update Expression automatically when value changes in another attribute</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/update-expression-automatically-when-value-changes-in-another/m-p/9040356#M7327</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1273344"&gt;@lee.dunham&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Accessing the attribute directly does help with setting up the expression, but it still doesn't apply the changes automatically when I change the value of torso_CTL.twist. I thought perhaps there was a way to do this with expressions, but I'm starting to consider that there isn't.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2019 11:46:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/update-expression-automatically-when-value-changes-in-another/m-p/9040356#M7327</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-09-23T11:46:28Z</dc:date>
    </item>
    <item>
      <title>Re: Update Expression automatically when value changes in another attribute</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/update-expression-automatically-when-value-changes-in-another/m-p/9041967#M7328</link>
      <description>&lt;P&gt;I don't have access to Maya atm, but you could look at a scriptJob tied to attributeChanged instead?&lt;/P&gt;</description>
      <pubDate>Tue, 24 Sep 2019 02:01:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/update-expression-automatically-when-value-changes-in-another/m-p/9041967#M7328</guid>
      <dc:creator>lee.dunham</dc:creator>
      <dc:date>2019-09-24T02:01:12Z</dc:date>
    </item>
    <item>
      <title>Re: Update Expression automatically when value changes in another attribute</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/update-expression-automatically-when-value-changes-in-another/m-p/9057272#M7329</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1273344"&gt;@lee.dunham&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been on a big project with a looming deadline so I haven't had a chance to try your suggestion yet but I'll let you know how it goes when I do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2019 15:32:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/update-expression-automatically-when-value-changes-in-another/m-p/9057272#M7329</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-09-30T15:32:52Z</dc:date>
    </item>
    <item>
      <title>Re: Update Expression automatically when value changes in another attribute</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/update-expression-automatically-when-value-changes-in-another/m-p/9061319#M7330</link>
      <description>&lt;P&gt;If you want it to play nice with maya scene graph, implement the expression as nodes.&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.autodesk.com/cloudhelp/2018/ENU/Maya-Tech-Docs/Nodes/condition.html" target="_blank" rel="noopener"&gt;http://help.autodesk.com/cloudhelp/2018/ENU/Maya-Tech-Docs/Nodes/condition.html&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://help.autodesk.com/cloudhelp/2018/ENU/Maya-Tech-Docs/Nodes/clamp.html" target="_blank" rel="noopener"&gt;http://help.autodesk.com/cloudhelp/2018/ENU/Maya-Tech-Docs/Nodes/clamp.html&lt;/A&gt;&lt;BR /&gt;etc&lt;/P&gt;&lt;P&gt;Or even better, as a single DIY node.&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.autodesk.com/view/MAYAUL/2018/ENU/?guid=__files_GUID_4F1D2DC9_D544_432B_A103_7A32D47757C4_htm" target="_blank" rel="noopener"&gt;http://help.autodesk.com/view/MAYAUL/2018/ENU/?guid=__files_GUID_4F1D2DC9_D544_432B_A103_7A32D47757C4_htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;If you really hated nodes you can try using this to monitor upstream attribute changes yourself.&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.autodesk.com/cloudhelp/2018/ENU/Maya-SDK/cpp_ref/class_m_node_message.html#add4ee645b2cea6f0da5b872e8f011a6a" target="_blank" rel="noopener"&gt;http://help.autodesk.com/cloudhelp/2018/ENU/Maya-SDK/cpp_ref/class_m_node_message.html#add4ee645b2cea6f0da5b872e8f011a6a&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2019 02:20:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/update-expression-automatically-when-value-changes-in-another/m-p/9061319#M7330</guid>
      <dc:creator>olarn</dc:creator>
      <dc:date>2019-10-02T02:20:10Z</dc:date>
    </item>
    <item>
      <title>Re: Update Expression automatically when value changes in another attribute</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/update-expression-automatically-when-value-changes-in-another/m-p/9065156#M7331</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4947187"&gt;@olarn&lt;/a&gt;&amp;nbsp;I ended up just using the node editor to get the results that I wanted. Since I was dealing with 3 scenarios rather than a simple if / else situation, I had to get creative with the nodes.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Oct 2019 15:36:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/update-expression-automatically-when-value-changes-in-another/m-p/9065156#M7331</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-10-03T15:36:58Z</dc:date>
    </item>
    <item>
      <title>Re: Update Expression automatically when value changes in another attribute</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/update-expression-automatically-when-value-changes-in-another/m-p/9066290#M7332</link>
      <description>&lt;P&gt;Nice.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd like to interject for some more that implement as nodes has one more hidden benefits -- free parallelization.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2019 03:22:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/update-expression-automatically-when-value-changes-in-another/m-p/9066290#M7332</guid>
      <dc:creator>olarn</dc:creator>
      <dc:date>2019-10-04T03:22:06Z</dc:date>
    </item>
  </channel>
</rss>

