<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Python in the context of CMotion]]></title><description><![CDATA[<p dir="auto"><em>On 25/08/2018 at 07:45, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">I'm digging around some areas of c4d which I've neglected for a while, today its the CMotion object.<br />
Does anyone know of any examples or use cases for python in the context of CMotion actions? Does it have some predefined parameters/variables? in the help file it just says <br />
"You can write, copy, paste, etc.. your Python scripts in this input field. They will be executed automatically by CMotion once the animation is run."</p>
<p dir="auto">So I assume there must be some method of addressing relevant / relative cmotion properties?</p>
]]></description><link>http://developers.maxon.net/forum/topic/10930/14387_python-in-the-context-of-cmotion</link><generator>RSS for Node</generator><lastBuildDate>Mon, 11 May 2026 02:46:50 GMT</lastBuildDate><atom:link href="http://developers.maxon.net/forum/topic/10930.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 01 Sep 2018 10:58:30 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Python in the context of CMotion on Sat, 01 Sep 2018 10:58:41 GMT]]></title><description><![CDATA[<p dir="auto"><em>On 28/08/2018 at 19:42, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">Aw well, I'm not sure what I want to do yet anyway. If I wanted I can just reference the parameters being affected directly from the objects in my scene, I think. need to play with it more<br />
Thanks!</p>
]]></description><link>http://developers.maxon.net/forum/post/55491</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/55491</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:58:41 GMT</pubDate></item><item><title><![CDATA[Reply to Python in the context of CMotion on Sat, 01 Sep 2018 10:58:39 GMT]]></title><description><![CDATA[<p dir="auto"><em>On 28/08/2018 at 03:22, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">Hi,</p>
<p dir="auto">I'm afraid it's not possible, op is just a link to the actual object within the scene.<br />
And there is no way to find the corresponding Cmotion Object, and even if you get the Cmotion Object, CMotion[c4d.ID_CA_WCYCLE_TAG_OBJECTS] is currently not exposed in python and you can't iterate the tree.</p>
<p dir="auto">Cheers,<br />
Maxime.</p>
]]></description><link>http://developers.maxon.net/forum/post/55490</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/55490</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:58:39 GMT</pubDate></item><item><title><![CDATA[Reply to Python in the context of CMotion on Sat, 01 Sep 2018 10:58:36 GMT]]></title><description><![CDATA[<p dir="auto"><em>On 27/08/2018 at 19:44, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">Hi Maxime,<br />
Thanks, this is great!<br />
I was wondering, is there a way to get other objects in the list, for example if op is the object affected by the action, is there a way to relatively (or absolutely) reference another object in the CMotion object manager?<br />
e.g. I tried op.GetNext() but it doesn't seem to work</p>
<p dir="auto">Thanks again!<br />
Nick</p>
]]></description><link>http://developers.maxon.net/forum/post/55489</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/55489</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:58:36 GMT</pubDate></item><item><title><![CDATA[Reply to Python in the context of CMotion on Sat, 01 Sep 2018 10:58:33 GMT]]></title><description><![CDATA[<p dir="auto"><em>On 27/08/2018 at 09:01, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">Hi Nnenov,</p>
<p dir="auto">Regarding your question, you have to define a function called Action.<br />
Then there is some globals variable available.<br />
doc: BaseDocument - The document of the current Cmotion Object.<br />
op: BaseList2D - The object affected by this python Cmotion action.<br />
time: float - The time in the current document.<br />
cycle: float - Count of cycle already occurs (for example if the Cmotion Time is set to 30F, it's basically int(CurrentFrame)/int(30))<br />
pos: float - Current time position in the cycle (from 0.0 to 1.0)<br />
phase: float - Current value of the phase.<br />
weight: float - The weight of the python Cmotion action.</p>
<p dir="auto">Here a basic example about how to move an object in the X direction.</p>
<pre><code>import c4d
  
def Action() :
    maxXValue = 100 * weight
    op.SetRelPos(c4d.Vector(maxXValue,0 ,0) * pos)
</code></pre>
<p dir="auto">If you have any question please let me know!<br />
Cheers,<br />
Maxime.</p>
]]></description><link>http://developers.maxon.net/forum/post/55488</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/55488</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:58:33 GMT</pubDate></item></channel></rss>