9#include "COLLADABUURI.h"
10#include "COLLADASWImage.h"
28 BCExportSettings &export_settings,
30 : COLLADASW::LibraryImages(sw), export_settings(export_settings), key_image_map(key_image_map)
35void ImagesExporter::export_UV_Image(
Image *image,
bool use_copies)
37 std::string name(
id_name(image));
42 fprintf(stderr,
"Collada export: image does not exist:\n%s\n", image->
filepath);
51 short image_source = image->
source;
63 if (is_generated || is_dirty || use_copies || is_packed) {
67 STRNCPY(export_file, name.c_str());
70 BLI_path_join(export_path,
sizeof(export_path), export_dir, export_file);
75 if (is_generated || is_dirty || is_packed) {
82 fprintf(stderr,
"Collada export: Cannot export image to:\n%s\n", export_path);
85 STRNCPY(export_path, export_file);
103 if (
BLI_copy(source_path, export_path) != 0) {
105 "Collada export: Cannot copy image:\n source:%s\ndest :%s\n",
112 STRNCPY(export_path, export_file);
119 STRNCPY(export_path, source_path);
125 COLLADASW::Image img(COLLADABU::URI(COLLADABU::URI::nativePathToUri(export_path)),
129 fprintf(stdout,
"Collada export: Added image: %s\n", export_file);
136 bool use_texture_copies = this->export_settings.get_use_texture_copies();
139 KeyImageMap::iterator iter;
140 for (iter = key_image_map.begin(); iter != key_image_map.end(); iter++) {
142 Image *image = iter->second;
143 export_UV_Image(image, use_texture_copies);
ImBuf * BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **r_lock)
void BKE_image_release_ibuf(Image *ima, ImBuf *ibuf, void *lock)
bool BKE_image_is_dirty(Image *image)
bool BKE_image_has_packedfile(const Image *image)
bool BKE_imbuf_write_as(ImBuf *ibuf, const char *filepath, const ImageFormatData *imf, bool save_copy)
File and directory operations.
int BLI_copy(const char *path_src, const char *path_dst) ATTR_NONNULL()
bool BLI_file_ensure_parent_dir_exists(const char *filepath) ATTR_NONNULL(1)
bool BLI_path_abs(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1
int BLI_path_normalize(char *path) ATTR_NONNULL(1)
#define BLI_path_join(...)
void void BLI_path_split_dir_part(const char *filepath, char *dir, size_t dir_maxncpy) ATTR_NONNULL(1
char * STRNCPY(char(&dst)[N], const char *src)
struct ImageFormatData ImageFormatData
ImagesExporter(COLLADASW::StreamWriter *sw, BCExportSettings &export_settings, KeyImageMap &key_image_map)
void exportImages(Scene *sce)
std::string translate_id(const char *idString)
std::string id_name(void *id)
std::map< std::string, Image * > KeyImageMap
#define ID_BLEND_PATH_FROM_GLOBAL(_id)