diff options
author | Sukhitha Prabhath Jayathilake <pr.jayathilake@gmail.com> | 2011-07-09 23:33:02 +0400 |
---|---|---|
committer | Sukhitha Prabhath Jayathilake <pr.jayathilake@gmail.com> | 2011-07-09 23:33:02 +0400 |
commit | daddbc62df5f8ade39b25acd4e333c5c3bd88b5a (patch) | |
tree | 821f4c9e83110e7db0517e279e435758f0fd2688 /source | |
parent | eb452225cec986e44f049d0cd42e862be13e4126 (diff) |
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/collada/AnimationImporter.cpp | 91 | ||||
-rw-r--r-- | source/blender/collada/AnimationImporter.h | 13 | ||||
-rw-r--r-- | source/blender/collada/CameraExporter.cpp | 4 |
3 files changed, 65 insertions, 43 deletions
diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index 5f4d4905646..030b9e7582b 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -919,28 +919,30 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD for (unsigned int i = 0; i < nodeLights.getCount(); i++) { const COLLADAFW::Light *light = (COLLADAFW::Light *) FW_object_map[nodeLights[i]->getInstanciatedObjectId()]; + // + //const COLLADAFW::Color *col = &(light->getColor()); + //const COLLADAFW::UniqueId& col_listid = col->getAnimationList(); + + ////check if color has animations + //if (animlist_map.find(col_listid) != animlist_map.end()) + //// type = type|LIGHT_FOA; + // types->light = types->light|LIGHT_COLOR; + types->light = setAnimType(&(light->getColor()),(types->light), LIGHT_COLOR); + // + //const COLLADAFW::AnimatableFloat *fallOffAngle = &(light->getFallOffAngle()); + // const COLLADAFW::UniqueId& foa_listid = fallOffAngle ->getAnimationList(); + + //if (animlist_map.find(foa_listid) != animlist_map.end()) + //// type = type|LIGHT_FOA; + // types->light = types->light|LIGHT_FOA; + types->light = setAnimType(&(light->getFallOffAngle()),(types->light), LIGHT_FOA); + //const COLLADAFW::AnimatableFloat *fallOffExpo = &(light->getFallOffExponent()); + // const COLLADAFW::UniqueId& foe_listid = fallOffExpo ->getAnimationList(); + //if (animlist_map.find(foe_listid) != animlist_map.end()) + // //type = type|LIGHT_FOE; + // types->light = types->light|LIGHT_FOE; - const COLLADAFW::Color *col = &(light->getColor()); - const COLLADAFW::UniqueId& col_listid = col->getAnimationList(); - - //check if color has animations - if (animlist_map.find(col_listid) != animlist_map.end()) - // type = type|LIGHT_FOA; - types->light = types->light|LIGHT_COLOR; - - const COLLADAFW::AnimatableFloat *fallOffAngle = &(light->getFallOffAngle()); - const COLLADAFW::UniqueId& foa_listid = fallOffAngle ->getAnimationList(); - - if (animlist_map.find(foa_listid) != animlist_map.end()) - // type = type|LIGHT_FOA; - types->light = types->light|LIGHT_FOA; - - const COLLADAFW::AnimatableFloat *fallOffExpo = &(light->getFallOffExponent()); - const COLLADAFW::UniqueId& foe_listid = fallOffExpo ->getAnimationList(); - - if (animlist_map.find(foe_listid) != animlist_map.end()) - //type = type|LIGHT_FOE; - types->light = types->light|LIGHT_FOE; + types->light = setAnimType(&(light->getFallOffExponent()),(types->light), LIGHT_FOE); //if ( type != 0) break; if ( types->light != 0) break; @@ -950,24 +952,37 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD const COLLADAFW::InstanceCameraPointerArray& nodeCameras = node->getInstanceCameras(); for (unsigned int i = 0; i < nodeCameras.getCount(); i++) { const COLLADAFW::Camera *camera = (COLLADAFW::Camera *) FW_object_map[nodeCameras[i]->getInstanciatedObjectId()]; - + + if ( camera->getCameraType() == COLLADAFW::Camera::PERSPECTIVE ) { - const COLLADAFW::AnimatableFloat *xfov = &(camera->getXFov()); - const COLLADAFW::UniqueId& xfov_listid = xfov ->getAnimationList(); - if (animlist_map.find(xfov_listid) != animlist_map.end()) - //type = type|CAMERA_XFOV; - types->camera = types->camera|CAMERA_XFOV; - + //const COLLADAFW::AnimatableFloat *xfov = &(camera->getXFov()); + //const COLLADAFW::UniqueId& xfov_listid = xfov ->getAnimationList(); + //if (animlist_map.find(xfov_listid) != animlist_map.end()) + // //type = type|CAMERA_XFOV; + // types->camera = types->camera|CAMERA_XFOV; + types->camera = setAnimType(&(camera->getXMag()),(types->camera), CAMERA_XFOV); } else { - const COLLADAFW::AnimatableFloat *xmag = &(camera->getXMag()); - const COLLADAFW::UniqueId& xmag_listid = xmag ->getAnimationList(); - if (animlist_map.find(xmag_listid) != animlist_map.end()) - // type = type|CAMERA_XMAG; - types->camera = types->camera|CAMERA_XMAG; - } + //const COLLADAFW::AnimatableFloat *xmag = &(camera->getXMag()); + //const COLLADAFW::UniqueId& xmag_listid = xmag ->getAnimationList(); + //if (animlist_map.find(xmag_listid) != animlist_map.end()) + // // type = type|CAMERA_XMAG; + // types->camera = types->camera|CAMERA_XMAG; + types->camera = setAnimType(&(camera->getXMag()),(types->camera), CAMERA_XMAG); + } + + //const COLLADAFW::AnimatableFloat *zfar = &(camera->getFarClippingPlane()); + //const COLLADAFW::UniqueId& zfar_listid = zfar ->getAnimationList(); + //if (animlist_map.find(zfar_listid) != animlist_map.end()) + // //type = type|CAMERA_XFOV; + // types->camera = types->camera|CAMERA_ZFAR; + + + types->camera = setAnimType(&(camera->getFarClippingPlane()),(types->camera), CAMERA_ZFAR); + types->camera = setAnimType(&(camera->getNearClippingPlane()),(types->camera), CAMERA_ZNEAR); + //if ( type != 0) break; if ( types->camera != 0) break; @@ -975,6 +990,14 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD return types; } +int AnimationImporter::setAnimType ( const COLLADAFW::Animatable * prop , int types, int addition) +{ + const COLLADAFW::UniqueId& listid = prop->getAnimationList(); + if (animlist_map.find(listid) != animlist_map.end()) + return types|addition; + else return types; +} + //XXX Is not used anymore. void AnimationImporter::find_frames_old(std::vector<float> * frames, COLLADAFW::Node * node , COLLADAFW::Transformation::TransformationType tm_type) { diff --git a/source/blender/collada/AnimationImporter.h b/source/blender/collada/AnimationImporter.h index 037ae04a0b4..9337e80d63b 100644 --- a/source/blender/collada/AnimationImporter.h +++ b/source/blender/collada/AnimationImporter.h @@ -98,18 +98,15 @@ private: { // INANIMATE = 0, CAMERA_XFOV = 2, - CAMERA_XMAG = 4 + CAMERA_XMAG = 4, + CAMERA_ZFAR = 8, + CAMERA_ZNEAR = 16 }; enum AnimationType { INANIMATE = 0, NODE_TRANSFORM = 1, - /* LIGHT_COLOR = 2, - LIGHT_FOA = 4, - LIGHT_FOE = 8, - CAMERA_XFOV = 16, - CAMERA_XMAG = 32*/ }; struct AnimMix @@ -152,7 +149,9 @@ public: std::vector<FCurve*>* curves); void Assign_float_animations(const COLLADAFW::UniqueId& listid, ListBase *AnimCurves, char * anim_type); - + + int setAnimType ( const COLLADAFW::Animatable * prop , int type, int addition); + void modify_fcurve(std::vector<FCurve*>* curves , char* rna_path , int array_index ); // prerequisites: // animlist_map - map animlist id -> animlist diff --git a/source/blender/collada/CameraExporter.cpp b/source/blender/collada/CameraExporter.cpp index cc9860723fe..a935f45c403 100644 --- a/source/blender/collada/CameraExporter.cpp +++ b/source/blender/collada/CameraExporter.cpp @@ -76,7 +76,7 @@ void CamerasExporter::operator()(Object *ob, Scene *sce) persp.setXFov(lens_to_angle(cam->lens)*(180.0f/M_PI),"xfov"); persp.setAspectRatio((float)(sce->r.xsch)/(float)(sce->r.ysch),false,"aspect_ratio"); persp.setZFar(cam->clipend, false , "zfar"); - persp.setZNear(cam->clipsta); + persp.setZNear(cam->clipsta,false , "znear"); COLLADASW::Camera ccam(mSW, &persp, cam_id, cam_name); addCamera(ccam); } @@ -85,7 +85,7 @@ void CamerasExporter::operator()(Object *ob, Scene *sce) 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); + ortho.setZNear(cam->clipsta, false , "znear"); COLLADASW::Camera ccam(mSW, &ortho, cam_id, cam_name); addCamera(ccam); } |