[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39480] branches/soc-2011-salad: Merging pepper up to r39479.

Joerg Mueller nexyon at gmail.com
Wed Aug 17 09:25:28 CEST 2011


Revision: 39480
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39480
Author:   nexyon
Date:     2011-08-17 07:25:28 +0000 (Wed, 17 Aug 2011)
Log Message:
-----------
Merging pepper up to r39479.

Revision Links:
--------------
    http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39479

Modified Paths:
--------------
    branches/soc-2011-salad/release/scripts/modules/retarget.py
    branches/soc-2011-salad/source/blender/collada/AnimationExporter.cpp
    branches/soc-2011-salad/source/blender/collada/AnimationExporter.h
    branches/soc-2011-salad/source/blender/collada/AnimationImporter.cpp
    branches/soc-2011-salad/source/blender/collada/AnimationImporter.h
    branches/soc-2011-salad/source/blender/collada/ArmatureExporter.cpp
    branches/soc-2011-salad/source/blender/collada/ArmatureImporter.cpp
    branches/soc-2011-salad/source/blender/collada/DocumentImporter.cpp
    branches/soc-2011-salad/source/blender/makesrna/intern/rna_actuator.c
    branches/soc-2011-salad/source/blenderplayer/bad_level_call_stubs/stubs.c
    branches/soc-2011-salad/source/gameengine/Ketsji/BL_ActionManager.h
    branches/soc-2011-salad/source/gameengine/Ketsji/KX_GameObject.cpp

Property Changed:
----------------
    branches/soc-2011-salad/
    branches/soc-2011-salad/source/blender/editors/space_outliner/


Property changes on: branches/soc-2011-salad
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/soc-2010-jwilkins:28499-37009
/branches/soc-2010-nicolasbishop:28448-30783,30792-30793,30797-30798,30815
/branches/soc-2011-carrot:36828-39099
/branches/soc-2011-cucumber:36829-36994
/branches/soc-2011-onion:36833-38309
/branches/soc-2011-pepper:36830-39449
/branches/soc-2011-tomato:36831-39394
/trunk/blender:36834-39447
   + /branches/soc-2010-jwilkins:28499-37009
/branches/soc-2010-nicolasbishop:28448-30783,30792-30793,30797-30798,30815
/branches/soc-2011-carrot:36828-39099
/branches/soc-2011-cucumber:36829-36994
/branches/soc-2011-onion:36833-38309
/branches/soc-2011-pepper:36830-39479
/branches/soc-2011-tomato:36831-39394
/trunk/blender:36834-39447

Modified: branches/soc-2011-salad/release/scripts/modules/retarget.py
===================================================================
--- branches/soc-2011-salad/release/scripts/modules/retarget.py	2011-08-17 07:16:11 UTC (rev 39479)
+++ branches/soc-2011-salad/release/scripts/modules/retarget.py	2011-08-17 07:25:28 UTC (rev 39480)
@@ -483,43 +483,30 @@
     perf_root = performer_obj.pose.bones[0].name
     for bone in map_bones:
         perf_bone = bone.bone.reverseMap[0].name
-        addLocalRot = False;
+
+        cons = bone.constraints.new('COPY_ROTATION')
+        cons.name = "retargetTemp"
+        locks = bone.lock_rotation
+        cons.use_x = not locks[0]
+        cons.use_y = not locks[1]
+        cons.use_z = not locks[2]
+        cons.target = performer_obj
+        cons.subtarget = perf_bone
+        cons.target_space = 'WORLD'
+        cons.owner_space = 'WORLD'
+        
         if (not bone.bone.use_connect) and (perf_bone!=perf_root):
-            locks = bone.lock_location
-            #if not (locks[0] or locks[1] or locks[2]):  
             cons = bone.constraints.new('COPY_LOCATION')
             cons.name = "retargetTemp"
-            cons.use_x = not locks[0]
-            cons.use_y = not locks[1]
-            cons.use_z = not locks[2]
             cons.target = performer_obj
             cons.subtarget = perf_bone
+            cons.use_x = True
+            cons.use_y = True
+            cons.use_z = True
             cons.target_space = 'LOCAL'
             cons.owner_space = 'LOCAL'
-            addLocalRot = True
 
-       
-        cons2 = bone.constraints.new('COPY_ROTATION')
-        cons2.name = "retargetTemp"
-        locks = bone.lock_rotation
-        cons2.use_x = not locks[0]
-        cons2.use_y = not locks[1]
-        cons2.use_z = not locks[2]
-        cons2.target = performer_obj
-        cons2.subtarget = perf_bone
-        cons2.target_space = 'WORLD'
-        cons2.owner_space = 'WORLD'
 
