forked from bartvdbraak/blender
COLLADA: Don't write empty libraries for geometry, lights, cameras, controllers
This commit is contained in:
parent
27abad190a
commit
a84e43c48b
@ -987,12 +987,16 @@ void DocumentExporter::exportCurrentScene(Scene *sce, const char* filename)
|
|||||||
asset.add();
|
asset.add();
|
||||||
|
|
||||||
// <library_cameras>
|
// <library_cameras>
|
||||||
|
if(has_object_type(sce, OB_CAMERA)) {
|
||||||
CamerasExporter ce(&sw);
|
CamerasExporter ce(&sw);
|
||||||
ce.exportCameras(sce);
|
ce.exportCameras(sce);
|
||||||
|
}
|
||||||
|
|
||||||
// <library_lights>
|
// <library_lights>
|
||||||
|
if(has_object_type(sce, OB_LAMP)) {
|
||||||
LightsExporter le(&sw);
|
LightsExporter le(&sw);
|
||||||
le.exportLights(sce);
|
le.exportLights(sce);
|
||||||
|
}
|
||||||
|
|
||||||
// <library_images>
|
// <library_images>
|
||||||
ImagesExporter ie(&sw, filename);
|
ImagesExporter ie(&sw, filename);
|
||||||
@ -1007,8 +1011,10 @@ void DocumentExporter::exportCurrentScene(Scene *sce, const char* filename)
|
|||||||
me.exportMaterials(sce);
|
me.exportMaterials(sce);
|
||||||
|
|
||||||
// <library_geometries>
|
// <library_geometries>
|
||||||
|
if(has_object_type(sce, OB_MESH)) {
|
||||||
GeometryExporter ge(&sw);
|
GeometryExporter ge(&sw);
|
||||||
ge.exportGeom(sce);
|
ge.exportGeom(sce);
|
||||||
|
}
|
||||||
|
|
||||||
// <library_animations>
|
// <library_animations>
|
||||||
AnimationExporter ae(&sw);
|
AnimationExporter ae(&sw);
|
||||||
@ -1016,7 +1022,9 @@ void DocumentExporter::exportCurrentScene(Scene *sce, const char* filename)
|
|||||||
|
|
||||||
// <library_controllers>
|
// <library_controllers>
|
||||||
ArmatureExporter arm_exporter(&sw);
|
ArmatureExporter arm_exporter(&sw);
|
||||||
|
if(has_object_type(sce, OB_ARMATURE)) {
|
||||||
arm_exporter.export_controllers(sce);
|
arm_exporter.export_controllers(sce);
|
||||||
|
}
|
||||||
|
|
||||||
// <library_visual_scenes>
|
// <library_visual_scenes>
|
||||||
SceneExporter se(&sw, &arm_exporter);
|
SceneExporter se(&sw, &arm_exporter);
|
||||||
|
@ -277,3 +277,17 @@ std::string get_material_id(Material *mat)
|
|||||||
{
|
{
|
||||||
return translate_id(id_name(mat)) + "-material";
|
return translate_id(id_name(mat)) + "-material";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool has_object_type(Scene *sce, short obtype)
|
||||||
|
{
|
||||||
|
Base *base= (Base*) sce->base.first;
|
||||||
|
while(base) {
|
||||||
|
Object *ob = base->object;
|
||||||
|
|
||||||
|
if (ob->type == obtype && ob->data) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
base= base->next;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
#include "DNA_armature_types.h"
|
#include "DNA_armature_types.h"
|
||||||
#include "DNA_material_types.h"
|
#include "DNA_material_types.h"
|
||||||
#include "DNA_object_types.h"
|
#include "DNA_object_types.h"
|
||||||
|
#include "DNA_scene_types.h"
|
||||||
#include "BLI_math.h"
|
#include "BLI_math.h"
|
||||||
|
|
||||||
class UnitConverter
|
class UnitConverter
|
||||||
@ -97,4 +98,6 @@ extern std::string get_camera_id(Object *ob);
|
|||||||
|
|
||||||
extern std::string get_material_id(Material *mat);
|
extern std::string get_material_id(Material *mat);
|
||||||
|
|
||||||
|
extern bool has_object_type(Scene* sce, short obtype);
|
||||||
|
|
||||||
#endif /* COLLADA_INTERNAL_H */
|
#endif /* COLLADA_INTERNAL_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user