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

    c4d_symbols.h Parser for Py4D

    Scheduled Pinned Locked Moved PYTHON Development
    2 Posts 0 Posters 477 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

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 09/06/2011 at 07:14, xxxxxxxx wrote:

      Header File parser for Py4D - BETA
      - - - - - - - - - - - - - -

      I was sick including the ID's for a dialog created in ResEdit myself into
      Python. Therefore I wrote a Header File parser. It will only analyze an
      enum statement.

      First, download the package below and copy the folder to your Py4D library.
      In your plugin, use this code to parse the c4d_symbols.h and insert
      the ID's into the global scope.

        
      from    HeaderFileParser        import parse  
      from    os.path                 import join, abspath, dirname  
        
      parse(  
        join(  
            dirname( abspath(__file__)),  
            "res",  
            "c4d_symbols.h",  
        ),  
        globals(),  
      )
      

      You can now use the ID's defined in c4d_symbols.h in you Plugin.

      Remember, this is still BETA. If any problems occure, please report it !
      As this is still BETA, you might only use this while you are still
      developing your plugin and your GUI might change.

      HeaderFileParser_BETA_0.9

      Cheers,
      Niklas

      //Link fixed

      EDIT: The c4dtools library now does this for you!

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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 25/08/2011 at 11:30, xxxxxxxx wrote:

        I'd suggest the following use:

        class foo: 'Just to store data'  
        res = foo()  
        from HeaderFileParser import parse  
        parse(path_to_c4d_symbols_h, res.__dict__)
        

        This will copy all ID's as attributes to the foo-instance and you can use them like this:

        res.MY_ID
        

        To replace the HeaderFileParser (for example to release the plugin and to be independent from it), you can print the dictionary that contains the IDs and copy the output into your plugin like this:

        print res.__dict__
        

        ... Copy the output to clipboard, comment out the code from the HeaderFileParser and do

          
        class foo: 'Just to store data'  
        res = foo()  
        # # # # # # # # # # # # # # # # # # # # # # # #  
        # # from HeaderFileParser import parse  
        # # parse(path_to_c4d_symbols_h, res.__dict__)  
        # # # # # # # # # # # # # # # # # # # # # # # #  
        res.__dict__ = {'MY_ID': 10023, ...} # the output pasted from the clipboard
        
        1 Reply Last reply Reply Quote 0
        • First post
          Last post