panda3d.direct.DCFile

from panda3d.direct import DCFile
class DCFile

Represents the complete list of Distributed Class descriptions as read from a .dc file.

Inheritance diagram

Inheritance diagram of DCFile

__init__() → None
__init__(param0: DCFile) → None
clear() → None

Removes all of the classes defined within the DCFile and prepares it for reading a new file.

readAll() → bool

This special method reads all of the .dc files named by the “dc-file” config.prc variable, and loads them into the DCFile namespace.

read(filename: Filename) → bool

Opens and reads the indicated .dc file by name. The distributed classes defined in the file will be appended to the set of distributed classes already recorded, if any.

Returns true if the file is successfully read, false if there was an error (in which case the file might have been partially read).

read(in: istream, filename: str) → bool

Parses the already-opened input stream for distributed class descriptions. The filename parameter is optional and is only used when reporting errors.

The distributed classes defined in the file will be appended to the set of distributed classes already recorded, if any.

Returns true if the file is successfully read, false if there was an error (in which case the file might have been partially read).

write(filename: Filename, brief: bool) → bool

Opens the indicated filename for output and writes a parseable description of all the known distributed classes to the file.

Returns true if the description is successfully written, false otherwise.

write(out: ostream, brief: bool) → bool

Writes a parseable description of all the known distributed classes to the stream.

Returns true if the description is successfully written, false otherwise.

getNumClasses() → int

Returns the number of classes read from the .dc file(s).

getClass(n: int) → DCClass

Returns the nth class read from the .dc file(s).

Return type

DCClass

getClassByName(name: str) → DCClass

Returns the class that has the indicated name, or NULL if there is no such class.

Return type

DCClass

getSwitchByName(name: str) → DCSwitch

Returns the switch that has the indicated name, or NULL if there is no such switch.

Return type

DCSwitch

getFieldByIndex(index_number: int) → DCField

Returns a pointer to the one DCField that has the indicated index number, of all the DCFields across all classes in the file.

This method is only valid if dc-multiple-inheritance is set true in the Config.prc file. Without this setting, different DCFields may share the same index number, so this global lookup is not possible.

Return type

DCField

allObjectsValid() → bool

Returns true if all of the classes read from the DC file were defined and valid, or false if any of them were undefined (“bogus classes”). If this is true, we might have read a partial file.

getNumImportModules() → int

Returns the number of import lines read from the .dc file(s).

getImportModule(n: int) → str

Returns the module named by the nth import line read from the .dc file(s).

getNumImportSymbols(n: int) → int

Returns the number of symbols explicitly imported by the nth import line. If this is 0, the line is “import modulename”; if it is more than 0, the line is “from modulename import symbol, symbol … “.

getImportSymbol(n: int, i: int) → str

Returns the ith symbol named by the nth import line read from the .dc file(s).

getNumTypedefs() → int

Returns the number of typedefs read from the .dc file(s).

getTypedef(n: int) → DCTypedef

Returns the nth typedef read from the .dc file(s).

Return type

DCTypedef

getTypedefByName(name: str) → DCTypedef

Returns the typedef that has the indicated name, or NULL if there is no such typedef name.

Return type

DCTypedef

getNumKeywords() → int

Returns the number of keywords read from the .dc file(s).

getKeyword(n: int) → DCKeyword

Returns the nth keyword read from the .dc file(s).

Return type

DCKeyword

getKeywordByName(name: str) → DCKeyword

Returns the keyword that has the indicated name, or NULL if there is no such keyword name.

Return type

DCKeyword

getHash() → int

Returns a 32-bit hash index associated with this file. This number is guaranteed to be consistent if the contents of the file have not changed, and it is very likely to be different if the contents of the file do change.