As soon as I add a field to a Python Effector with deform mode enabled, the poly object will no longer be affected by the deform when rendered. However, it renders in the viewport just fine?
Am I missing something obvious?
Thanks for the help!
c4d version 2023.2.1
rnd_PyEffDeformerWithField_NotShownInRender.c4d
edited by @ferdinand:
Code:
import c4d
op: c4d.BaseObject # The python effector
gen: c4d.BaseObject # The MoGraph Generator executing the effector
doc: c4d.documents.BaseDocument # The document evaluating this effector
thread: c4d.threading.BaseThread # The thread executing this effector
def main() -> bool:
# Called when the effector is executed to set MoGraph data. Similar to EffectorData::ModifyObject in C++.
moData = c4d.modules.mograph.GeGetMoData(op)
if moData is None:
return False
cnt = moData.GetCount()
marr = moData.GetArray(c4d.MODATA_MATRIX)
hasField = op[c4d.FIELDS].HasContent()
fall = moData.GetFalloffs()
for i in range(0, cnt) :
if hasField:
if i%4 == 0:
marr[i].off = marr[i].off + fall[i] * 1.0
else:
if i%4 == 0:
marr[i].off = marr[i].off + 1.0
moData.SetArray(c4d.MODATA_MATRIX, marr, hasField)
return True
@jenandesign said:
uh oh, maybe this still hasn't been fixed?
Feb 2020: https://plugincafe.maxon.net/topic/12325/python-effector-full-control-has-no-effect-during-render
Nov 2020: https://plugincafe.maxon.net/topic/13006/python-effector-not-working-with-fields
The workaround described in another report about this is to use the MoGraph Cache object. Sadly, that only works for MoGraph objects and not deformed polygon objects. Hopefully, a fix is around the corner crosses fingers