merge from master
[blender.git] / source / blender / collada / SceneExporter.cpp
index 5a0badf8d3a96aa35899ff3e3bb3d28ca4fb1dff..3a6386a87213f764262ca043a523ca758ec63a43 100644 (file)
@@ -26,6 +26,7 @@
 
 extern "C" {
        #include "BLI_utildefines.h"
+       #include "BKE_group.h"
        #include "BKE_object.h"
        #include "BLI_listbase.h"
 }
@@ -38,17 +39,17 @@ SceneExporter::SceneExporter(COLLADASW::StreamWriter *sw, ArmatureExporter *arm,
 {
 }
 
-void SceneExporter::exportScene(Scene *sce)
+void SceneExporter::exportScene(const EvaluationContext *eval_ctx, Scene *sce)
 {
        // <library_visual_scenes> <visual_scene>
        std::string id_naming = id_name(sce);
        openVisualScene(translate_id(id_naming), id_naming);
-       exportHierarchy(sce);
+       exportHierarchy(eval_ctx, sce);
        closeVisualScene();
        closeLibrary();
 }
 
-void SceneExporter::exportHierarchy(Scene *sce)
+void SceneExporter::exportHierarchy(const EvaluationContext *eval_ctx, Scene *sce)
 {      
        LinkNode *node;
        std::vector<Object *> base_objects;
@@ -80,13 +81,13 @@ void SceneExporter::exportHierarchy(Scene *sce)
                Object *ob = base_objects[index];
                if (bc_is_marked(ob)) {
                        bc_remove_mark(ob);
-                       writeNodes(ob, sce);
+                       writeNodes(eval_ctx, ob, sce);
                }
        }
 }
 
 
-void SceneExporter::writeNodes(Object *ob, Scene *sce)
+void SceneExporter::writeNodes(const EvaluationContext *eval_ctx, Object *ob, Scene *sce)
 {
        // Add associated armature first if available
        bool armature_exported = false;
@@ -95,7 +96,7 @@ void SceneExporter::writeNodes(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(ob_arm, sce);
+                       writeNodes(eval_ctx, ob_arm, sce);
                        armature_exported = true;
                }
        }
@@ -146,10 +147,7 @@ void SceneExporter::writeNodes(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(Object *ob, Scene *sce)
 
        // <instance_controller>
        else if (ob->type == OB_ARMATURE) {
-               arm_exporter->add_armature_bones(ob, sce, this, child_objects);
+               arm_exporter->add_armature_bones(eval_ctx, ob, sce, this, child_objects);
        }
 
        // <instance_camera>
@@ -175,12 +173,13 @@ void SceneExporter::writeNodes(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);
+                       Group *group = ob->dup_group;
+                       /* printf("group detected '%s'\n", group->id.name + 2); */
+                       FOREACH_GROUP_OBJECT(group, object)
+                       {
+                               printf("\t%s\n", object->id.name);
                        }
+                       FOREACH_GROUP_OBJECT_END
                }
        }
 
@@ -235,7 +234,7 @@ void SceneExporter::writeNodes(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(*i, sce);
+                       writeNodes(eval_ctx, *i, sce);
                }
        }