Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Creating "Objects" on Python tag

    Cinema 4D SDK
    python
    2
    3
    498
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • orestiskonO
      orestiskon
      last edited by orestiskon

      Hello,

      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)
      

      Thanks

      1 Reply Last reply Reply Quote 0
      • M
        m_adam
        last edited by

        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).

        Cheers,
        Maxime.

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        orestiskonO 1 Reply Last reply Reply Quote 1
        • orestiskonO
          orestiskon @m_adam
          last edited by

          @m_adam That clears it up, thanks Maxime!

          1 Reply Last reply Reply Quote 0
          • First post
            Last post