A new version of Cineversity has been launched. This legacy site and its tutorials will remain accessible for a limited transition period

Visit the New Cineversity

Navigation

 ·   Wiki Home
 ·   Categories
 ·   Title List
 ·   Uncategorized Pages
 ·   Random Page
 ·   Recent Changes
 ·   RSS
 ·   Atom
 ·   What Links Here

Search:

 

Create or Find Page:

 

View Python: Get the symbol for an ID

The CINEMA 4D API offers symbolic constants which relate to ID values throughout the application. These symbols can be found in .h files throughout the resource subfolder of the CINEMA 4D application directory.

In general, it’s preferable to use the symbol rather than the ID - both for code readability and also compatibility with future versions. Often you’ll have an ID from debugging and require the related symbol. You can simply do a search for the ID within the text of all .h files in the resource directory, or utilize the following Python script, which will search for a given ID value and print the related symbol to the console.

Simply change the value of the IDTOSEARCH variable in main to the appropriate ID.

 

 

import c4d

def searchNames(value):
    for k, v in c4d.__dict__.iteritems():
        if v == value:
            yield k
 

def main():
    IDTOSEARCH = 1023342
    for name in searchNames(IDTOSEARCH):
        print name
        
        
if __name__=='__main__':
    main()

 

 

In many cases, several results will be returned. You’ll have to determine which is the appropriate symbol based on the context.

 

Category:Scripting

Categories: