threedb.controls.blender.mug_liquid

Change liquid inside of a mug. Used to reproduce examples in the 3DB paper.

class threedb.controls.blender.mug_liquid.MugLiquidControl(root_folder: str)

Bases: threedb.controls.base_control.PreProcessControl

Change the material of the liquid present in the mug object

Note

This control assumes that the surface of the liquid has a manterial named “liquid” and that the object we want to modify is the target of this render.

The ratio of water will be 1 - ratio_milk - ratio_coffee

Continuous Dimensions:

  • ratio_milk (float): The ratio of milk (default range: [0, 1])

  • ratio_coffee (float): The ratio of coffee (default range: [0, 1])

__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

Change the material of the liquid

Parameters
  • context (Dict[str, Any]) – The scene context

  • control_args (Dict[str, Any]) – The arguments for this control, should have keys ratio_milk and ratio_coffee (see the class docstring for information).

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.mug_liquid.Control

alias of threedb.controls.blender.mug_liquid.MugLiquidControl