[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38269] branches/soc-2011-pepper/source/ blender/collada:

Sukhitha Jayathilake pr.jayathilake at gmail.com
Sat Jul 9 21:33:03 CEST 2011


Revision: 38269
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38269
Author:   phabtar
Date:     2011-07-09 19:33:02 +0000 (Sat, 09 Jul 2011)
Log Message:
-----------


Modified Paths:
--------------
    branches/soc-2011-pepper/source/blender/collada/AnimationImporter.cpp
    branches/soc-2011-pepper/source/blender/collada/AnimationImporter.h
    branches/soc-2011-pepper/source/blender/collada/CameraExporter.cpp

Modified: branches/soc-2011-pepper/source/blender/collada/AnimationImporter.cpp
===================================================================
--- branches/soc-2011-pepper/source/blender/collada/AnimationImporter.cpp	2011-07-09 19:16:32 UTC (rev 38268)
+++ branches/soc-2011-pepper/source/blender/collada/AnimationImporter.cpp	2011-07-09 19:33:02 UTC (rev 38269)
@@ -919,28 +919,30 @@
 
 	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();
+		//
+		//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();
+		////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;
+		//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::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 @@
 	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 @@
 	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)
 {

Modified: branches/soc-2011-pepper/source/blender/collada/AnimationImporter.h
===================================================================
--- branches/soc-2011-pepper/source/blender/collada/AnimationImporter.h	2011-07-09 19:16:32 UTC (rev 38268)
+++ branches/soc-2011-pepper/source/blender/collada/AnimationImporter.h	2011-07-09 19:33:02 UTC (rev 38269)
@@ -98,18 +98,15 @@
 	{
 //		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 @@
 								 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

Modified: branches/soc-2011-pepper/source/blender/collada/CameraExporter.cpp
===================================================================
--- branches/soc-2011-pepper/source/blender/collada/CameraExporter.cpp	2011-07-09 19:16:32 UTC (rev 38268)
+++ branches/soc-2011-pepper/source/blender/collada/CameraExporter.cpp	2011-07-09 19:33:02 UTC (rev 38269)
@@ -76,7 +76,7 @@
 		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 @@
 		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);
 	}




More information about the Bf-blender-cvs mailing list