[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38482] branches/soc-2011-pepper/source/ blender/collada: Material Specular Hardness Animation export.

Sukhitha Jayathilake pr.jayathilake at gmail.com
Mon Jul 18 19:33:03 CEST 2011


Revision: 38482
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38482
Author:   phabtar
Date:     2011-07-18 17:33:03 +0000 (Mon, 18 Jul 2011)
Log Message:
-----------
Material Specular Hardness Animation export.

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

Modified: branches/soc-2011-pepper/source/blender/collada/AnimationExporter.cpp
===================================================================
--- branches/soc-2011-pepper/source/blender/collada/AnimationExporter.cpp	2011-07-18 16:47:21 UTC (rev 38481)
+++ branches/soc-2011-pepper/source/blender/collada/AnimationExporter.cpp	2011-07-18 17:33:03 UTC (rev 38482)
@@ -68,7 +68,7 @@
 				if ((!strcmp(transformName, "location") || !strcmp(transformName, "scale")) ||
 					(!strcmp(transformName, "rotation_euler") && ob->rotmode == ROT_MODE_EUL)||
 					(!strcmp(transformName, "rotation_quaternion"))) 
-					dae_animation(ob ,fcu, transformName, false , isMatAnim);
+					dae_animation(ob ,fcu, transformName, false);
 				fcu = fcu->next;
 			}
 		}
@@ -81,7 +81,7 @@
 				if ((!strcmp(transformName, "color")) ||
 					(!strcmp(transformName, "spot_size"))||
 					(!strcmp(transformName, "spot_blend"))) 
-					dae_animation(ob , fcu, transformName, true, isMatAnim );
+					dae_animation(ob , fcu, transformName, true );
 				fcu = fcu->next;
 			}
 		}
@@ -95,7 +95,7 @@
 				if ((!strcmp(transformName, "lens"))||
 					(!strcmp(transformName, "ortho_scale"))||
 					(!strcmp(transformName, "clipend"))||(!strcmp(transformName, "clipsta"))) 
-					dae_animation(ob , fcu, transformName, true, isMatAnim );
+					dae_animation(ob , fcu, transformName, true );
 				fcu = fcu->next;
 			}
 		}
@@ -112,7 +112,7 @@
 					transformName = extract_transform_name( fcu->rna_path );
 					
 					if ((!strcmp(transformName, "specular_hardness"))) 
-						dae_animation(ob ,fcu, transformName, true, isMatAnim );
+						dae_animation(ob ,fcu, transformName, true, ma );
 					fcu = fcu->next;
 				}
 			}
@@ -187,7 +187,7 @@
 			return id_name(ob);
 	}
 
-	void AnimationExporter::dae_animation(Object* ob, FCurve *fcu, char* transformName , bool is_param, bool isMatAnim )
+	void AnimationExporter::dae_animation(Object* ob, FCurve *fcu, char* transformName , bool is_param, Material * ma )
 	{
 		
 		const char *axis_name = NULL;
@@ -230,11 +230,12 @@
 		}
 		else 
 		{
-			if (isMatAnim)
+			if (ma)
 				ob_name = id_name(ob) + "_material";
 			else
-				BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s_%s", (char*)translate_id(ob_name).c_str(),
-					 fcu->rna_path, axis_name);
+				ob_name = id_name(ob);
+			BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s_%s", (char*)translate_id(ob_name).c_str(),
+				 fcu->rna_path, axis_name);
 		}
 		
 		// check rna_path is one of: rotation, scale, location
@@ -305,6 +306,10 @@
 			if ( ob->type == OB_CAMERA )
 				target = get_camera_id(ob)
 				+ "/" + get_transform_sid(fcu->rna_path, -1, axis_name, true);
+
+			if( ma ) 
+				target = translate_id(id_name(ma)) + "-effect"
+						+"/common/" /* should take dynamically */ + get_transform_sid(fcu->rna_path, -1, axis_name, true);
 		}
 		addChannel(COLLADABU::URI(empty, sampler_id), target);
 
@@ -832,6 +837,8 @@
 				tm_type = 9;
 			else if (!strcmp(name, "clipsta"))
 				tm_type = 10;
+			else if (!strcmp(name, "specular_hardness"))
+				tm_type = 11;
 			
 			else
 				tm_type = -1;
@@ -870,8 +877,9 @@
 		case 10:
 			tm_name = "znear";
 			break;
-		
-
+		case 11:
+			tm_name = "shininess";
+			break;
 		default:
 			tm_name = "";
 			break;

Modified: branches/soc-2011-pepper/source/blender/collada/AnimationExporter.h
===================================================================
--- branches/soc-2011-pepper/source/blender/collada/AnimationExporter.h	2011-07-18 16:47:21 UTC (rev 38481)
+++ branches/soc-2011-pepper/source/blender/collada/AnimationExporter.h	2011-07-18 17:33:03 UTC (rev 38482)
@@ -94,7 +94,7 @@
 	
 protected:
 
-	void dae_animation(Object* ob, FCurve *fcu, char* transformName , bool is_param, bool isMatAnim);
+	void dae_animation(Object* ob, FCurve *fcu, char* transformName , bool is_param, Material *ma = NULL);
 
 	void write_bone_animation(Object *ob_arm, Bone *bone);
 




More information about the Bf-blender-cvs mailing list