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

    Convert int ID back into string representation ?

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 310 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 10/12/2012 at 05:15, xxxxxxxx wrote:

      hi,

      i have got a quite simple question again. is there a way to convert a plugin or basecontainer
      ID from their integer form back into the alphanummeric form defined in the header files ? i want
      to pass an integer and get back a string representation of that integer.

      thanks for your help 🙂

      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 10/12/2012 at 06:00, xxxxxxxx wrote:

        Well, it's technically possible, but you could end up with multiple symbol-names. You'd
        need a basecase for the symbol-detection, e.g. when you only want to reach
        plugin-symbols, you could use a regular expression like this:

        import re  
        import c4d  
          
        plugExpr = re.compile('[A-Z]\w+')  
          
        def find_keys(dct, value, filter=lambda x: True) :  
          for k, v in dct.iteritems() :  
              if v == value and filter(k) :  
                  yield k  
          
        symbols = find_keys(vars(c4d), c4d.Obase, plugExpr.match)  
        for k in symbols:  
          print k  
        print '-' * 30
        

        Best,
        Niklas

        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 10/12/2012 at 08:10, xxxxxxxx wrote:

          i do not want to sound ungrateful, but if i have understood your example correctly, you suggest
          serializing the class into a dictionary and then poke with a regEx in the remains ? i have tried your 
          example with with Olight and it works for the plugin id as you said, but the returned bc content 
          was utter nonsense.

          i was so naive to believe, that there might be a less painfull way to do this 🙂 isn't the symbol
          cache file just a cached version of all header files to do this translation , or am i worng ?

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