Exemplo n.º 1
0
    def get_scale(self, frame: int = None) -> np.ndarray:
        """ Returns the scale of the entity along all three axes.

        :param frame: The frame number at which the value should be returned. If None is given, the current frame number is used.
        :return: The scale at the specified frame.
        """
        with KeyFrame(frame):
            return np.array(self.blender_obj.scale)
Exemplo n.º 2
0
def get_camera_pose(frame: Optional[int] = None) -> np.ndarray:
    """ Returns the camera pose in the form of a 4x4 cam2world transformation matrx.

    :param frame: The frame number whose assigned camera pose should be returned. If None is give, the current frame is used.
    :return: The 4x4 cam2world transformation matrix.
    """
    with KeyFrame(frame):
        return np.array(Entity(bpy.context.scene.camera).get_local2world_mat())
Exemplo n.º 3
0
    def get_rotation(self, frame: int = None) -> np.ndarray:
        """ Returns the rotation of the entity in euler angles.

        :param frame: The frame number at which the value should be returned. If None is given, the current frame number is used.
        :return: The rotation at the specified frame.
        """
        with KeyFrame(frame):
            return np.array(self.blender_obj.rotation_euler)
Exemplo n.º 4
0
    def get_location(self, frame: int = None) -> np.ndarray:
        """ Returns the location of the entity in 3D world coordinates.

        :param frame: The frame number at which the value should be returned. If None is given, the current frame number is used.
        :return: The location at the specified frame.
        """
        with KeyFrame(frame):
            return np.array(self.blender_obj.location)
Exemplo n.º 5
0
    def get_type(self, frame: int = None) -> str:
        """ Returns the type of the light.

        :param frame: The frame number at which the value should be returned. If None is given, the current frame number is used.
        :return: The type at the specified frame.
        """
        with KeyFrame(frame):
            return self.blender_obj.data.type
Exemplo n.º 6
0
    def get_distance(self, frame: int = None) -> float:
        """ Returns the falloff distance of the light (point where light is half the original intensity).

        :param frame: The frame number at which the value should be returned. If None is given, the current frame number is used.
        :return: The falloff distance at the specified frame.
        """
        with KeyFrame(frame):
            return self.blender_obj.data.distance
Exemplo n.º 7
0
    def get_cp(self, key: str, frame: int = None) -> Any:
        """ Returns the custom property with the given key.

        :param key: The key of the custom property.
        :param frame: The frame number at which the value should be returned. If None is given, the current frame number is used.
        :return: The value of the custom property.
        """
        with KeyFrame(frame):
            value = self.blender_obj[key]
            if isinstance(value, (Vector, Euler, Color, Matrix, Quaternion)):
                value = np.array(value)
            return value