-        if perf_bone==perf_root:
-            addLocalRot = True
-
-        #~ if addLocalRot:
-            #~ for constraint in bone.constraints:
-                #~ if constraint.type == 'COPY_ROTATION':
-                    #~ constraint.target_space = 'LOCAL'
-                    #~ constraint.owner_space = 'LOCAL'
-
-
 def prepareForBake(enduser_obj):
     bones = enduser_obj.pose.bones
     for bone in bones:

Modified: branches/soc-2011-salad/source/blender/collada/AnimationExporter.cpp
===================================================================
--- branches/soc-2011-salad/source/blender/collada/AnimationExporter.cpp	2011-08-17 07:16:11 UTC (rev 39479)
+++ branches/soc-2011-salad/source/blender/collada/AnimationExporter.cpp	2011-08-17 07:25:28 UTC (rev 39480)
@@ -59,15 +59,18 @@
 		FCurve *fcu;
 		char * transformName ;
 		bool isMatAnim = false;
+
+		//Export transform animations
         if(ob->adt && ob->adt->action)      
 		{
-			if ( ob->type == OB_ARMATURE )
+			//transform matrix export for bones are temporarily disabled here.
+			/*if ( ob->type == OB_ARMATURE )
 			{
 				bArmature *arm = (bArmature*)ob->data;
 				for (Bone *bone = (Bone*)arm->bonebase.first; bone; bone = bone->next)
-					bake_bone_animation(ob, bone);
+					write_bone_animation_matrix(ob, bone);
 			    
-			}
+			}*/
 			fcu = (FCurve*)ob->adt->action->curves.first;
 		    while (fcu) {
 			transformName = extract_transform_name( fcu->rna_path );
@@ -79,6 +82,8 @@
 				fcu = fcu->next;
 			}
 		}
+
+		//Export Lamp parameter animations
 		if( (ob->type == OB_LAMP ) && ((Lamp*)ob ->data)->adt && ((Lamp*)ob ->data)->adt->action )
 		{
 			fcu = (FCurve*)(((Lamp*)ob ->data)->adt->action->curves.first);
@@ -92,6 +97,7 @@
 			}
 		}
 
+		//Export Camera parameter animations
 		if( (ob->type == OB_CAMERA ) && ((Camera*)ob ->data)->adt && ((Camera*)ob ->data)->adt->action )
 		{		
 			fcu = (FCurve*)(((Camera*)ob ->data)->adt->action->curves.first);
@@ -106,6 +112,7 @@
 			}
 		}
 
+		//Export Material parameter animations.
 		for(int a = 0; a < ob->totcol; a++)
 		{
 			Material *ma = give_current_material(ob, a+1);
@@ -126,28 +133,30 @@
 			}
 			
 		}
-		//if (!ob->adt || !ob->adt->action) 
-		//	fcu = (FCurve*)((Lamp*)ob->data)->adt->action->curves.first;  //this is already checked in hasAnimations()
-		//else
-		//    fcu = (FCurve*)ob->adt->action->curves.first;
+		/* Old System
+		if (!ob->adt || !ob->adt->action) 
+			fcu = (FCurve*)((Lamp*)ob->data)->adt->action->curves.first;  //this is already checked in hasAnimations()
+		else
+		    fcu = (FCurve*)ob->adt->action->curves.first;
 						        
-		//if (ob->type == OB_ARMATURE) {
-		//	if (!ob->data) return;
-		//	bArmature *arm = (bArmature*)ob->data;
-		//	while(fcu)
-		//	{ 		
-		//		transformName = extract_transform_name( fcu->rna_path );
-		//	//	std::string ob_name =  getObjectBoneName( ob , fcu);
-		//	//	for (Bone *bone = (Bone*)arm->bonebase.first; bone; bone = bone->next)
-		//	//		write_bone_animation(ob, bone);
-		//		dae_animation(ob, fcu, ob_name, transformName);
-		//		fcu = fcu->next;
-		//	}
-		//}
-		//else {
+		if (ob->type == OB_ARMATURE) {
+			if (!ob->data) return;
+			bArmature *arm = (bArmature*)ob->data;
+			while(fcu)
+			{ 		
+				transformName = extract_transform_name( fcu->rna_path );
+			//	std::string ob_name =  getObjectBoneName( ob , fcu);
+			//	for (Bone *bone = (Bone*)arm->bonebase.first; bone; bone = bone->next)
+			//		write_bone_animation(ob, bone);
+				dae_animation(ob, fcu, ob_name, transformName);
+				fcu = fcu->next;
+			}
+		}
+		else {*/
 		
 	}
 
+	//euler sources from quternion sources
 	float * AnimationExporter::get_eul_source_for_quat(Object *ob )
 	{
 		FCurve *fcu = (FCurve*)ob->adt->action->curves.first;
@@ -182,6 +191,8 @@
 		return eul;
 
 	}
