[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23480] trunk/blender: Warning fixes for ITASC.

Brecht Van Lommel brecht at blender.org
Fri Sep 25 11:33:46 CEST 2009


Revision: 23480
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23480
Author:   blendix
Date:     2009-09-25 11:33:46 +0200 (Fri, 25 Sep 2009)

Log Message:
-----------
Warning fixes for ITASC. Also, use <stdlib.h> instead of <malloc.h>,
it works everywhere.

Modified Paths:
--------------
    trunk/blender/intern/itasc/Armature.cpp
    trunk/blender/intern/itasc/Cache.cpp
    trunk/blender/intern/itasc/ConstraintSet.cpp
    trunk/blender/intern/itasc/CopyPose.cpp
    trunk/blender/intern/itasc/WSDLSSolver.hpp
    trunk/blender/intern/itasc/kdl/jacobian.cpp
    trunk/blender/intern/itasc/kdl/treefksolverpos_recursive.cpp
    trunk/blender/source/blender/ikplugin/intern/ikplugin_api.c
    trunk/blender/source/blender/ikplugin/intern/itasc_plugin.cpp

Modified: trunk/blender/intern/itasc/Armature.cpp
===================================================================
--- trunk/blender/intern/itasc/Armature.cpp	2009-09-25 07:44:29 UTC (rev 23479)
+++ trunk/blender/intern/itasc/Armature.cpp	2009-09-25 09:33:46 UTC (rev 23480)
@@ -8,9 +8,7 @@
 #include "Armature.hpp"
 #include <algorithm>
 #include <string.h>
-#ifndef __STDC__
-#include <malloc.h>
-#endif
+#include <stdlib.h>
 
 namespace iTaSC {
 
@@ -37,9 +35,9 @@
 	m_newqKdl(),
 	m_qdotKdl(),
 	m_jac(NULL),
+	m_armlength(0.0),
 	m_jacsolver(NULL),
-	m_fksolver(NULL),
-	m_armlength(0.0)
+	m_fksolver(NULL)
 {
 }
 
@@ -119,6 +117,8 @@
 		values[1].id = value[1].id = ID_JOINT_RZ;		
 		v_nr = 2;
 		break;
+	case Joint::None:
+		break;
 	}
 }
 
@@ -734,6 +734,8 @@
 				case ACT_ALPHA:
 					pConstraint->values[i].alpha = value;
 					break;
+				default:
+					break;
 				}
 			}
 		} else {
@@ -755,6 +757,8 @@
 					case ACT_ALPHA:
 						pConstraint->values[i].alpha = value;
 						break;
+					case ACT_NONE:
+						break;
 					}
 				}
 			}

Modified: trunk/blender/intern/itasc/Cache.cpp
===================================================================
--- trunk/blender/intern/itasc/Cache.cpp	2009-09-25 07:44:29 UTC (rev 23479)
+++ trunk/blender/intern/itasc/Cache.cpp	2009-09-25 09:33:46 UTC (rev 23480)
@@ -7,9 +7,7 @@
 #include <string.h>
 #include <assert.h>
 #include <math.h>
