Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Letwory <nathan@letworyinteractive.com>2010-10-06 20:23:52 +0400
committerNathan Letwory <nathan@letworyinteractive.com>2010-10-06 20:23:52 +0400
commitc0b36a0be0474c5bd3a4859450d257099c8fe681 (patch)
treed29018b79966a5e369362081c45649c70871ffb3 /source/blender/collada/DocumentExporter.cpp
parent352fbb154978fbcc6b01440df37a3447400e8364 (diff)
COLLADA: Split ImagesExporter into separate files.
Diffstat (limited to 'source/blender/collada/DocumentExporter.cpp')
-rw-r--r--source/blender/collada/DocumentExporter.cpp63
1 files changed, 1 insertions, 62 deletions
diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp
index 06df94416b3..9bf84c7e606 100644
--- a/source/blender/collada/DocumentExporter.cpp
+++ b/source/blender/collada/DocumentExporter.cpp
@@ -109,10 +109,10 @@ extern char build_rev[];
#include "ArmatureExporter.h"
#include "CameraExporter.h"
#include "GeometryExporter.h"
+#include "ImageExporter.h"
#include "LightExporter.h"
#include "MaterialExporter.h"
-
#include <vector>
#include <algorithm> // std::find
@@ -299,67 +299,6 @@ public:
}
};
-class ImagesExporter: COLLADASW::LibraryImages
-{
- const char *mfilename;
- std::vector<std::string> mImages; // contains list of written images, to avoid duplicates
-public:
- ImagesExporter(COLLADASW::StreamWriter *sw, const char* filename) : COLLADASW::LibraryImages(sw), mfilename(filename)
- {}
-
- void exportImages(Scene *sce)
- {
- openLibrary();
- MaterialFunctor mf;
- mf.forEachMaterialInScene<ImagesExporter>(sce, *this);
-
- closeLibrary();
- }
-
- void operator()(Material *ma, Object *ob)
- {
- int a;
- for (a = 0; a < MAX_MTEX; a++) {
- MTex *mtex = ma->mtex[a];
- if (mtex && mtex->tex && mtex->tex->ima) {
-
- Image *image = mtex->tex->ima;
- std::string name(id_name(image));
- name = translate_id(name);
- char rel[FILE_MAX];
- char abs[FILE_MAX];
- char src[FILE_MAX];
- char dir[FILE_MAX];
-
- BLI_split_dirfile(mfilename, dir, NULL);
-
- BKE_rebase_path(abs, sizeof(abs), rel, sizeof(rel), G.sce, image->name, dir);
-
- if (abs[0] != '\0') {
-
- // make absolute source path
- BLI_strncpy(src, image->name, sizeof(src));
- BLI_path_abs(src, G.sce);
-
- // make dest directory if it doesn't exist
- BLI_make_existing_file(abs);
-
- if (BLI_copy_fileops(src, abs) != 0) {
- fprintf(stderr, "Cannot copy image to file's directory. \n");
- }
- }
-
- if (find(mImages.begin(), mImages.end(), name) == mImages.end()) {
- COLLADASW::Image img(COLLADABU::URI(COLLADABU::URI::nativePathToUri(rel)), name);
- img.add(mSW);
-
- mImages.push_back(name);
- }
- }
- }
- }
-};
-
class EffectsExporter: COLLADASW::LibraryEffects
{
public: