Пример #1
0
    def _get_shapenet_attribute(shapenet_obj: bpy.types.Object,
                                attribute_name: str):
        """ Returns the value of the requested attribute for the given object.

        :param shapenet_obj: The ShapeNet object.
        :param attribute_name: The attribute name.
        :return: The attribute value.
        """

        if attribute_name == "used_synset_id":
            return shapenet_obj.get("used_synset_id", "")
        elif attribute_name == "used_source_id":
            return shapenet_obj.get("used_source_id", "")
        else:
            return WriterUtility.get_common_attribute(shapenet_obj,
                                                      attribute_name)
Пример #2
0
def GetListOfOrientationsToRender(cameraPoint: bpy.types.Object) -> list:
    """ From blender data, grab all objects of type Orientation
        which have the cameraPoint as their parent. """

    parentId: str = cameraPoint.get("zag.uuid")
    return [
        obj for obj in bpy.data.objects if obj.get("zag.type") == "Orientation"
        and obj.parent.get("zag.uuid") == parentId
    ]
Пример #3
0
    def _get_shapenet_attribute(shapenet_obj: bpy.types.Object,
                                attribute_name: str,
                                local_frame_change: Union[None,
                                                          List[str]] = None,
                                world_frame_change: Union[None,
                                                          List[str]] = None):
        """ Returns the value of the requested attribute for the given object.

        :param shapenet_obj: The ShapeNet object.
        :param attribute_name: The attribute name.
        :param local_frame_change: Can be used to change the local coordinate frame of matrices. Default: ["X", "Y", "Z"]
        :param world_frame_change: Can be used to change the world coordinate frame of points and matrices. Default: ["X", "Y", "Z"]
        :return: The attribute value.
        """

        if attribute_name == "used_synset_id":
            return shapenet_obj.get("used_synset_id", "")
        elif attribute_name == "used_source_id":
            return shapenet_obj.get("used_source_id", "")
        else:
            return WriterUtility.get_common_attribute(shapenet_obj,
                                                      attribute_name,
                                                      local_frame_change,
                                                      world_frame_change)