-#ifndef __STDC__
-#include <malloc.h>
-#endif
+#include <stdlib.h>
 #include "Cache.hpp"
 
 namespace iTaSC {

Modified: trunk/blender/intern/itasc/ConstraintSet.cpp
===================================================================
--- trunk/blender/intern/itasc/ConstraintSet.cpp	2009-09-25 07:44:29 UTC (rev 23479)
+++ trunk/blender/intern/itasc/ConstraintSet.cpp	2009-09-25 09:33:46 UTC (rev 23480)
@@ -12,13 +12,13 @@
 
 ConstraintSet::ConstraintSet(unsigned int _nc,double accuracy,unsigned int maximum_iterations):
     m_nc(_nc),
+    m_Cf(e_zero_matrix(m_nc,6)),
+    m_Wy(e_scalar_vector(m_nc,1.0)),
+    m_y(m_nc),m_ydot(e_zero_vector(m_nc)),m_chi(e_zero_vector(6)),
+    m_S(6),m_temp(6),m_tdelta(6),
     m_Jf(e_identity_matrix(6,6)),
-    m_Cf(e_zero_matrix(m_nc,6)),
     m_U(e_identity_matrix(6,6)),m_V(e_identity_matrix(6,6)),m_B(e_zero_matrix(6,6)),
     m_Jf_inv(e_zero_matrix(6,6)),
-    m_Wy(e_scalar_vector(m_nc,1.0)),
-    m_chi(e_zero_vector(6)),m_y(m_nc),m_ydot(e_zero_vector(m_nc)),
-    m_S(6),m_temp(6),m_tdelta(6),
 	m_internalPose(F_identity), m_externalPose(F_identity),
 	m_constraintCallback(NULL), m_constraintParam(NULL), 
 	m_toggle(false),m_substep(false),

Modified: trunk/blender/intern/itasc/CopyPose.cpp
===================================================================
--- trunk/blender/intern/itasc/CopyPose.cpp	2009-09-25 07:44:29 UTC (rev 23479)
+++ trunk/blender/intern/itasc/CopyPose.cpp	2009-09-25 09:33:46 UTC (rev 23480)
@@ -21,7 +21,7 @@
 {
 	m_maxerror = armlength/2.0;
 	m_outputControl = (control_output & CTL_ALL);
-	int _nc = nBitsOn(m_outputControl);
+	unsigned int _nc = nBitsOn(m_outputControl);
 	if (!_nc) 
 		return;
 	// reset the constraint set
@@ -284,7 +284,7 @@
 
 void CopyPose::updateState(ConstraintValues* _values, ControlState* _state, unsigned int mask, double timestep)
 {
-	int id = (mask == CTL_ROTATIONX) ? ID_ROTATIONX : ID_POSITIONX;
+	unsigned int id = (mask == CTL_ROTATIONX) ? ID_ROTATIONX : ID_POSITIONX;
 	ControlState::ControlValue* _yval;
 	ConstraintSingleValue* _data;
 	int i, j, k;

Modified: trunk/blender/intern/itasc/WSDLSSolver.hpp
===================================================================
--- trunk/blender/intern/itasc/WSDLSSolver.hpp	2009-09-25 07:44:29 UTC (rev 23479)
+++ trunk/blender/intern/itasc/WSDLSSolver.hpp	2009-09-25 09:33:46 UTC (rev 23480)
@@ -31,6 +31,8 @@
 		case DLS_QMAX:
 			m_qmax = value;
 			break;
+		default:
+			break;
 		}
 	}
 };

Modified: trunk/blender/intern/itasc/kdl/jacobian.cpp
===================================================================
--- trunk/blender/intern/itasc/kdl/jacobian.cpp	2009-09-25 07:44:29 UTC (rev 23479)
+++ trunk/blender/intern/itasc/kdl/jacobian.cpp	2009-09-25 09:33:46 UTC (rev 23480)
@@ -55,13 +55,13 @@
 
     double Jacobian::operator()(int i,int j)const
     {
-        assert(i<6*nr_blocks&&j<size);
+        assert(i<6*(int)nr_blocks&&j<(int)size);
         return twists[j+6*(int)(floor((double)i/6))](i%6);
     }
 
     double& Jacobian::operator()(int i,int j)
     {
-        assert(i<6*nr_blocks&&j<size);
+        assert(i<6*(int)nr_blocks&&j<(int)size);
         return twists[j+6*(int)(floor((double)i/6))](i%6);
     }
 

Modified: trunk/blender/intern/itasc/kdl/treefksolverpos_recursive.cpp
===================================================================
--- trunk/blender/intern/itasc/kdl/treefksolverpos_recursive.cpp	2009-09-25 07:44:29 UTC (rev 23479)
+++ trunk/blender/intern/itasc/kdl/treefksolverpos_recursive.cpp	2009-09-25 09:33:46 UTC (rev 23480)
@@ -42,7 +42,6 @@
         else if(baseit == tree.getSegments().end()) //if the base segment name is not found
          	return -3;
         else{
-        	const TreeElement& currentElement = it->second;
 			p_out = recursiveFk(q_in, it, baseit);	
         	return 0;        	
         }

