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
path: root/source
diff options
context:
space:
mode:
authorGaia Clary <gaia.clary@machinimatrix.org>2012-06-24 02:03:31 +0400
committerGaia Clary <gaia.clary@machinimatrix.org>2012-06-24 02:03:31 +0400
commit8ef4c4762be16d9e2f4f3fc274009f294893cd2e (patch)
tree91b39b09726baf52c796db530e707c68a0255a86 /source
parent870dba7657c7cc169a9d98695134f3ee8de8cd5b (diff)
Added option for exporting material based textures. Cleaned up header files due to a bug in osx
Diffstat (limited to 'source')
-rw-r--r--source/blender/collada/EffectExporter.cpp5
-rw-r--r--source/blender/collada/EffectExporter.h2
-rw-r--r--source/blender/collada/ExportSettings.h1
-rw-r--r--source/blender/collada/ImageExporter.cpp6
-rw-r--r--source/blender/collada/ImageExporter.h4
-rw-r--r--source/blender/collada/collada.cpp6
-rw-r--r--source/blender/collada/collada.h5
-rw-r--r--source/blender/editors/io/io_collada.c11
-rw-r--r--source/blender/makesrna/intern/rna_scene_api.c10
9 files changed, 34 insertions, 16 deletions
diff --git a/source/blender/collada/EffectExporter.cpp b/source/blender/collada/EffectExporter.cpp
index aee4f00b31c..f11ecc7f16d 100644
--- a/source/blender/collada/EffectExporter.cpp
+++ b/source/blender/collada/EffectExporter.cpp
@@ -173,7 +173,8 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
{
// create a list of indices to textures of type TEX_IMAGE
std::vector<int> tex_indices;
- createTextureIndices(ma, tex_indices);
+ if(this->export_settings->include_material_textures)
+ createTextureIndices(ma, tex_indices);
openEffect(translate_id(id_name(ma)) + "-effect");
@@ -309,7 +310,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
std::set<Image *> uv_textures;
- if (ob->type == OB_MESH && ob->totcol) {
+ if (ob->type == OB_MESH && ob->totcol && this->export_settings->include_uv_textures) {
Mesh *me = (Mesh *) ob->data;
BKE_mesh_tessface_ensure(me);
for (int i = 0; i < me->pdata.totlayer; i++) {
diff --git a/source/blender/collada/EffectExporter.h b/source/blender/collada/EffectExporter.h
index e20d6b7cd4b..d20cbfdfe0b 100644
--- a/source/blender/collada/EffectExporter.h
+++ b/source/blender/collada/EffectExporter.h
@@ -64,7 +64,7 @@ private:
void writeBlinn(COLLADASW::EffectProfile &ep, Material *ma);
void writeLambert(COLLADASW::EffectProfile &ep, Material *ma);
void writePhong(COLLADASW::EffectProfile &ep, Material *ma);
- void EffectsExporter::writeTextures(COLLADASW::EffectProfile &ep,
+ void writeTextures(COLLADASW::EffectProfile &ep,
std::string &key,
COLLADASW::Sampler *sampler,
MTex *t, Image *ima,
diff --git a/source/blender/collada/ExportSettings.h b/source/blender/collada/ExportSettings.h
index 73f78ebd040..2504c276036 100644
--- a/source/blender/collada/ExportSettings.h
+++ b/source/blender/collada/ExportSettings.h
@@ -41,6 +41,7 @@ public:
bool active_uv_only;
bool include_uv_textures;
+ bool include_material_textures;
bool use_texture_copies;
bool use_object_instantiation;
diff --git a/source/blender/collada/ImageExporter.cpp b/source/blender/collada/ImageExporter.cpp
index d7bcfa8eed1..fbe7111bb58 100644
--- a/source/blender/collada/ImageExporter.cpp
+++ b/source/blender/collada/ImageExporter.cpp
@@ -98,7 +98,7 @@ void ImagesExporter::export_UV_Image(Image *image, bool use_copies)
// So we have to export it. The export will keep the image state intact,
// so the exported file will not be associated with the image.
- if (BKE_imbuf_write_as(imbuf, export_path, &imageFormat, true) != 0) {
+ if (BKE_imbuf_write_as(imbuf, export_path, &imageFormat, true) == 0) {
fprintf(stderr, "Collada export: Cannot export image to:\n%s\n", export_path);
}
BLI_strncpy(export_path, export_file, sizeof(export_path));
@@ -215,7 +215,9 @@ void ImagesExporter::exportImages(Scene *sce)
openLibrary();
MaterialFunctor mf;
- mf.forEachMaterialInExportSet<ImagesExporter>(sce, *this, this->export_settings->export_set);
+ if (this->export_settings->include_material_textures) {
+ mf.forEachMaterialInExportSet<ImagesExporter>(sce, *this, this->export_settings->export_set);
+ }
if (this->export_settings->include_uv_textures) {
export_UV_Images();
diff --git a/source/blender/collada/ImageExporter.h b/source/blender/collada/ImageExporter.h
index c617676cf20..0eaebdd5cdd 100644
--- a/source/blender/collada/ImageExporter.h
+++ b/source/blender/collada/ImageExporter.h
@@ -51,8 +51,8 @@ public:
private:
std::vector<std::string> mImages; // contains list of written images, to avoid duplicates
- void ImagesExporter::export_UV_Images();
- void ImagesExporter::export_UV_Image(Image *image, bool use_texture_copies);
+ void export_UV_Images();
+ void export_UV_Image(Image *image, bool use_texture_copies);
bool hasImages(Scene *sce);
const ExportSettings *export_settings;
};
diff --git a/source/blender/collada/collada.cpp b/source/blender/collada/collada.cpp
index 17be0c46cd3..f7e0f75ec5c 100644
--- a/source/blender/collada/collada.cpp
+++ b/source/blender/collada/collada.cpp
@@ -63,6 +63,7 @@ int collada_export(Scene *sce,
int active_uv_only,
int include_uv_textures,
+ int include_material_textures,
int use_texture_copies,
int use_object_instantiation,
@@ -90,8 +91,9 @@ int collada_export(Scene *sce,
export_settings.deform_bones_only = deform_bones_only != 0;
export_settings.active_uv_only = active_uv_only != 0;
- export_settings.include_uv_textures = include_uv_textures;
- export_settings.use_texture_copies = use_texture_copies;
+ export_settings.include_uv_textures = include_uv_textures != 0;
+ export_settings.include_material_textures= include_material_textures != 0;
+ export_settings.use_texture_copies = use_texture_copies != 0;
export_settings.use_object_instantiation = use_object_instantiation != 0;
export_settings.sort_by_name = sort_by_name != 0;
diff --git a/source/blender/collada/collada.h b/source/blender/collada/collada.h
index d136914e484..13f8151da3d 100644
--- a/source/blender/collada/collada.h
+++ b/source/blender/collada/collada.h
@@ -57,8 +57,9 @@ int collada_export(Scene *sce,
int include_armatures,
int deform_bones_only,
- int active_uv,
- int include_textures,
+ int active_uv_only,
+ int include_uv_textures,
+ int include_material_textures,
int use_texture_copies,
int use_object_instantiation,
diff --git a/source/blender/editors/io/io_collada.c b/source/blender/editors/io/io_collada.c
index 0ceffe19ad8..dca38e53934 100644
--- a/source/blender/editors/io/io_collada.c
+++ b/source/blender/editors/io/io_collada.c
@@ -85,6 +85,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
int deform_bones_only;
int include_uv_textures;
+ int include_material_textures;
int use_texture_copies;
int active_uv_only;
@@ -109,6 +110,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
deform_bones_only = RNA_boolean_get(op->ptr, "deform_bones_only");
include_uv_textures = RNA_boolean_get(op->ptr, "include_uv_textures");
+ include_material_textures= RNA_boolean_get(op->ptr, "include_material_textures");
use_texture_copies = RNA_boolean_get(op->ptr, "use_texture_copies");
active_uv_only = RNA_boolean_get(op->ptr, "active_uv_only");
@@ -129,8 +131,9 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
include_armatures,
deform_bones_only,
- include_uv_textures,
active_uv_only,
+ include_uv_textures,
+ include_material_textures,
use_texture_copies,
use_object_instantiation,
@@ -183,6 +186,9 @@ void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
uiItemR(row, imfptr, "include_uv_textures", 0, NULL, ICON_NONE);
row = uiLayoutRow(box, 0);
+ uiItemR(row, imfptr, "include_material_textures", 0, NULL, ICON_NONE);
+
+ row = uiLayoutRow(box, 0);
uiItemR(row, imfptr, "use_texture_copies", 1, NULL, ICON_NONE);
@@ -267,6 +273,9 @@ void WM_OT_collada_export(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "include_uv_textures", 0, "Include UV Textures",
"Export textures assigned to the object UV maps");
+ RNA_def_boolean(ot->srna, "include_material_textures", 0, "Include Material Textures",
+ "Export textures assigned to the object Materials");
+
RNA_def_boolean(ot->srna, "use_texture_copies", 1, "copy",
"Copy textures to same folder where the .dae file is exported");
diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c
index 7fec46b4837..13b60498900 100644
--- a/source/blender/makesrna/intern/rna_scene_api.c
+++ b/source/blender/makesrna/intern/rna_scene_api.c
@@ -98,7 +98,8 @@ static void rna_Scene_collada_export(
int deform_bones_only,
int active_uv_only,
- int include_textures,
+ int include_uv_textures,
+ int include_material_textures,
int use_texture_copies,
int use_object_instantiation,
@@ -107,8 +108,8 @@ static void rna_Scene_collada_export(
{
collada_export(scene, filepath, apply_modifiers, export_mesh_type, selected,
include_children, include_armatures, deform_bones_only,
- active_uv_only, include_textures, use_texture_copies,
- use_object_instantiation, sort_by_name, second_life);
+ active_uv_only, include_uv_textures, include_material_textures,
+ use_texture_copies, use_object_instantiation, sort_by_name, second_life);
}
#endif
@@ -145,7 +146,8 @@ void RNA_api_scene(StructRNA *srna)
parm = RNA_def_boolean(func, "deform_bones_only", 0, "Deform Bones only", "Only export deforming bones with armatures");
parm = RNA_def_boolean(func, "active_uv_only", 0, "Active UV Layer only", "Export only the active UV Layer");
- parm = RNA_def_boolean(func, "include_textures", 0, "Include Textures", "Export related textures");
+ parm = RNA_def_boolean(func, "include_uv_textures", 0, "Include UV Textures", "Export textures assigned to the object UV maps");
+ parm = RNA_def_boolean(func, "include_material_textures", 0, "Include Material Textures", "Export textures assigned to the object Materials");
parm = RNA_def_boolean(func, "use_texture_copies", 0, "copy", "Copy textures to same folder where the .dae file is exported");
parm = RNA_def_boolean(func, "use_object_instantiation", 1, "Use Object Instances", "Instantiate multiple Objects from same Data");