Example #1
0
def occlude_obj(scene: Scene, object_id, occlude):
    if object_id in scene.all_objects:
        # NOTE: transparency does not allow occlusion so remove transparency here.
        scene.update_object(scene.all_objects[object_id],
                            **{"material-extras": {"transparentOccluder": (occlude != BOOLS[1])}},
                            material=Material(transparent=False, opacity=1))
        print(f"Occluded {object_id}")
Example #2
0
def parent_obj(scene: Scene, object_id, parent_id):
    if object_id in scene.all_objects:
        scene.update_object(scene.all_objects[object_id], parent=parent_id)
        print(f"{parent_id} adopted {object_id}")
Example #3
0
def rotate_obj(scene: Scene, object_id, rotation):
    if object_id in scene.all_objects:
        scene.update_object(scene.all_objects[object_id], rotation=rotation)
        print(f"Rotated {object_id}")
Example #4
0
def move_obj(scene: Scene, object_id, position):
    if object_id in scene.all_objects:
        scene.update_object(scene.all_objects[object_id], position=position)
        print(f"Relocated {object_id}")
Example #5
0
def scale_obj(scene: Scene, object_id, scale):
    if object_id in scene.all_objects:
        scene.update_object(scene.all_objects[object_id], scale=scale)
        print(f"Scaled {object_id}")
Example #6
0
def stretch_obj(scene: Scene, object_id, scale, position):
    if object_id in scene.all_objects:
        scene.update_object(
            scene.all_objects[object_id], scale=scale, position=position)
        print(f"Stretched {object_id}")
Example #7
0
def color_obj(scene: Scene, object_id, color):
    if object_id in scene.all_objects:
        scene.update_object(
            scene.all_objects[object_id], material=Material(color=color))
        print(f"Colored {object_id}")
Example #8
0
def opaque_obj(scene: Scene, object_id, opacity):
    if object_id in scene.all_objects:
        scene.update_object(scene.all_objects[object_id],
                            material=Material(transparent=True, opacity=opacity))
        print(f"Opaqued {object_id}")