DCFile
from panda3d.direct import DCFile
- class DCFile
Bases:
Represents the complete list of Distributed Class descriptions as read from a .dc file.
Inheritance diagram
- __init__()
- __init__(param0: DCFile)
- 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.
- clear()
Removes all of the classes defined within the
DCFile
and prepares it for reading a new file.
- getClassByName(name: str) DCClass
Returns the class that has the indicated name, or NULL if there is no such class.
- getFieldByIndex(index_number: int) DCField
Returns a pointer to the one
DCField
that has the indicated index number, of all theDCFields
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.
- 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.
- getImportModule(n: int) str
Returns the module named by the nth import line read from the .dc file(s).
- getImportSymbol(n: int, i: int) str
Returns the ith symbol named by the nth import line read from the .dc file(s).
- getKeywordByName(name: str) DCKeyword
Returns the keyword that has the indicated name, or NULL if there is no such keyword name.
- 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 … “.
- getSwitchByName(name: str) DCSwitch
Returns the switch that has the indicated name, or NULL if there is no such switch.
- getTypedefByName(name: str) DCTypedef
Returns the typedef that has the indicated name, or NULL if there is no such typedef name.
- read(filename: panda3d.core.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: panda3d.core.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).
- 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.
- write(filename: panda3d.core.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: panda3d.core.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.