blueprints.thing.unique module#
Note
If you found yourself here not being a dev, you should probably skip this section from or
look up the correspinging docs page of the Thing you were looking after for which this module only
implements its corresponding mirror types. A link to the docs page is to be found in the Types doc
string.
- class blueprints.thing.unique.UniqueThing[source]#
Bases:
UniqueThingType,BaseThingThings that have multiple parents and that should not be copied to often can inherit from
UniqueThing. If the attributes of this Thing should be altered for one parent but stay the same for other parents, a copy is created which then can be altered. If the the Thing has only one parent the attributes are instead altered directly. To do this, parents can call the_prepare_for_modification()method passing themselves which returns either a copy of the Thing or the Thing itself which can then be altered.>>> alterable_child = node_thing.unique_thing._prepare_for_modification(node_thing) >>> atterable_child.attr = value
This usecase is important if a Thing is modified often, but contains large amounts of data like
blueprints.cache.MeshCacheto avoid redundant copies.- Parameters:
**kwargs – Keyword arguments are passed to
super().__init__
- freeze#
Setting this attribute freezes the setting of other attributes until it is unset.
- Type:
bool