peng3d.config
- Configuration system¶
-
peng3d.config.
CFG_FOG_DEFAULT
= {'color': None, 'enable': False, 'end': 160, 'start': 128}¶ Default fog configuration.
This configuration simply disables fog.
-
peng3d.config.
CFG_LIGHT_DEFAULT
= {'enable': False}¶ Default lighting configuration.
This configuration simply disables lighting.
-
peng3d.config.
DEFAULT_CONFIG
¶ Default configuration values.
All default configuration values are stored here, for more information about specific config values, see Configuration Options for peng3d.
-
class
peng3d.config.
Config
(config=None, defaults={})[source]¶ Configuration object imitating a dictionary.
config
can be any dictionary-style object and is used to store the configuration set by the user. This object only needs to implement the__getitem__
,__setitem__
and__contains__
special methods.defaults
can be any dictionary-style object and is only read from in case theconfig
object does not contain the key. Every config object is stackable, e.g. you can pass anotherConfig
object as thedefaults
object.Example for stacking configs:
>>> myconf = Config() >>> myconf2 = Config(defaults=myconf) >>> myconf["foo"] = "bar" >>> print(myconf2["foo"]) bar >>> myconf2["bar"] = "foo" >>> print(myconf2["bar"]) foo >>> print(myconf["bar"]) Traceback (most recent call last): ... KeyError: Key "bar" does not exist
There is no limit in stacking configurations, though higher-stacked configs may get slow when defaulting due to propagating through the whole chain.