Exemple #1
0
    def __init__(self, config):
        Loader.__init__(self, config)
        sys_paths = self.config.get_list("sys_paths")
        for sys_path in sys_paths:
            if 'bop_toolkit' in sys_path:
                sys.path.append(sys_path)

        self.sample_objects = self.config.get_bool("sample_objects", False)
        if self.sample_objects:
            self.num_of_objs_to_sample = self.config.get_int(
                "num_of_objs_to_sample")
            self.obj_instances_limit = self.config.get_int(
                "obj_instances_limit", -1)

        self.cam_type = self.config.get_string("cam_type", "")
        self.bop_dataset_path = self.config.get_string("bop_dataset_path")
        self.scene_id = self.config.get_int("scene_id", -1)
        self.obj_ids = self.config.get_list("obj_ids", [])
        if self.obj_ids or self.sample_objects:
            self.allow_duplication = True
        else:
            self.allow_duplication = False
        self.split = self.config.get_string("split", "test")
        self.model_type = self.config.get_string("model_type", "")
        self.scale = 0.001 if self.config.get_bool("mm2m", False) else 1
        self.bop_dataset_name = os.path.basename(self.bop_dataset_path)
        self._has_external_texture = self.bop_dataset_name in ["ycbv", "ruapc"]
 def __init__(self, config):
     Loader.__init__(self, config)
     self.house_path = self.config.get_string("path")
     self.suncg_dir = self.config.get_string(
         "suncg_path",
         os.path.join(os.path.dirname(self.house_path), "../.."))
     self._collection_of_loaded_objs = {}
Exemple #3
0
    def __init__(self, config):
        Loader.__init__(self, config)

        self._data_path = Utility.resolve_path(
            self.config.get_string("data_path"))
        self._used_synset_id = self.config.get_string("used_synset_id")

        taxonomy_file_path = os.path.join(self._data_path, "taxonomy.json")
        self._files_with_fitting_synset = ShapeNetLoader.get_files_with_synset(
            self._used_synset_id, taxonomy_file_path, self._data_path)
Exemple #4
0
 def __init__(self, config):
     Loader.__init__(self, config)
     # supported pairs of {ID type/section names: datablock parameter names}
     self.known_datablock_names = {
         "/Camera": "cameras",
         "/Collection": "collections",
         "/Image": "images",
         "/Light": "lights",
         "/Material": "materials",
         "/Mesh": "meshes",
         "/Object": "objects",
         "/Texture": "textures"
     }
Exemple #5
0
 def __init__(self, config):
     Loader.__init__(self, config)
     self.house_path = Utility.resolve_path(self.config.get_string("path"))
     suncg_folder_path = os.path.join(os.path.dirname(self.house_path),
                                      "../..")
     self.suncg_dir = self.config.get_string("suncg_path",
                                             suncg_folder_path)
     self._collection_of_loaded_objs = {}
     # there are only two types of materials, textures and diffuse
     self._collection_of_loaded_mats = {"texture": {}, "diffuse": {}}
     LabelIdMapping.assign_mapping(
         Utility.resolve_path(
             os.path.join('resources', 'id_mappings', 'nyu_idset.csv')))
    def __init__(self, config):
        Loader.__init__(self, config)

        self._file_path = Utility.resolve_path(
            self.config.get_string("file_path"))

        self._texture_folder = Utility.resolve_path(
            self.config.get_string("texture_folder"))
        LabelIdMapping.assign_mapping(
            Utility.resolve_path(
                os.path.join('resources', 'id_mappings', 'nyu_idset.csv')))

        if LabelIdMapping.label_id_map:
            bpy.data.scenes["Scene"]["num_labels"] = LabelIdMapping.num_labels
            bpy.context.scene.world[
                "category_id"] = LabelIdMapping.label_id_map["void"]
        else:
            print(
                "Warning: The category labeling file could not be found -> no semantic segmentation available!"
            )
    def _apply_function(self, entity, key, result):
        """ Applies a custom function to the selected entity.

        :param entity: Entity to be modified via the application of the custom function. Type: bpy.types.Object.
        :param key: Name of the custom function. Type: string.
        :param result: Configuration parameters of the custom function. Type: dict.
        """
        if key == "add_modifier":
            result = Config(result)
            name = result.get_string("name")  # the name of the modifier
            if name.upper() == "SOLIDIFY":
                thickness = result.get_float("thickness")
                bpy.context.view_layer.objects.active = entity
                bpy.ops.object.modifier_add(type=name.upper())
                bpy.context.object.modifiers["Solidify"].thickness = thickness
            else:
                raise Exception("Unknown modifier name: {}.".format(name))
        elif key == "set_shading":
            result = Config(result)
            mode = result.get_string("cf_set_shaing")
            Loader.change_shading_mode([entity], mode)
        else:
            raise Exception("Unknown custom function name: {}.".format(key))
 def __init__(self, config):
     Loader.__init__(self, config)
 def __init__(self, config):
     Loader.__init__(self, config)
     # set a RE-specific material name pattern to look for in the selected objects
     self.target_material = "re_ground_mat.*"