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

    Dumping an object to Python code

    Scheduled Pinned Locked Moved PYTHON Development
    2 Posts 0 Posters 206 Views
    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 Offline
      Helper
      last edited by

      On 23/08/2016 at 06:47, xxxxxxxx wrote:

      Hi there,
      I wonder whether there is a mean to dump a selected object (a shader for instance) to Python code.
      Apart from a didactic goal, the aim would be to speed up code template creation; for instance, from a shader defined through UI, deriving variations in Python code.
      Such a tool would likely be a plugin that to introspection on c4D objects. Does it exists yet ?
      Thanks

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

        On 24/08/2016 at 06:20, xxxxxxxx wrote:

        Hi,

        introspection in Python sense is not possible, at least not to the extend you expect.

        But you can create/clone objects and modify them (you probably know this) :

        obj = c4d.BaseObject(c4d.Osphere)
        obj[parameter id] = ...
        

        You can also browse the BaseContainer of an object (but there's a certain risk, some data might not be stored in the BaseContainer) :

        for index, value in obj.GetDataInstance() :
            print(index, value)
        

        And finally you can browse the Description of objects, see code at the bottom of the page.

        I hope this helps.

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