Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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

    Exposing object functions to python

    SDK Help
    0
    2
    253
    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.
    • H
      Helper
      last edited by

      On 14/04/2014 at 03:08, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   R14 
      Platform:   Windows  ; Mac  ;  
      Language(s) :     C++  ;   PYTHON  ;

      ---------
      Is it possible to expose custom functions from a subclass of ObjectData into python? Or at least create a global function that takes it the object as an argument, so I can handle it in C++ and return the information I need? I need access to the underlying data structures..

      I only found this example for wrapping a global function using ctypes here. But have no idea how I could use it for my purpose.

      Cheers,
      Satara

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        On 17/04/2014 at 14:54, xxxxxxxx wrote:

        The Python API is not documented, we therefore also don't give much support for it, but you can
        use it. It should not be hard to understand after examining the header a little. Something that you
        should know though (where I failed initially) is that you need to lock the Python GIL before doing any
        Python related stuff. You can use RAII for that purpose with the GePythonGIL class.

        The Python library in the SDK allows you to convert back and forth between GeListNodes, for 
        instance. You can also expose new functions to Python, but it might be easier to just use ctypes
        and then convert the passed PyObjects to a GeListNode.

        Best,
        -Niklas

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