threedb.controls.blender.obj_loc_in_frame¶
Change the object location in the frame. An example config file using this control can be found here: https://github.com/3db/3db/tree/main/examples/unit_tests/obj_loc_in_frame.yaml.
-
class
threedb.controls.blender.obj_loc_in_frame.
ObjLocInFrameControl
(root_folder: str)¶ Bases:
threedb.controls.base_control.PreProcessControl
Control that moves the object of interest in the image frame. This is done by moving the object in a plane parallel to the camera plane and passing through the object’s position.
Continuous Dimensions:
x_shift
: The normalized X-coordinate of the center of the object in the frame.A value of -1 is the left-most edge of the frame and 1 is the right-most edge of the frame. (default range:
[-1, 1]
)
y_shift
: The normalized Y-coordinate of the center of the object in the frameTakes any value between -1 (bottom of the frame) and 1 (top of the frame). (default range:
[-1, 1]
)
Note
Setting x_shift and y_shift to zeros keeps the object in the middle of the frame.
-
__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¶ Move the object in the frame
- Parameters
context – The scene context.
x_shift – The normalized X-coordinate of the center of the object in the frame. Takes any value between -1 (left of the frame) and 1 (right of the frame).
Y_shift – The normalized Y-coordinate of the center of the object in the frame Takes any value between -1 (bottom of the frame) and 1 (top of the frame).
-
unapply
(context)¶ 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.obj_loc_in_frame.
Control
¶ alias of
threedb.controls.blender.obj_loc_in_frame.ObjLocInFrameControl