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-05-24 18:56:09 +0400
committerGaia Clary <gaia.clary@machinimatrix.org>2012-05-24 18:56:09 +0400
commitda67c969b38d748049ddd118a21fa046241739fe (patch)
treed866705bb0ecde30c6cd2f5f647d15b283e113fd /source
parent09344fb1027a03158cf151ec45891ab339c478fc (diff)
Patch #31570: Implementation of 'Include bone children' Option
Diffstat (limited to 'source')
-rw-r--r--source/blender/collada/ExportSettings.h1
-rw-r--r--source/blender/collada/SceneExporter.cpp37
-rw-r--r--source/blender/collada/collada.cpp17
-rw-r--r--source/blender/collada/collada.h8
-rw-r--r--source/blender/makesrna/intern/rna_scene_api.c11
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c24
6 files changed, 68 insertions, 30 deletions
diff --git a/source/blender/collada/ExportSettings.h b/source/blender/collada/ExportSettings.h
index 41fa7e1ed38..b875282ac33 100644
--- a/source/blender/collada/ExportSettings.h
+++ b/source/blender/collada/ExportSettings.h
@@ -32,6 +32,7 @@ struct ExportSettings
public:
bool selected;
bool apply_modifiers;
+ bool include_bone_children;
bool second_life;
char *filepath;
};
diff --git a/source/blender/collada/SceneExporter.cpp b/source/blender/collada/SceneExporter.cpp
index cd36267fd56..f79ae2b52a9 100644
--- a/source/blender/collada/SceneExporter.cpp
+++ b/source/blender/collada/SceneExporter.cpp
@@ -79,25 +79,28 @@ void SceneExporter::writeNodes(Object *ob, Scene *sce)
bool is_skinned_mesh = arm_exporter->is_skinned_mesh(ob);
std::list<Object*> child_objects;
- // list child objects
- Base *b = (Base*) sce->base.first;
- while (b) {
- // cob - child object
- Object *cob = b->object;
-
- if (cob->parent == ob) {
- switch (cob->type) {
- case OB_MESH:
- case OB_CAMERA:
- case OB_LAMP:
- case OB_EMPTY:
- case OB_ARMATURE:
- child_objects.push_back(cob);
- break;
+
+ if (this->export_settings->include_bone_children) {
+ // list child objects
+ Base *b = (Base*) sce->base.first;
+ while (b) {
+ // cob - child object
+ Object *cob = b->object;
+
+ if (cob->parent == ob) {
+ switch (cob->type) {
+ case OB_MESH:
+ case OB_CAMERA:
+ case OB_LAMP:
+ case OB_EMPTY:
+ case OB_ARMATURE:
+ child_objects.push_back(cob);
+ break;
+ }
}
- }
- b = b->next;
+ b = b->next;
+ }
}
diff --git a/source/blender/collada/collada.cpp b/source/blender/collada/collada.cpp
index ae024ec52a7..c947144412a 100644
--- a/source/blender/collada/collada.cpp
+++ b/source/blender/collada/collada.cpp
@@ -49,14 +49,21 @@ extern "C"
return 0;
}
- int collada_export(Scene *sce, const char *filepath, int selected, int apply_modifiers, int second_life)
+ int collada_export(
+ Scene *sce,
+ const char *filepath,
+ int selected,
+ int apply_modifiers,
+ int include_bone_children,
+ int second_life)
{
ExportSettings export_settings;
- export_settings.selected = selected != 0;
- export_settings.apply_modifiers = apply_modifiers != 0;
- export_settings.second_life = second_life != 0;
- export_settings.filepath = (char *)filepath;
+ export_settings.selected = selected != 0;
+ export_settings.apply_modifiers = apply_modifiers != 0;
+ export_settings.include_bone_children = include_bone_children != 0;
+ export_settings.second_life = second_life != 0;
+ export_settings.filepath = (char *)filepath;
/* annoying, collada crashes if file cant be created! [#27162] */
if (!BLI_exists(filepath)) {
diff --git a/source/blender/collada/collada.h b/source/blender/collada/collada.h
index f335796f799..d5c26bb402c 100644
--- a/source/blender/collada/collada.h
+++ b/source/blender/collada/collada.h
@@ -37,7 +37,13 @@ extern "C" {
* both return 1 on success, 0 on error
*/
int collada_import(bContext *C, const char *filepath);
- int collada_export(Scene *sce, const char *filepath, int selected, int apply_modifiers, int second_life);
+ int collada_export(
+ Scene *sce,
+ const char *filepath,
+ int selected,
+ int apply_modifiers,
+ int include_bone_children,
+ int second_life);
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c
index 429f1d48df3..439335e69b4 100644
--- a/source/blender/makesrna/intern/rna_scene_api.c
+++ b/source/blender/makesrna/intern/rna_scene_api.c
@@ -85,9 +85,15 @@ static void rna_SceneRender_get_frame_path(RenderData *rd, int frame, char *name
/* don't remove this, as COLLADA exporting cannot be done through operators in render() callback. */
#include "../../collada/collada.h"
-static void rna_Scene_collada_export(Scene *scene, const char *filepath, int selected, int apply_modifiers, int second_life)
+static void rna_Scene_collada_export(
+ Scene *scene,
+ const char *filepath,
+ int selected,
+ int apply_modifiers,
+ int include_bone_children,
+ int second_life)
{
- collada_export(scene, filepath, selected, apply_modifiers, second_life);
+ collada_export(scene, filepath, selected, apply_modifiers, include_bone_children, second_life);
}
#endif
@@ -117,6 +123,7 @@ void RNA_api_scene(StructRNA *srna)
RNA_def_property_subtype(parm, PROP_FILEPATH); /* allow non utf8 */
parm = RNA_def_boolean(func, "selected", 0, "Selection Only", "Export only selected elements");
parm = RNA_def_boolean(func, "apply_modifiers", 0, "Apply Modifiers", "Apply modifiers (in Preview resolution)");
+ parm = RNA_def_boolean(func, "include_bone_children", 0, "Include Bone Children", "Include all objects attached to bones of selected Armature(s)");
parm = RNA_def_boolean(func, "second_life", 0, "Export for Second Life", "Compatibility mode for Second Life");
RNA_def_function_ui_description(func, "Export to collada file");
#endif
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 4c396d2d6d3..05af3c04573 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -2155,7 +2155,7 @@ static int wm_collada_export_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED
static int wm_collada_export_exec(bContext *C, wmOperator *op)
{
char filename[FILE_MAX];
- int selected, second_life, apply_modifiers;
+ int selected, second_life, apply_modifiers, include_bone_children;
if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
BKE_report(op->reports, RPT_ERROR, "No filename given");
@@ -2165,14 +2165,22 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "filepath", filename);
/* Options panel */
- selected = RNA_boolean_get(op->ptr, "selected");
- second_life = RNA_boolean_get(op->ptr, "second_life");
- apply_modifiers = RNA_boolean_get(op->ptr, "apply_modifiers");
+ selected = RNA_boolean_get(op->ptr, "selected");
+ apply_modifiers = RNA_boolean_get(op->ptr, "apply_modifiers");
+ include_bone_children = RNA_boolean_get(op->ptr, "include_bone_children");
+
+ second_life = RNA_boolean_get(op->ptr, "second_life");
/* get editmode results */
ED_object_exit_editmode(C, 0); /* 0 = does not exit editmode */
- if (collada_export(CTX_data_scene(C), filename, selected, apply_modifiers, second_life)) {
+ if (collada_export(
+ CTX_data_scene(C),
+ filename,
+ selected,
+ apply_modifiers,
+ include_bone_children,
+ second_life)) {
return OPERATOR_FINISHED;
}
else {
@@ -2193,10 +2201,16 @@ static void WM_OT_collada_export(wmOperatorType *ot)
ot->flag |= OPTYPE_PRESET;
WM_operator_properties_filesel(ot, FOLDERFILE | COLLADAFILE, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
+
RNA_def_boolean(ot->srna, "selected", 0, "Selection Only",
"Export only selected elements");
+
RNA_def_boolean(ot->srna, "apply_modifiers", 0, "Apply Modifiers",
"Apply modifiers (Preview Resolution)");
+
+ RNA_def_boolean(ot->srna, "include_bone_children", 0, "Include Bone Children",
+ "Include all objects attached to bones of selected Armature(s)");
+
RNA_def_boolean(ot->srna, "second_life", 0, "Export for Second Life",
"Compatibility mode for Second Life");
}