<?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[MoData&#x27;s GetFalloffs() returns only 0 while rendering]]></title><description><![CDATA[<p dir="auto">This riddle has stumped me:</p>
<p dir="auto">I create a simple Python effector. Here's a trimmed-down version:</p>
<pre><code>import c4d
from c4d.modules import mograph as mo

def main() :
    moData = c4d.modules.mograph.GeGetMoData(op)
    if moData is None: return False

    hasField = op[c4d.FIELDS].HasContent()
    print ("hasField:", hasField)
    farr = moData.GetFalloffs()
    print ("Falloffs:", farr)

    return True
</code></pre>
<p dir="auto">It does nothing to the clones in this case, just shows me the falloffs (the original modifies the clones, but it behaves the same and doesn't add to the question). The scene is also very simple, the effector has a box field that moves over some cube clones.<br />
<img src="https://developers.maxon.net/forum/assets/uploads/files/1649974900188-6a36c5e4-ce35-48ea-82a3-50b5ae7784f2-image.png" alt="6a36c5e4-ce35-48ea-82a3-50b5ae7784f2-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Now here's the riddle:<br />
When I animate this scene in the <strong>viewport</strong>, the console shows me the expected falloffs, changing as the animation runs. All is well with the world.<br />
When I <strong>render</strong> the same scene however, the console shows me a <em>constant 0.0</em> for <em>all</em> falloffs.</p>
<p dir="auto">I am not able to find any explanation, any flag to set, any function to call. There are multiple examples for Python effectors, and multiple threads on this forum, none of which mentions any issue with rendering.<br />
I can put a MoGraph Cache Tag on the cloner, which works fine, and which replays fine (also with the more complicated original scene). But I don't see it mentioned anywhere that a cache is <em>mandatory</em>. The rendering should IMO just work.</p>
<p dir="auto"><a href="https://developers.maxon.net/forum/assets/uploads/files/1649975390125-simplestexample.c4d" target="_blank" rel="noopener noreferrer nofollow ugc">SimplestExample.c4d</a></p>
<p dir="auto">(I tried this on R21 too, with the same results.)</p>
]]></description><link>http://developers.maxon.net/forum/topic/13886/modata-s-getfalloffs-returns-only-0-while-rendering</link><generator>RSS for Node</generator><lastBuildDate>Sun, 06 Sep 2026 22:14:20 GMT</lastBuildDate><atom:link href="http://developers.maxon.net/forum/topic/13886.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 14 Apr 2022 22:33:03 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to MoData&#x27;s GetFalloffs() returns only 0 while rendering on Mon, 02 May 2022 11:53:04 GMT]]></title><description><![CDATA[<p dir="auto">Aaaand of course I forgot a crucial point: After modifying the clone positions in marr, you need to write them back to the MoData, but the last parameter <code>apply_strength</code> <strong>must</strong> be False:</p>
<pre><code>moData.SetArray(c4d.MODATA_MATRIX, marr, False)
</code></pre>
<p dir="auto">This is at first glance unintuitive since we want the strength to be present but when looking closely, you can fathom that the function will internally multiply with the falloff strength that it calculated itself, and that probably comes from <code>GetFalloffs()</code> again, so it's 0 and nothing is won. We do not want <code>SetArray</code> to do that at all, because we have already applied the falloffs that we calculated ourselves, and <code>SetArray</code> should keep its buggy hands off it!</p>
]]></description><link>http://developers.maxon.net/forum/post/68891</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/68891</guid><dc:creator><![CDATA[Cairyn]]></dc:creator><pubDate>Mon, 02 May 2022 11:53:04 GMT</pubDate></item><item><title><![CDATA[Reply to MoData&#x27;s GetFalloffs() returns only 0 while rendering on Fri, 15 Apr 2022 18:07:56 GMT]]></title><description><![CDATA[<p dir="auto">@m_magalhaes Meanwhile, I found one (more or less): calculating the falloff myself. I just need to access the field list and perform a <code>SampleList</code> on the clones' positions. This actually works within the render process as well. Looks approx. like this:</p>
<pre><code>    md = mo.GeGetMoData(op)
    if not md: return False
    cnt = md.GetCount()
    marr = md.GetArray(c4d.MODATA_MATRIX)
    fieldlist = op[c4d.FIELDS]

    matCloner = gen.GetMg()
    inputField = c4d.modules.mograph.FieldInput([marr[i].off * matCloner for i in range(cnt)], cnt)
    info = c4d.modules.mograph.FieldInfo.Create(c4d.FIELDSAMPLE_FLAG_VALUE, None, doc, 0, 1, inputField, gen)
    outputs = c4d.modules.mograph.FieldOutput.Create(cnt, c4d.FIELDSAMPLE_FLAG_VALUE)
    fieldlist.SampleList(info, inputField, outputs)
    # print (outputs.GetValue(0))
    for i in range(0, cnt):
        fieldStrength = outputs.GetValue(i)
        # usw usf
