21 #include "COLLADABUURI.h"
22 #include "COLLADASWImage.h"
44 BCExportSettings &export_settings,
46 : COLLADASW::LibraryImages(sw), export_settings(export_settings), key_image_map(key_image_map)
51 void ImagesExporter::export_UV_Image(
Image *image,
bool use_copies)
53 std::string name(
id_name(image));
58 fprintf(stderr,
"Collada export: image does not exist:\n%s\n", image->
filepath);
67 short image_source = image->
source;
77 BLI_split_dir_part(this->export_settings.get_filepath(), export_dir,
sizeof(export_dir));
79 if (is_generated || is_dirty || use_copies || is_packed) {
83 BLI_strncpy(export_file, name.c_str(),
sizeof(export_file));
92 if (is_generated || is_dirty || is_packed) {
99 fprintf(stderr,
"Collada export: Cannot export image to:\n%s\n", export_path);
102 BLI_strncpy(export_path, export_file,
sizeof(export_path));
120 if (
BLI_copy(source_path, export_path) != 0) {
122 "Collada export: Cannot copy image:\n source:%s\ndest :%s\n",
129 BLI_strncpy(export_path, export_file,
sizeof(export_path));
136 BLI_strncpy(export_path, source_path,
sizeof(export_path));
142 COLLADASW::Image img(COLLADABU::URI(COLLADABU::URI::nativePathToUri(export_path)),
146 fprintf(stdout,
"Collada export: Added image: %s\n", export_file);
153 bool use_texture_copies = this->export_settings.get_use_texture_copies();
156 KeyImageMap::iterator iter;
157 for (iter = key_image_map.begin(); iter != key_image_map.end(); iter++) {
159 Image *image = iter->second;
160 std::string uid(
id_name(image));
163 export_UV_Image(image, use_texture_copies);
CustomData interface, see also DNA_customdata_types.h.
void BKE_image_release_ibuf(struct Image *ima, struct ImBuf *ibuf, void *lock)
int BKE_imbuf_write_as(struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf, const bool save_copy)
bool BKE_image_has_packedfile(struct Image *image)
struct ImBuf * BKE_image_acquire_ibuf(struct Image *ima, struct ImageUser *iuser, void **r_lock)
void BKE_imbuf_to_image_format(struct ImageFormatData *im_format, const struct ImBuf *imbuf)
int BKE_image_path_ensure_ext_from_imformat(char *string, const struct ImageFormatData *im_format)
bool BKE_image_is_dirty(struct Image *image)
File and directory operations.
int BLI_copy(const char *file, const char *to) ATTR_NONNULL()
void BLI_split_dir_part(const char *string, char *dir, const size_t dirlen)
bool BLI_make_existing_file(const char *name)
void BLI_path_normalize(const char *relabase, char *path) ATTR_NONNULL(2)
void BLI_join_dirfile(char *__restrict dst, const size_t maxlen, const char *__restrict dir, const char *__restrict file) ATTR_NONNULL()
bool BLI_path_abs(char *path, const char *basepath) ATTR_NONNULL()
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_NONNULL()
#define ID_BLEND_PATH_FROM_GLOBAL(_id)
Contains defines and structs used throughout the imbuf module.
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