threedb.controls.blender.material¶
Change object materials. An example config file using this control can be found here: https://github.com/3db/3db/tree/main/examples/unit_tests/material.yaml.
-
class
threedb.controls.blender.material.
MaterialControl
(root_folder: str)¶ Bases:
threedb.controls.base_control.PreProcessControl
Control that swap material of an object with another one
Discrete Dimensions:
replacement_material
: The name of the material that replaces theoriginal material.
Note
The possible values for
replacement_material
can be any file name found in$BLENDER_DATA/blender_control_material
.Each of these file should only contain a single material.
-
__init__
(root_folder: str)¶ Construct a BaseControl
- Parameters
root_folder – The folder containing all the data for this 3DB experiment. All paths are lative to his folder
-
apply
(context: Dict[str, Any], control_args: Dict[str, Any]) → None¶ Replace the material of the target object with the material corresponding to
replacement_material
.- Parameters
context (Dict[str, Any]) – The blender scene context.
control_args (Dict[str, Any]) – Must have key
replacement_material
containing the file name of the replacement material to use.
-
unapply
(context: Dict[str, Any]) → None¶ Undo the modification on a scene
Note
Most of the time, recreating a scene is very expensive, therefore, controls are asked to implement a reverse operation to undo their changes. Controls that need to store state in order to undo their actions should add data to the target object they received.
- Parameters
context (Dict[str, Any]) – The description of the scene to render
-
threedb.controls.blender.material.
Control
¶