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
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/collada/CameraExporter.cpp')
-rw-r--r--source/blender/collada/CameraExporter.cpp67
1 files changed, 34 insertions, 33 deletions
diff --git a/source/blender/collada/CameraExporter.cpp b/source/blender/collada/CameraExporter.cpp
index ce46c681c8c..be424fbbb4d 100644
--- a/source/blender/collada/CameraExporter.cpp
+++ b/source/blender/collada/CameraExporter.cpp
@@ -29,27 +29,27 @@
#include <string>
#include "COLLADASWCamera.h"
-#include "COLLADASWCameraOptic.h"
+extern "C" {
#include "DNA_camera_types.h"
-
+}
#include "CameraExporter.h"
#include "collada_internal.h"
-CamerasExporter::CamerasExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings): COLLADASW::LibraryCameras(sw), export_settings(export_settings) {}
+CamerasExporter::CamerasExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) : COLLADASW::LibraryCameras(sw), export_settings(export_settings) {
+}
template<class Functor>
-void forEachCameraObjectInScene(Scene *sce, Functor &f, bool export_selected)
+void forEachCameraObjectInExportSet(Scene *sce, Functor &f, LinkNode *export_set)
{
- Base *base = (Base*) sce->base.first;
- while (base) {
- Object *ob = base->object;
+ LinkNode *node;
+ for (node = export_set; node; node = node->next) {
+ Object *ob = (Object *)node->link;
- if (ob->type == OB_CAMERA && ob->data && !(export_selected && !(ob->flag & SELECT))) {
+ if (ob->type == OB_CAMERA && ob->data) {
f(ob, sce);
}
- base = base->next;
}
}
@@ -57,39 +57,40 @@ void CamerasExporter::exportCameras(Scene *sce)
{
openLibrary();
- forEachCameraObjectInScene(sce, *this, this->export_settings->selected);
+ forEachCameraObjectInExportSet(sce, *this, this->export_settings->export_set);
closeLibrary();
}
void CamerasExporter::operator()(Object *ob, Scene *sce)
{
// TODO: shiftx, shifty, YF_dofdist
- Camera *cam = (Camera*)ob->data;
+ Camera *cam = (Camera *)ob->data;
std::string cam_id(get_camera_id(ob));
std::string cam_name(id_name(cam));
switch (cam->type) {
- case CAM_PANO:
- case CAM_PERSP: {
- COLLADASW::PerspectiveOptic persp(mSW);
- persp.setXFov(RAD2DEGF(focallength_to_fov(cam->lens, cam->sensor_x)), "xfov");
- persp.setAspectRatio((float)(sce->r.xsch)/(float)(sce->r.ysch), false, "aspect_ratio");
- persp.setZFar(cam->clipend, false, "zfar");
- persp.setZNear(cam->clipsta, false, "znear");
- COLLADASW::Camera ccam(mSW, &persp, cam_id, cam_name);
- addCamera(ccam);
- break;
+ case CAM_PANO:
+ case CAM_PERSP: {
+ COLLADASW::PerspectiveOptic persp(mSW);
+ persp.setXFov(RAD2DEGF(focallength_to_fov(cam->lens, cam->sensor_x)), "xfov");
+ persp.setAspectRatio((float)(sce->r.xsch) / (float)(sce->r.ysch), false, "aspect_ratio");
+ persp.setZFar(cam->clipend, false, "zfar");
+ persp.setZNear(cam->clipsta, false, "znear");
+ COLLADASW::Camera ccam(mSW, &persp, cam_id, cam_name);
+ addCamera(ccam);
+ break;
+ }
+ case CAM_ORTHO:
+ default:
+ {
+ COLLADASW::OrthographicOptic ortho(mSW);
+ ortho.setXMag(cam->ortho_scale, "xmag");
+ ortho.setAspectRatio((float)(sce->r.xsch) / (float)(sce->r.ysch), false, "aspect_ratio");
+ ortho.setZFar(cam->clipend, false, "zfar");
+ ortho.setZNear(cam->clipsta, false, "znear");
+ COLLADASW::Camera ccam(mSW, &ortho, cam_id, cam_name);
+ addCamera(ccam);
+ break;
+ }
}
- case CAM_ORTHO:
- default:
- {
- COLLADASW::OrthographicOptic ortho(mSW);
- ortho.setXMag(cam->ortho_scale, "xmag");
- ortho.setAspectRatio((float)(sce->r.xsch)/(float)(sce->r.ysch), false, "aspect_ratio");
- ortho.setZFar(cam->clipend, false, "zfar");
- ortho.setZNear(cam->clipsta, false, "znear");
- COLLADASW::Camera ccam(mSW, &ortho, cam_id, cam_name);
- addCamera(ccam);
- break;
- }}
}