diff options
Diffstat (limited to 'source/blender/collada/SceneExporter.cpp')
-rw-r--r-- | source/blender/collada/SceneExporter.cpp | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/source/blender/collada/SceneExporter.cpp b/source/blender/collada/SceneExporter.cpp index 4e08548449f..d909203488e 100644 --- a/source/blender/collada/SceneExporter.cpp +++ b/source/blender/collada/SceneExporter.cpp @@ -26,6 +26,7 @@ extern "C" { #include "BLI_utildefines.h" + #include "BKE_collection.h" #include "BKE_object.h" #include "BLI_listbase.h" } @@ -38,17 +39,17 @@ SceneExporter::SceneExporter(COLLADASW::StreamWriter *sw, ArmatureExporter *arm, { } -void SceneExporter::exportScene(bContext *C, Scene *sce) +void SceneExporter::exportScene(bContext *C, Depsgraph *depsgraph, Scene *sce) { // <library_visual_scenes> <visual_scene> std::string id_naming = id_name(sce); openVisualScene(translate_id(id_naming), id_naming); - exportHierarchy(C, sce); + exportHierarchy(C, depsgraph, sce); closeVisualScene(); closeLibrary(); } -void SceneExporter::exportHierarchy(bContext *C, Scene *sce) +void SceneExporter::exportHierarchy(bContext *C, Depsgraph *depsgraph, Scene *sce) { LinkNode *node; std::vector<Object *> base_objects; @@ -80,13 +81,13 @@ void SceneExporter::exportHierarchy(bContext *C, Scene *sce) Object *ob = base_objects[index]; if (bc_is_marked(ob)) { bc_remove_mark(ob); - writeNodes(C, ob, sce); + writeNodes(C, depsgraph, ob, sce); } } } -void SceneExporter::writeNodes(bContext *C, Object *ob, Scene *sce) +void SceneExporter::writeNodes(bContext *C, Depsgraph *depsgraph, Object *ob, Scene *sce) { // Add associated armature first if available bool armature_exported = false; @@ -95,7 +96,7 @@ void SceneExporter::writeNodes(bContext *C, Object *ob, Scene *sce) armature_exported = bc_is_in_Export_set(this->export_settings->export_set, ob_arm); if (armature_exported && bc_is_marked(ob_arm)) { bc_remove_mark(ob_arm); - writeNodes(C, ob_arm, sce); + writeNodes(C, depsgraph, ob_arm, sce); armature_exported = true; } } @@ -146,10 +147,7 @@ void SceneExporter::writeNodes(bContext *C, Object *ob, Scene *sce) COLLADASW::InstanceGeometry instGeom(mSW); instGeom.setUrl(COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, get_geometry_id(ob, this->export_settings->use_object_instantiation))); instGeom.setName(translate_id(id_name(ob))); - InstanceWriter::add_material_bindings(instGeom.getBindMaterial(), - ob, - this->export_settings->active_uv_only, - this->export_settings->export_texture_type); + InstanceWriter::add_material_bindings(instGeom.getBindMaterial(), ob, this->export_settings->active_uv_only); instGeom.add(); } @@ -157,7 +155,7 @@ void SceneExporter::writeNodes(bContext *C, Object *ob, Scene *sce) // <instance_controller> else if (ob->type == OB_ARMATURE) { - arm_exporter->add_armature_bones(C, ob, sce, this, child_objects); + arm_exporter->add_armature_bones(C, depsgraph, ob, sce, this, child_objects); } // <instance_camera> @@ -173,14 +171,15 @@ void SceneExporter::writeNodes(bContext *C, Object *ob, Scene *sce) } // empty object - else if (ob->type == OB_EMPTY) { // TODO: handle groups (OB_DUPLIGROUP - if ((ob->transflag & OB_DUPLIGROUP) == OB_DUPLIGROUP && ob->dup_group) { - GroupObject *go = NULL; - Group *gr = ob->dup_group; - /* printf("group detected '%s'\n", gr->id.name + 2); */ - for (go = (GroupObject *)(gr->gobject.first); go; go = go->next) { - printf("\t%s\n", go->ob->id.name); + else if (ob->type == OB_EMPTY) { // TODO: handle groups (OB_DUPLICOLLECTION + if ((ob->transflag & OB_DUPLICOLLECTION) == OB_DUPLICOLLECTION && ob->dup_group) { + Collection *collection = ob->dup_group; + /* printf("group detected '%s'\n", group->id.name + 2); */ + FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(collection, object) + { + printf("\t%s\n", object->id.name); } + FOREACH_COLLECTION_OBJECT_RECURSIVE_END; } } @@ -235,7 +234,7 @@ void SceneExporter::writeNodes(bContext *C, Object *ob, Scene *sce) for (std::list<Object *>::iterator i = child_objects.begin(); i != child_objects.end(); ++i) { if (bc_is_marked(*i)) { bc_remove_mark(*i); - writeNodes(C, *i, sce); + writeNodes(C, depsgraph, *i, sce); } } |