Modified: trunk/blender/source/blender/ikplugin/intern/ikplugin_api.c
===================================================================
--- trunk/blender/source/blender/ikplugin/intern/ikplugin_api.c	2009-09-25 07:44:29 UTC (rev 23479)
+++ trunk/blender/source/blender/ikplugin/intern/ikplugin_api.c	2009-09-25 09:33:46 UTC (rev 23480)
@@ -72,8 +72,6 @@
 
 static IKPlugin *get_plugin(bPose *pose)
 {
-	IKPlugin *plugin;
-
 	if (!pose || pose->iksolver < 0 || pose->iksolver >= BIK_SOLVER_COUNT)
 		return NULL;
 

Modified: trunk/blender/source/blender/ikplugin/intern/itasc_plugin.cpp
===================================================================
--- trunk/blender/source/blender/ikplugin/intern/itasc_plugin.cpp	2009-09-25 07:44:29 UTC (rev 23479)
+++ trunk/blender/source/blender/ikplugin/intern/itasc_plugin.cpp	2009-09-25 09:33:46 UTC (rev 23480)
@@ -354,7 +354,7 @@
 
 static bool is_cartesian_constraint(bConstraint *con)
 {
-	bKinematicConstraint* data=(bKinematicConstraint*)con->data;
+	//bKinematicConstraint* data=(bKinematicConstraint*)con->data;
 
 	return true;
 }
@@ -379,12 +379,8 @@
 
 int initialize_scene(Object *ob, bPoseChannel *pchan_tip)
 {
-	bPoseChannel *curchan, *pchan_root=NULL, *chanlist[256], **oldchan;
-	PoseTree *tree;
-	PoseTarget *target;
 	bConstraint *con;
-	bKinematicConstraint *data;
-	int a, segcount= 0, size, newsize, *oldparent, parent, rootbone, treecount;
+	int treecount;
 
 	/* find all IK constraints and validate them */
 	treecount = 0;
@@ -456,6 +452,7 @@
 	R = R*T;
 }
 
+#if 0
 static void GetEulerXZY(const KDL::Rotation& R, double& X,double& Z,double& Y)
 {
 	if (fabs(R(0,1)) > 1.0 - KDL::epsilon ) {
@@ -481,6 +478,7 @@
         Z = KDL::atan2(-R(0,1), R(0,0));
     }
 }
+#endif
 
 static void GetJointRotation(KDL::Rotation& boneRot, int type, double* rot)
 {
@@ -660,9 +658,6 @@
 	bKinematicConstraint *condata = (bKinematicConstraint *)iktarget->blenderConstraint->data;
 	iTaSC::ConstraintValues* values = _values;
 	bItasc* ikparam = (bItasc*) iktarget->owner->pose->ikparam;
-	iTaSC::ConstraintSingleValue* value;
-	double error;
-	int i;
 
 	// we need default parameters
 	if (!ikparam) 
@@ -839,7 +834,7 @@
 		break;
 	}
 	if (dof >= 0) {
-		for (int i=0; i<_nvalues; i++, dof++) {
+		for (unsigned int i=0; i<_nvalues; i++, dof++) {
 			_values[i].values[0].yd = ikchan->jointValue[dof];
 			_values[i].alpha = chan->ikrotweight;
 			_values[i].feedback = ikparam->feedback;
@@ -853,7 +848,6 @@
 {
 	IK_Channel *ikchan;
 	bPoseChannel *pchan;
-	PoseTarget* target;
 	Bone *bone;
 	int a, flag, njoint;
 
@@ -1046,11 +1040,11 @@
 	KDL::Frame initPose;
 	KDL::Rotation boneRot;
 	Bone *bone;
-	int a, t, numtarget;
+	int a, numtarget;
+	unsigned int t;
 	float length;
 	bool ret = true, ingame;
 	double *rot;
-	double lmin[3], lmax[3];
 
 	if (tree->totchannel == 0)
 		return NULL;
@@ -1105,7 +1099,6 @@
 	double weight[3];
 	// assume uniform scaling and take Y scale as general scale for the armature
 	float scale = VecLength(ob->obmat[1]);
-	double X, Y, Z;
 	// build the array of joints corresponding to the IK chain
 	convert_channels(ikscene, tree);
 	if (ingame) {
@@ -1366,8 +1359,8 @@
 	}
 	// set the weight
 	e_matrix& Wq = arm->getWq();
-	assert(Wq.cols() == weights.size());
-	for (unsigned int q=0; q<Wq.cols(); q++)
+	assert(Wq.cols() == (int)weights.size());
+	for (int q=0; q<Wq.cols(); q++)
 		Wq(q,q)=weights[q];
 	// get the inverse rest pose frame of the base to compute relative rest pose of end effectors
 	// this is needed to handle the enforce parameter
@@ -1492,8 +1485,6 @@
 
 static void init_scene(Object *ob)
 {
-	bPoseChannel *pchan;
-
 	if (ob->pose->ikdata) {
 		for(IK_Scene* scene = ((IK_Data*)ob->pose->ikdata)->first;
 			scene != NULL;
@@ -1559,7 +1550,7 @@
 	}
 		
 	if (ikscene->cache && !reiterate && simulation) {
-		iTaSC::CacheTS sts, cts, dts;
+		iTaSC::CacheTS sts, cts;
 		sts = cts = (iTaSC::CacheTS)(timestamp*1000.0+0.5);
 		if (ikscene->cache->getPreviousCacheItem(ikscene->armature, 0, &cts) == NULL || cts == 0) {
 			// the cache is empty before this time, reiterate





More information about the Bf-blender-cvs mailing list