SOLVED Creating "Objects" on Python tag


I want to ask your opinion about how safe it is to do this on a python tag.
I want to create a minimal polygon object like this

var = c4d.PolygonObject(3, 1)

and then read data from it, without inserting it in the scene.

Is this safe to run that on an expression at every frame?
Could this cause a memory leak? Should I delete it from the memory at the end of the expression?

Also, is it necessary that I use 3 points for a PolygonObject? Could I just make it:

var = c4d.PolygonObject(1, 1)


As long as you do not insert it into the current scene, this is all fine 🙂

This will not cause memory leak since Python handle it efficiently, if you do not insert the object, the ownership of the PolygonObject will still be the Python object itself. Meaning when the variable will be deleted automatically by the Python Garbage Collector, the PolygonObject will also be deleted.

You could also make an empty PolygonObject like so c4d.PolygonObject(0, 0).


@m_adam That clears it up, thanks Maxime!