</code></pre>
]]></description><link>http://developers.maxon.net/forum/post/68766</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/68766</guid><dc:creator><![CDATA[Cairyn]]></dc:creator><pubDate>Fri, 15 Apr 2022 18:07:56 GMT</pubDate></item><item><title><![CDATA[Reply to MoData&#x27;s GetFalloffs() returns only 0 while rendering on Fri, 15 Apr 2022 13:29:28 GMT]]></title><description><![CDATA[<p dir="auto">hi,</p>
<p dir="auto">I don't remember the version, but we fixed the default script, now it is working in parameter control. I just remember there was no workaround for the python effector to work in full control mode.</p>
<p dir="auto">Cheers,<br />
Manuel</p>
]]></description><link>http://developers.maxon.net/forum/post/68762</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/68762</guid><dc:creator><![CDATA[Manuel]]></dc:creator><pubDate>Fri, 15 Apr 2022 13:29:28 GMT</pubDate></item><item><title><![CDATA[Reply to MoData&#x27;s GetFalloffs() returns only 0 while rendering on Fri, 15 Apr 2022 12:27:16 GMT]]></title><description><![CDATA[<p dir="auto">Okay, Parameter Mode is even worse when it comes to falloffs.<br />
<code>GetFalloffs()</code> results in an actual error raised.<br />
<code>GetArray(c4d.MODATA_FALLOFF_WGT)</code> results in None.<br />
<code>GetArray(c4d.MODATA_WEIGHT)</code> returns a proper array, but it's filled with zeroes no matter where the field is.</p>
<p dir="auto">Also, the auto-gen sample code (at least in R23) is faulty:<br />
it uses an attribute <code>data</code> which is undefined, causing an error (I found on the forum that the mode can be read via <code>GetBlendID</code>, though); and it reads the <code>MoData</code> from the <code>gen</code> variable instead of <code>op</code>, which results in <code>GetCurrentIndex</code> always returning 0.</p>
<p dir="auto">It doesn't work in the expected way anyhow. The vector returned by the Python code for <code>ID_MG_BASEEFFECTOR_POSITION</code> is not an absolute, but kind of a weight for the value set in the GUI. I'd need to return the final value though, which cannot be expressed as a product. This works in Full Control mode, but as the falloffs will not work there either with a field while rendering, I guess... I lost the game.</p>
]]></description><link>http://developers.maxon.net/forum/post/68761</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/68761</guid><dc:creator><![CDATA[Cairyn]]></dc:creator><pubDate>Fri, 15 Apr 2022 12:27:16 GMT</pubDate></item><item><title><![CDATA[Reply to MoData&#x27;s GetFalloffs() returns only 0 while rendering on Fri, 15 Apr 2022 08:59:24 GMT]]></title><description><![CDATA[<p dir="auto">Ouch! In R25 still? Thanks for the confirmation; so I may need to rewrite my effector in Parameter mode (since you mentioned the mode, I suppose it'll work this way?)</p>
]]></description><link>http://developers.maxon.net/forum/post/68759</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/68759</guid><dc:creator><![CDATA[Cairyn]]></dc:creator><pubDate>Fri, 15 Apr 2022 08:59:24 GMT</pubDate></item><item><title><![CDATA[Reply to MoData&#x27;s GetFalloffs() returns only 0 while rendering on Fri, 15 Apr 2022 07:18:53 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">You don't need to write you own code, just using the default python effector on <code>full control</code>, once you add a field, the effector will not work at render time.<br />
I've reported the bug a few times ago, but it is still there.</p>
<p dir="auto">Cheers,<br />
Manuel</p>
]]></description><link>http://developers.maxon.net/forum/post/68757</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/68757</guid><dc:creator><![CDATA[Manuel]]></dc:creator><pubDate>Fri, 15 Apr 2022 07:18:53 GMT</pubDate></item></channel></rss>