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-17 03:35:53 +0400
committerGaia Clary <gaia.clary@machinimatrix.org>2012-06-17 03:35:53 +0400
commit0df30d1063cc185770451b3b2ebf3fcd0341c642 (patch)
tree3f2a1a8afb1762bc2cbc6504bcd05282b622779b /source
parentb5b830668560a7733ddd3609ba96e845aa63546b (diff)
Collada: (Exporter) add 'mesh type selection(view|render)' for Apply modifiers option
Diffstat (limited to 'source')
-rw-r--r--source/blender/collada/ArmatureExporter.cpp2
-rw-r--r--source/blender/collada/ExportSettings.h7
-rw-r--r--source/blender/collada/GeometryExporter.cpp2
-rw-r--r--source/blender/collada/collada.cpp6
-rw-r--r--source/blender/collada/collada.h23
-rw-r--r--source/blender/collada/collada_utils.cpp15
-rw-r--r--source/blender/collada/collada_utils.h2
-rw-r--r--source/blender/makesrna/intern/rna_scene_api.c8
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c27
9 files changed, 72 insertions, 20 deletions
diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp
index 8842a4b1ac5..9ac943f369c 100644
--- a/source/blender/collada/ArmatureExporter.cpp
+++ b/source/blender/collada/ArmatureExporter.cpp
@@ -345,7 +345,7 @@ void ArmatureExporter::export_controller(Object *ob, Object *ob_arm)
Mesh *me;
if (this->export_settings->apply_modifiers) {
- me = bc_to_mesh_apply_modifiers(scene, ob);
+ me = bc_to_mesh_apply_modifiers(scene, ob, this->export_settings->export_mesh_type);
}
else {
me = (Mesh *)ob->data;
diff --git a/source/blender/collada/ExportSettings.h b/source/blender/collada/ExportSettings.h
index d0985a27a70..1b2dfde641b 100644
--- a/source/blender/collada/ExportSettings.h
+++ b/source/blender/collada/ExportSettings.h
@@ -24,16 +24,15 @@
* \ingroup collada
*/
-extern "C" {
-#include "BLI_linklist.h"
-}
-
#ifndef __EXPORTSETTINGS_H__
#define __EXPORTSETTINGS_H__
+#include "collada.h"
+
struct ExportSettings {
public:
bool apply_modifiers;
+ BC_export_mesh_type export_mesh_type;
bool selected;
bool include_children;
bool include_armatures;
diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp
index 94b977ca01c..baa20ab07b7 100644
--- a/source/blender/collada/GeometryExporter.cpp
+++ b/source/blender/collada/GeometryExporter.cpp
@@ -78,7 +78,7 @@ void GeometryExporter::operator()(Object *ob)
bool use_instantiation = this->export_settings->use_object_instantiation;
Mesh *me;
if (this->export_settings->apply_modifiers) {
- me = bc_to_mesh_apply_modifiers(mScene, ob);
+ me = bc_to_mesh_apply_modifiers(mScene, ob, this->export_settings->export_mesh_type);
}
else {
me = (Mesh *)ob->data;
diff --git a/source/blender/collada/collada.cpp b/source/blender/collada/collada.cpp
index 74f140e4813..da1ca6c30c8 100644
--- a/source/blender/collada/collada.cpp
+++ b/source/blender/collada/collada.cpp
@@ -28,9 +28,9 @@
/* COLLADABU_ASSERT, may be able to remove later */
#include "COLLADABUPlatform.h"
-#include "ExportSettings.h"
#include "DocumentExporter.h"
#include "DocumentImporter.h"
+#include "ExportSettings.h"
extern "C"
{
@@ -40,6 +40,7 @@ extern "C"
/* make dummy file */
#include "BLI_fileops.h"
#include "BLI_path_util.h"
+#include "BLI_linklist.h"
int collada_import(bContext *C, const char *filepath)
{
@@ -53,6 +54,7 @@ int collada_export(Scene *sce,
const char *filepath,
int apply_modifiers,
+ BC_export_mesh_type export_mesh_type,
int selected,
int include_children,
@@ -77,7 +79,7 @@ int collada_export(Scene *sce,
export_settings.filepath = (char *)filepath;
export_settings.apply_modifiers = apply_modifiers != 0;
-
+ export_settings.export_mesh_type = export_mesh_type;
export_settings.selected = selected != 0;
export_settings.include_children = include_children != 0;
export_settings.include_armatures = include_armatures != 0;
diff --git a/source/blender/collada/collada.h b/source/blender/collada/collada.h
index e38f38b627a..4261e31c413 100644
--- a/source/blender/collada/collada.h
+++ b/source/blender/collada/collada.h
@@ -27,12 +27,28 @@
#ifndef __COLLADA_H__
#define __COLLADA_H__
-struct bContext;
-struct Scene;
-
+#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
+
+#include "BLI_linklist.h"
+#include "RNA_types.h"
+
+typedef enum BC_export_mesh_type {
+ BC_MESH_TYPE_VIEW,
+ BC_MESH_TYPE_RENDER,
+} BC_export_mesh_type;
+
+static EnumPropertyItem prop_bc_export_mesh_type[] = {
+ {BC_MESH_TYPE_VIEW, "view", 0, "View", "Apply modifier's view settings"},
+ {BC_MESH_TYPE_RENDER, "render", 0, "Render", "Apply modifier's render settings"},
+ {0, NULL, 0, NULL, NULL}
+};
+
+struct bContext;
+struct Scene;
+
/*
* both return 1 on success, 0 on error
*/
@@ -40,6 +56,7 @@ int collada_import(bContext *C, const char *filepath);
int collada_export(Scene *sce,
const char *filepath,
int apply_modifiers,
+ BC_export_mesh_type export_mesh_type,
int selected,
int include_children,
diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp
index 0d17c89ea30..cf7c9e49b63 100644
--- a/source/blender/collada/collada_utils.cpp
+++ b/source/blender/collada/collada_utils.cpp
@@ -138,11 +138,22 @@ Object *bc_add_object(Scene *scene, int type, const char *name)
return ob;
}
-Mesh *bc_to_mesh_apply_modifiers(Scene *scene, Object *ob)
+Mesh *bc_to_mesh_apply_modifiers(Scene *scene, Object *ob, BC_export_mesh_type export_mesh_type)
{
Mesh *tmpmesh;
CustomDataMask mask = CD_MASK_MESH;
- DerivedMesh *dm = mesh_create_derived_view(scene, ob, mask);
+ DerivedMesh *dm;
+ switch (export_mesh_type) {
+ case BC_MESH_TYPE_VIEW: {
+ dm = mesh_create_derived_view(scene, ob, mask);
+ break;
+ }
+ case BC_MESH_TYPE_RENDER: {
+ dm = mesh_create_derived_render(scene, ob, mask);
+ break;
+ }
+ }
+
tmpmesh = BKE_mesh_add("ColladaMesh"); // name is not important here
DM_to_mesh(dm, tmpmesh, ob);
dm->release(dm);
diff --git a/source/blender/collada/collada_utils.h b/source/blender/collada/collada_utils.h
index 5f1ce0ce6d9..ab0b7421aa1 100644
--- a/source/blender/collada/collada_utils.h
+++ b/source/blender/collada/collada_utils.h
@@ -57,7 +57,7 @@ extern float bc_get_float_value(const COLLADAFW::FloatOrDoubleArray& array, unsi
extern int bc_test_parent_loop(Object *par, Object *ob);
extern int bc_set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space = true);
extern Object *bc_add_object(Scene *scene, int type, const char *name);
-extern Mesh *bc_to_mesh_apply_modifiers(Scene *scene, Object *ob);
+extern Mesh *bc_to_mesh_apply_modifiers(Scene *scene, Object *ob, BC_export_mesh_type export_mesh_type);
extern Object *bc_get_assigned_armature(Object *ob);
extern Object *bc_get_highest_selected_ancestor_or_self(LinkNode *export_set, Object *ob);
diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c
index a1199f95c13..d4611f4a268 100644
--- a/source/blender/makesrna/intern/rna_scene_api.c
+++ b/source/blender/makesrna/intern/rna_scene_api.c
@@ -39,6 +39,7 @@
#include "DNA_scene_types.h"
#include "BKE_utildefines.h"
+
#ifdef RNA_RUNTIME
#include "BKE_animsys.h"
@@ -89,6 +90,7 @@ static void rna_Scene_collada_export(
Scene *scene,
const char *filepath,
int apply_modifiers,
+ int export_mesh_type,
int selected,
int include_children,
int include_armatures,
@@ -97,7 +99,7 @@ static void rna_Scene_collada_export(
int sort_by_name,
int second_life)
{
- collada_export(scene, filepath, apply_modifiers, selected,
+ collada_export(scene, filepath, apply_modifiers, export_mesh_type, selected,
include_children, include_armatures, deform_bones_only,
use_object_instantiation, sort_by_name, second_life);
}
@@ -127,7 +129,9 @@ void RNA_api_scene(StructRNA *srna)
parm = RNA_def_string(func, "filepath", "", FILE_MAX, "File Path", "File path to write Collada file");
RNA_def_property_flag(parm, PROP_REQUIRED);
RNA_def_property_subtype(parm, PROP_FILEPATH); /* allow non utf8 */
- parm = RNA_def_boolean(func, "apply_modifiers", 0, "Apply Modifiers", "Apply modifiers (in Preview resolution)");
+ parm = RNA_def_boolean(func, "apply_modifiers", 0, "Apply Modifiers", "Apply modifiers");
+ parm = RNA_def_int(func, "export_mesh_type", 0, INT_MIN, INT_MAX,
+ "Resolution", "Modifier resolution for export", INT_MIN, INT_MAX);
parm = RNA_def_boolean(func, "selected", 0, "Selection Only", "Export only selected elements");
parm = RNA_def_boolean(func, "include_children", 0, "Include Children", "Export all children of selected objects (even if not selected)");
parm = RNA_def_boolean(func, "include_armatures", 0, "Include Armatures", "Export related armatures (even if not selected)");
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 4992fa16f8e..696def2cebe 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -2163,6 +2163,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
{
char filepath[FILE_MAX];
int apply_modifiers;
+ int export_mesh_type;
int selected;
int include_children;
int include_armatures;
@@ -2181,6 +2182,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
/* Options panel */
apply_modifiers = RNA_boolean_get(op->ptr, "apply_modifiers");
+ export_mesh_type = RNA_enum_get(op->ptr, "export_mesh_type_selection");
selected = RNA_boolean_get(op->ptr, "selected");
include_children = RNA_boolean_get(op->ptr, "include_children");
include_armatures = RNA_boolean_get(op->ptr, "include_armatures");
@@ -2196,6 +2198,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
CTX_data_scene(C),
filepath,
apply_modifiers,
+ export_mesh_type,
selected,
include_children,
include_armatures,
@@ -2213,7 +2216,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
{
- uiLayout *box, *row;
+ uiLayout *box, *row, *col, *sub, *split;
// Export Options:
box = uiLayoutBox(layout);
@@ -2221,17 +2224,28 @@ void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
uiItemL(row, IFACE_("Export Data Options:"), ICON_MESH_DATA);
row = uiLayoutRow(box, 0);
- uiItemR(row, imfptr, "apply_modifiers", 0, NULL, ICON_NONE);
+ col = uiLayoutColumn(row, 0);
+ split = uiLayoutSplit(col, 0.5f, 0);
+ uiItemR(split, imfptr, "apply_modifiers", 0, NULL, ICON_NONE);
+ sub = uiLayoutRow(split, 0);
+ uiItemR(sub, imfptr, "export_mesh_type_selection", UI_ITEM_R_EXPAND, IFACE_("Color"), ICON_NONE);
+ uiLayoutSetEnabled(sub, RNA_boolean_get(imfptr, "apply_modifiers"));
row = uiLayoutRow(box, 0);
uiItemR(row, imfptr, "selected", 0, NULL, ICON_NONE);
row = uiLayoutRow(box, 0);
- uiItemR(row, imfptr, "include_children", 0, NULL, ICON_NONE);
+ col = uiLayoutColumn(row, 0);
+ split = uiLayoutSplit(col, 0.1f, 0);
+ sub = uiLayoutRow(split, 0);
+ uiItemR(split, imfptr, "include_children", 0, NULL, ICON_NONE);
uiLayoutSetEnabled(row, RNA_boolean_get(imfptr, "selected"));
row = uiLayoutRow(box, 0);
- uiItemR(row, imfptr, "include_armatures", 0, NULL, ICON_NONE);
+ col = uiLayoutColumn(row, 0);
+ split = uiLayoutSplit(col, 0.1f, 0);
+ sub = uiLayoutRow(split, 0);
+ uiItemR(split, imfptr, "include_armatures", 0, NULL, ICON_NONE);
uiLayoutSetEnabled(row, RNA_boolean_get(imfptr, "selected"));
row = uiLayoutRow(box, 0);
@@ -2278,6 +2292,11 @@ static void WM_OT_collada_export(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "apply_modifiers", 0, "Apply Modifiers",
"Apply modifiers (Preview Resolution)");
+ RNA_def_int(ot->srna, "export_mesh_type", 0, INT_MIN, INT_MAX,
+ "Resolution", "Modifier resolution for export", INT_MIN, INT_MAX);
+
+ RNA_def_enum(ot->srna, "export_mesh_type_selection", prop_bc_export_mesh_type,
+ 0, "Resolution", "Modifier resolution for export");
RNA_def_boolean(ot->srna, "selected", 0, "Selection Only",
"Export only selected elements");