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

    List of all Cinema 4D IDs?

    Cinema 4D SDK
    r21 sdk python
    3
    5
    662
    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.
    • ?
      A Former User
      last edited by A Former User

      Hello,
      I've been trying to find a more up-to-date version of this list of Cinema 4D IDs posted to GitHub by seeminglee. Here is another that was created for COFFEE by Niklas Rosenstein.

      I find it extremely useful in understanding C4D messages. Does anyone know how I could find/create something like this for R21? Thank you!

      1 Reply Last reply Reply Quote 0
      • ferdinandF
        ferdinand
        last edited by ferdinand

        Hi,

        I am not quite sure, if I do understand your question correctly. At least the first link is a dummy module listing members of all types of the c4d module, but you talk about ids and messages. Anyways, you can in both cases just inspect the c4d module. Here is a little function that inverts the c4d module dictionary so that you can plug integer symbols into the returned dict and get a list of strings which are associated with that integer (Cinema's symbol namespace is anything but collision free).

        def _get_smybol_table():
            """Function to extract and invert the integer symbols and their corresponding strings
                symbols from the c4d module. Will ignore all members of ``c4d`` that are not of type
               ``int`` and members where the string symbol is not all in capitals letters.
        
            Returns:
                dict: The inverted c4d module dict, with integer symbols as keys and string symbols as
                lists of values.
            """
            tbl = {}
            for name, sid in c4d.__dict__.items():
                if (not isinstance(sid, int) or 
                    not isinstance(name, str) or
                    not name.isupper()):
                    continue
                tbl[sid] = [name] if sid not in tbl else tbl[sid] + [name]
            return tbl
        
        # The symbol table.
        _SYMBOL_TABLE = _get_smybol_table()
        

        Cheers,
        zipit

        MAXON SDK Specialist
        developers.maxon.net

        1 Reply Last reply Reply Quote 0
        • ?
          A Former User
          last edited by

          Thank you @zipit . for name, sid in c4d.__dict__.items(): was what I needed! 😄

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

            Hi @blastframe, while the code provided by @zipit will work for most of the symbols
            There will be some symbols missing, some are not uppercase (like Ocube), some are made from other types, like c4d.ID_USERDATA which return a DescID).

            So the safest way to process is to retrieve everything that is not a module, a class, a type object, a method or a function.

            import c4d
            import types
            
            def GetAllSymbols():
            
                def IsSymbol(x):
                    isSymbols = False
                    obj = getattr(c4d, x)
                    return not isinstance(obj, (types.FunctionType,
                                                types.BuiltinFunctionType,
                                                types.BuiltinMethodType,
                                                types.MethodType,
                                                types.UnboundMethodType,
                                                types.ClassType,
                                                types.TypeType,
                                                types.ModuleType))
            
                dirC4D = filter(lambda objStr: IsSymbol(objStr), dir(c4d))
                values = {"c4d.{0}".format(objStr): getattr(c4d, objStr) for objStr in dirC4D}
                
                return values
            
                
            def main():
                allSymbol = GetAllSymbols()
                for symbol, value in allSymbol.items():
                    print symbol, value
            
            
            # Execute main()
            if __name__=='__main__':
                main()
            

            Cheers,
            Maxime.

            MAXON SDK Specialist

            Development Blog, MAXON Registered Developer

            ? 1 Reply Last reply Reply Quote 0
            • ?
              A Former User @m_adam
              last edited by

              @m_adam Thank you for the clarification and the code example, Maxime!

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