{"id":215,"date":"2008-09-05T07:07:39","date_gmt":"2008-09-05T14:07:39","guid":{"rendered":"http:\/\/www.rodgreen.com\/?page_id=215"},"modified":"2008-09-05T07:07:39","modified_gmt":"2008-09-05T14:07:39","slug":"how-do-i-key-an-attribute-thats-constrained","status":"publish","type":"page","link":"https:\/\/www.rodgreen.com\/?page_id=215","title":{"rendered":"How do I key an attribute that&#8217;s constrained?"},"content":{"rendered":"<p>This solution only realy applies to &#8216;constrained&#8217; attributes and not expression or other forms of driven control.<\/p>\n<p><a target=\"_blank\" href=\"https:\/\/www.rodgreen.com\/scripts\/mel\/keyConsAttrib.mel\">[Download]<\/a><\/p>\n<p>&nbsp;<\/p>\n<pre style=\"margin-left: 40px; \">\nproc keyConsAttrib(string $inputObjs[], string $attributes[], float $startTime, float $endTime, float $inc)\n{\n\tfloat $curTime = currentTime(&quot;-q&quot;);\n\n\tfor($eachObj in $inputObjs)\n\t{\n\t\tcurrentTime($startTime);\n\n\t\tfor($eachAttr in $attributes)\n\t\t{\n\t\t\tstring $fullAttr = ($eachObj + &quot;.&quot; + $eachAttr);\n\t\t\tstring $listConnResult[] = listConnections(&quot;-s&quot;, 1, $fullAttr);\n\t\t\tif(nodeType($listConnResult[0]) != &quot;pairBlend&quot;)\n\t\t\t{\n\t\t\t\t\n\t\t\t\tsetKeyframe($fullAttr);\n\t\t\t\t$listConnResult = listConnections(&quot;-s&quot;, 1, $fullAttr);\n\t\t\t}\n\n\t\t\tstring $pairBlend = $listConnResult[0];\n\n\t\t\t$listConnResult = listConnections(&quot;-s&quot;, 1, &quot;-p&quot;, 1, ($pairBlend + &quot;.weight&quot;));\n\t\t\tstring $weightSource = $listConnResult[0];\n\n\t\t\tsetAttr($weightSource, 1);\n\n\n\t\t}\n\t}\n\tcurrentTime($curTime);\n\n\tfor($curTime = $startTime; $curTime &lt;= $endTime; $curTime += $inc)\n\t{\n\n\t\tfor($eachObj in $inputObjs)\n\t\t{\n\t\t\tfor($eachAttr in $attributes)\n\t\t\t{\n\t\t\t\tstring $fullAttr = ($eachObj + &quot;.&quot; + $eachAttr);\n\t\t\t\tfloat $value = getAttr(&quot;-time&quot;, $curTime, $fullAttr);\n\t\t\t\tsetKeyframe -time $curTime -value $value $fullAttr;\n\t\t\t}\n\t\t}\n\t}\n\n}\n<br type=\"_moz\" \/><\/pre>\n<p>Usage:<\/p>\n<p>&nbsp;<\/p>\n<pre style=\"margin-left: 40px; \">\nkeyConsAttrib(ls(&quot;-selection&quot;, &quot;-long&quot;), {&quot;tx&quot;,&quot;ty&quot;,&quot;tz&quot;,&quot;rx&quot;,&quot;ry&quot;,&quot;rz&quot;}, 0, 30, 1);\n<br type=\"_moz\" \/><\/pre>\n<p><a target=\"_blank\" href=\"https:\/\/www.rodgreen.com\/scripts\/mel\/keyConsAttrib.mel\">[Download]<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This solution only realy applies to &#8216;constrained&#8217; attributes and not expression or other forms of driven control. [Download] &nbsp; proc keyConsAttrib(string $inputObjs[], string $attributes[], float $startTime, float $endTime, float $inc) { float $curTime = currentTime(&quot;-q&quot;); for($eachObj in $inputObjs) { currentTime($startTime); for($eachAttr in $attributes) { string $fullAttr = ($eachObj + &quot;.&quot; + $eachAttr); string $listConnResult[] = [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":172,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","meta":{"footnotes":""},"class_list":["post-215","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.rodgreen.com\/index.php?rest_route=\/wp\/v2\/pages\/215","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rodgreen.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.rodgreen.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.rodgreen.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rodgreen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=215"}],"version-history":[{"count":0,"href":"https:\/\/www.rodgreen.com\/index.php?rest_route=\/wp\/v2\/pages\/215\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/www.rodgreen.com\/index.php?rest_route=\/wp\/v2\/pages\/172"}],"wp:attachment":[{"href":"https:\/\/www.rodgreen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=215"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}