+
+	//Get proper name for bones
 	std::string AnimationExporter::getObjectBoneName( Object* ob,const FCurve* fcu ) 
 	{
 		//hard-way to derive the bone name from rna_path. Must find more compact method
@@ -196,9 +207,9 @@
 			return id_name(ob);
 	}
 
+	//convert f-curves to animation curves and write
 	void AnimationExporter::dae_animation(Object* ob, FCurve *fcu, char* transformName , bool is_param, Material * ma )
 	{
-		
 		const char *axis_name = NULL;
 		char anim_id[200];
 		
@@ -209,12 +220,10 @@
 		{
 			fprintf(stderr, "quaternion rotation curves are not supported. rotation curve will not be exported\n");
 			quatRotation = true;
-			/*const char *axis_names[] = {"", "X", "Y", "Z"};
-			if (fcu->array_index < 4)
-			axis_name = axis_names[fcu->array_index];*/
 			return;
 		}
-		//maybe a list or a vector of float animations
+		
+		//axis names for colors
 		else if ( !strcmp(transformName, "color")||!strcmp(transformName, "specular_color")||!strcmp(transformName, "diffuse_color")||
 			      (!strcmp(transformName, "alpha")))
 		{
@@ -222,18 +231,24 @@
 			if (fcu->array_index < 3)
 			axis_name = axis_names[fcu->array_index];
 		}
+
+		//axis names for transforms
 		else if ((!strcmp(transformName, "location") || !strcmp(transformName, "scale")) ||
-				(!strcmp(transformName, "rotation_euler")))
+				(!strcmp(transformName, "rotation_euler"))||(!strcmp(transformName, "rotation_quaternion")))
 		{
 			const char *axis_names[] = {"X", "Y", "Z"};
 			if (fcu->array_index < 3)
 			axis_name = axis_names[fcu->array_index];
 		}
+
+		//no axis name. single parameter.
 		else{
 			axis_name = "";
 		}
 		
 		std::string ob_name = std::string("null");
+
+        //Create anim Id
 		if (ob->type == OB_ARMATURE) 
 		{   
 		    ob_name =  getObjectBoneName( ob , fcu);
@@ -250,8 +265,6 @@
 				 fcu->rna_path, axis_name);
 		}
 		
-		// check rna_path is one of: rotation, scale, location
-
 		openAnimation(anim_id, COLLADABU::Utils::EMPTY_STRING);
 
 		// create input source
@@ -260,6 +273,7 @@
 		// create output source
 		std::string output_id ;
 	    
+		//quat rotations are skipped for now, because of complications with determining axis.
 		if(quatRotation) 
 		{
             float * eul  = get_eul_source_for_quat(ob);
@@ -268,7 +282,7 @@
 					eul_axis[i] = eul[i*3 + fcu->array_index];
 			output_id= create_source_from_array(COLLADASW::InputSemantic::OUTPUT, eul_axis , fcu->totvert, quatRotation, anim_id, axis_name);
 		}
-		 else 
+		else 
 		{
 			output_id= create_source_from_fcurve(COLLADASW::InputSemantic::OUTPUT, fcu, anim_id, axis_name);
 		}
@@ -287,7 +301,6 @@
 			outtangent_id = create_source_from_fcurve(COLLADASW::InputSemantic::OUT_TANGENT, fcu, anim_id, axis_name);
 		}
 
-
 		std::string sampler_id = std::string(anim_id) + SAMPLER_ID_SUFFIX;
 		COLLADASW::LibraryAnimations::Sampler sampler(sw, sampler_id);
 		std::string empty;
@@ -317,7 +330,7 @@
 
 			if ( ob->type == OB_CAMERA )
 				target = get_camera_id(ob)
-				+ "/" + get_transform_sid(fcu->rna_path, -1, axis_name, true);
+				+ "/" + get_camera_param_sid(fcu->rna_path, -1, axis_name, true);
 
 			if( ma ) 
 				target = translate_id(id_name(ma)) + "-effect"
@@ -328,35 +341,23 @@
 		closeAnimation();
 	}
 
-	void AnimationExporter::bake_bone_animation(Object *ob_arm, Bone *bone)
+
+	
+	//write bone animations in transform matrix sources
+	void AnimationExporter::write_bone_animation_matrix(Object *ob_arm, Bone *bone)
 	{
 		if (!ob_arm->adt)
 			return;
         
-		sample_and_bake_bone_animation(ob_arm, bone);
+		sample_and_write_bone_animation_matrix(ob_arm, bone);
 
         for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next)
-			bake_bone_animation(ob_arm, child);
+			write_bone_animation_matrix(ob_arm, child);
 	}
 
-	void AnimationExporter::write_bone_animation(Object *ob_arm, Bone *bone)
+	

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list