Hello,
I have been trying to figure out the best way for me to debug a Python Effector I am working on. So far, I have not found a way to connect my Python Effector code to VS Code like I do for Python scripts.
So the best I came up with so far is to try and run the Python Effect as a script by using the following structure:
import c4d
op: c4d.BaseObject # The Python Effector object containing this code.
gen: c4d.BaseObject # The MoGraph Generator executing `op`.
doc: c4d.documents.BaseDocument # The document `op` and `gen`are contained in.
# ......
def main() -> bool:
""" Regular Python effector code
"""
# The following is to run the effector as a script for debugging purposes.
# This simply calls the
if __name__ == '__main__':
# This is used when we execute the script directly, not as a Python Effector
op = doc.SearchObject("Python Effector to debug")
gen = doc.SearchObject("Generator with active Python Effector to debug")
main()
This seems like a convoluted way to go about debugging the Python Effector, but it is the best I have come up with so far. While it does allow me to step and debug the code, it does not allow me to see the effect, I assume because on the next scene renders, it seems the effect of my script is overridden by the regular generator execution.
My questions are:
- Is there a better way to debug Python Effector code? I have been trying to follow the documentation but I do not see anything about Python Effectors or Python Field Debugging.
- What is the best way to package a Python Effector for reuse across documents? I have not found a way to make it a plugin.
I appologise if I did not get deep enough in the documentation or if I am missing the obvious. I am fairly new to Python in Cinema 4D and this is my first question.
Thanks in advance for any help you can offer.