diff options
author | Nathan Letwory <nathan@letworyinteractive.com> | 2011-07-04 12:59:28 +0400 |
---|---|---|
committer | Nathan Letwory <nathan@letworyinteractive.com> | 2011-07-04 12:59:28 +0400 |
commit | cf43e48fc781611c0850e09dae6f6fa1c95cc28b (patch) | |
tree | d6a786c92891eae9482da7b80724b15ca2fa831c /source/blender/collada/DocumentExporter.cpp | |
parent | aa1668c6f8a70e41b97b67f31647dbec382e19f7 (diff) |
Apply patch 4636051. COLLADA: Export selection.
Original patch by Jan Diederich, adapted by Pelle Johnsen. Review assistance by Daniel Tavares.
This patch adds an option to export only the selection.
Diffstat (limited to 'source/blender/collada/DocumentExporter.cpp')
-rw-r--r-- | source/blender/collada/DocumentExporter.cpp | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp index 00daac60281..e6e0953680c 100644 --- a/source/blender/collada/DocumentExporter.cpp +++ b/source/blender/collada/DocumentExporter.cpp @@ -170,7 +170,7 @@ public: SceneExporter(COLLADASW::StreamWriter *sw, ArmatureExporter *arm) : COLLADASW::LibraryVisualScenes(sw), arm_exporter(arm) {} - void exportScene(Scene *sce) { + void exportScene(Scene *sce, bool export_selected) { // <library_visual_scenes> <visual_scene> std::string id_naming = id_name(sce); openVisualScene(translate_id(id_naming), id_naming); @@ -179,7 +179,7 @@ public: //forEachMeshObjectInScene(sce, *this); //forEachCameraObjectInScene(sce, *this); //forEachLampObjectInScene(sce, *this); - exportHierarchy(sce); + exportHierarchy(sce, export_selected); // </visual_scene> </library_visual_scenes> closeVisualScene(); @@ -187,7 +187,7 @@ public: closeLibrary(); } - void exportHierarchy(Scene *sce) + void exportHierarchy(Scene *sce, bool export_selected) { Base *base= (Base*) sce->base.first; while(base) { @@ -198,8 +198,11 @@ public: case OB_MESH: case OB_CAMERA: case OB_LAMP: - case OB_EMPTY: case OB_ARMATURE: + case OB_EMPTY: + if (export_selected && !(ob->flag & SELECT)) { + break; + } // write nodes.... writeNodes(ob, sce); break; @@ -929,7 +932,7 @@ protected: } }; -void DocumentExporter::exportCurrentScene(Scene *sce, const char* filename) +void DocumentExporter::exportCurrentScene(Scene *sce, const char* filename, bool selected) { PointerRNA sceneptr, unit_settings; PropertyRNA *system; /* unused , *scale; */ @@ -1011,31 +1014,31 @@ void DocumentExporter::exportCurrentScene(Scene *sce, const char* filename) // <library_cameras> if(has_object_type(sce, OB_CAMERA)) { CamerasExporter ce(&sw); - ce.exportCameras(sce); + ce.exportCameras(sce, selected); } // <library_lights> if(has_object_type(sce, OB_LAMP)) { LightsExporter le(&sw); - le.exportLights(sce); + le.exportLights(sce, selected); } // <library_images> ImagesExporter ie(&sw, filename); - ie.exportImages(sce); + ie.exportImages(sce, selected); // <library_effects> EffectsExporter ee(&sw); - ee.exportEffects(sce); + ee.exportEffects(sce, selected); // <library_materials> MaterialsExporter me(&sw); - me.exportMaterials(sce); + me.exportMaterials(sce, selected); // <library_geometries> if(has_object_type(sce, OB_MESH)) { GeometryExporter ge(&sw); - ge.exportGeom(sce); + ge.exportGeom(sce, selected); } // <library_animations> @@ -1045,12 +1048,12 @@ void DocumentExporter::exportCurrentScene(Scene *sce, const char* filename) // <library_controllers> ArmatureExporter arm_exporter(&sw); if(has_object_type(sce, OB_ARMATURE)) { - arm_exporter.export_controllers(sce); + arm_exporter.export_controllers(sce, selected); } // <library_visual_scenes> SceneExporter se(&sw, &arm_exporter); - se.exportScene(sce); + se.exportScene(sce, selected); // <scene> std::string scene_name(translate_id(id_name(sce))); |