def __add_image(self, image: gltf2_io_image_data.ImageData): name = image.adjusted_name() count = 1 regex = re.compile(r"-\d+$") while name in self.__images.keys(): regex_found = re.findall(regex, name) if regex_found: name = re.sub(regex, "-" + str(count), name) else: name += "-" + str(count) count += 1 # TODO: allow embedding of images (base64) self.__images[name] = image texture_dir = self.export_settings[ gltf2_blender_export_keys.TEXTURE_DIRECTORY] abs_path = os.path.join(texture_dir, name + image.file_extension) rel_path = os.path.relpath( abs_path, start=self.export_settings[ gltf2_blender_export_keys.FILE_DIRECTORY], ) return _path_to_uri(rel_path)
def __add_image(self, image: gltf2_io_image_data.ImageData): name = image.adjusted_name() count = 1 regex = re.compile(r"-\d+$") while name in self.__images.keys(): regex_found = re.findall(regex, name) if regex_found: name = re.sub(regex, "-" + str(count), name) else: name += "-" + str(count) count += 1 # TODO: we need to know the image url at this point already --> maybe add all options to the constructor of the # exporter # TODO: allow embedding of images (base64) self.__images[name] = image return name + image.file_extension
def __add_image(self, image: gltf2_io_image_data.ImageData): name = image.adjusted_name() count = 1 regex = re.compile(r"\d+$") regex_found = re.findall(regex, name) while name in self.__images.keys(): if regex_found: name = re.sub(regex, str(count), name) else: name += " " + str(count) count += 1 # TODO: we need to know the image url at this point already --> maybe add all options to the constructor of the # exporter # TODO: allow embedding of images (base64) self.__images[name] = image return name + image.file_extension
def __add_image(self, image: gltf2_io_image_data.ImageData): self.__images.append(image) # TODO: we need to know the image url at this point already --> maybe add all options to the constructor of the # exporter # TODO: allow embedding of images (base64) return image.name + image.get_extension()