I created my first Python Field script, it measure the distance between one camera and each clone, everything works almost fine at this point but I don't know why for some reason, when I move the camera the field doesn't update the data from the camera position.
I need to disable and re-enable the field to update the camera data, I also tried to add "c4d.EventAdd()" on the script to force the refresh but didn't worked, someone know what I'm missing to get a proper update of the field when I move the camera?
You will find the demo file below, thanks a lot.
c4d camera field.c4d
For "optimisation" the field calculation is not done every time something change in the scene. You can still add a python tag on the field, and check for the dirtiness of the camera. The python tag is executed every time something changes in the scene. It is not the best workaround but it works.
After creating a User Data that store a link to the camera, the code could look like this.
def main() -> None:
You can adjust the flag of your dirty functions using those flags.
Hello @m_magalhaes ,
Thanks a lot for the tip, works perfectly as you said