示例#1
0
def set_scene_objects(pose) -> bpy.types.Object:
    """creates all objects in the scene. 
    Pose skeleton, floor, lights, focus object for camera to focus at.

    """
    skeleton = Skeleton(pose, shadow_on=True)

    floor = Floor(size=20.0)

    utils.create_area_light(location=(4.0, -3.0, 6.0),
                            rotation=(0.0, math.pi * 60.0 / 180.0,
                                      -math.pi * 32.0 / 180.0),
                            size=0.50,
                            color=(1.00, 1.0, 1.0, 1.00),
                            strength=1500.0,
                            name="Main Light")

    # camera focus - pelvis or any point, check manually?
    focus_location = (skeleton.joint_coordinates[0][0],
                      skeleton.joint_coordinates[0][1],
                      skeleton.joint_coordinates[0][2])

    bpy.ops.object.empty_add(location=focus_location)
    focus_target = bpy.context.object
    return focus_target
def set_floor_and_lights() -> None:
    size = 200.0
    current_object = utils.create_plane(size=size, name="Floor")
    floor_mat = utils.add_material("Material_Plane",
                                   use_nodes=True,
                                   make_node_tree_empty=True)
    utils.build_checker_board_nodes(floor_mat.node_tree, size)
    current_object.data.materials.append(floor_mat)

    utils.create_area_light(location=(6.0, 0.0, 4.0),
                            rotation=(0.0, math.pi * 60.0 / 180.0, 0.0),
                            size=5.0,
                            color=(1.00, 0.70, 0.60, 1.00),
                            strength=1500.0,
                            name="Main Light")
    utils.create_area_light(location=(-6.0, 0.0, 2.0),
                            rotation=(0.0, -math.pi * 80.0 / 180.0, 0.0),
                            size=5.0,
                            color=(0.30, 0.42, 1.00, 1.00),
                            strength=1000.0,
                            name="Sub Light")