[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12665] branches/cloth/blender: svn merge -r 12653:12664 https://svn.blender.org/svnroot/bf-blender/trunk/ blender

Daniel Genrich daniel.genrich at gmx.net
Sat Nov 24 23:49:56 CET 2007


Revision: 12665
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12665
Author:   genscher
Date:     2007-11-24 23:49:56 +0100 (Sat, 24 Nov 2007)

Log Message:
-----------
svn merge -r 12653:12664 https://svn.blender.org/svnroot/bf-blender/trunk/blender

Modified Paths:
--------------
    branches/cloth/blender/intern/elbeem/intern/paraloopend.h
    branches/cloth/blender/release/scripts/mesh_edges2curves.py
    branches/cloth/blender/source/blender/blenkernel/intern/action.c
    branches/cloth/blender/source/blender/blenlib/BLI_arithb.h
    branches/cloth/blender/source/blender/blenlib/intern/arithb.c
    branches/cloth/blender/source/blender/python/api2_2x/Curve.c
    branches/cloth/blender/source/blender/python/api2_2x/Mesh.c
    branches/cloth/blender/source/blender/python/api2_2x/doc/Curve.py
    branches/cloth/blender/source/blender/python/api2_2x/doc/Mesh.py
    branches/cloth/blender/source/blender/render/intern/source/convertblender.c
    branches/cloth/blender/source/blender/render/intern/source/imagetexture.c
    branches/cloth/blender/source/blender/render/intern/source/rendercore.c
    branches/cloth/blender/source/blender/src/drawipo.c
    branches/cloth/blender/source/blender/src/transform.c
    branches/cloth/blender/source/blender/src/usiblender.c
    branches/cloth/blender/source/creator/creator.c

Modified: branches/cloth/blender/intern/elbeem/intern/paraloopend.h
===================================================================
--- branches/cloth/blender/intern/elbeem/intern/paraloopend.h	2007-11-24 18:29:33 UTC (rev 12664)
+++ branches/cloth/blender/intern/elbeem/intern/paraloopend.h	2007-11-24 22:49:56 UTC (rev 12665)
@@ -1,13 +1,41 @@
-// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-} /* i */ 
-	int i=0; 
-	ADVANCE_POINTERS(2*gridLoopBound); 
-} /* j */ 
-#pragma omp barrier 
-	/* COMPRESSGRIDS!=1 */ 
-	/* int i=0;  */ 
-	/* ADVANCE_POINTERS(mLevel[lev].lSizex*2);  */ 
-} /* all cell loop k,j,i */
-	if(doReduce) { } /* dummy remove warning */ 
-} /* main_region */ 
+// same as grid loop_end + barrier
 
+			} // i
+		int i=0; //dummy
+		ADVANCE_POINTERS(2*gridLoopBound);
+	} // j
+
+#	if COMPRESSGRIDS==1
+#	if PARALLEL==1
+	//frintf(stderr," (id=%d k=%d) ",id,k);
+#pragma omp barrier
+#	endif // PARALLEL==1
+#	else // COMPRESSGRIDS==1
+	int i=0; //dummy
+	ADVANCE_POINTERS(mLevel[lev].lSizex*2);
+#	endif // COMPRESSGRIDS==1
+
+} // all cell loop k,j,i
+
+#pragma omp critical
+{
+	if(doReduce) {
+		// synchronize global vars
+		for(int j=0; j<calcListFull.size() ; j++) mListFull.push_back( calcListFull[j] ); 
+		for(int j=0; j<calcListEmpty.size(); j++) mListEmpty.push_back( calcListEmpty[j] ); 
+		for(int j=0; j<calcListParts.size(); j++) mpParticles->addFullParticle( calcListParts[j] );
+		if(calcMaxVlen>mMaxVlen) {  
+			mMxvx = calcMxvx;  
+			mMxvy = calcMxvy;  
+			mMxvz = calcMxvz;  
+			mMaxVlen = calcMaxVlen;  
+		}  
+		if(0) {debMsgStd("OMP_CRIT",DM_MSG,	"reduce id"<<id<<" curr: "<<mMaxVlen<<"|"<<mMxvx<<","<<mMxvy<<","<<mMxvz<< 
+																				"      calc[ "<<calcMaxVlen<<"|"<<calcMxvx<<","<<calcMxvy<<","<<calcMxvz<<"]  " ,4 ); }
+	}
+} // critical
+
+
+} /* main_region */  
+	//?lobOutstrForce = true;
+

Modified: branches/cloth/blender/release/scripts/mesh_edges2curves.py
===================================================================
--- branches/cloth/blender/release/scripts/mesh_edges2curves.py	2007-11-24 18:29:33 UTC (rev 12664)
+++ branches/cloth/blender/release/scripts/mesh_edges2curves.py	2007-11-24 22:49:56 UTC (rev 12665)
@@ -39,17 +39,8 @@
 # ***** END GPL LICENCE BLOCK *****
 # --------------------------------------------------------------------------
 
-
 from Blender import *
 
-def edkey(ed):
-	i1 = ed.v1.index
-	i2 = ed.v2.index
-	if i1>i2:
-		return (i2,i1), ed
-	else:
-		return (i1,i2), ed
-
 def polysFromMesh(me):
 	# a polyline is 2 
 	#polylines are a list

Modified: branches/cloth/blender/source/blender/blenkernel/intern/action.c
===================================================================
--- branches/cloth/blender/source/blender/blenkernel/intern/action.c	2007-11-24 18:29:33 UTC (rev 12664)
+++ branches/cloth/blender/source/blender/blenkernel/intern/action.c	2007-11-24 22:49:56 UTC (rev 12665)
@@ -607,8 +607,10 @@
 				QUATCOPY(squat, schan->quat);
 				if(mode==ACTSTRIPMODE_BLEND)
 					QuatInterpol(dchan->quat, dquat, squat, srcweight);
-				else
-					QuatAdd(dchan->quat, dquat, squat, srcweight);
+				else {
+					QuatMulFac(squat, srcweight);
+					QuatMul(dchan->quat, dquat, squat);
+				}
 				
 				NormalQuat (dchan->quat);
 			}

Modified: branches/cloth/blender/source/blender/blenlib/BLI_arithb.h
===================================================================
--- branches/cloth/blender/source/blender/blenlib/BLI_arithb.h	2007-11-24 18:29:33 UTC (rev 12664)
+++ branches/cloth/blender/source/blender/blenlib/BLI_arithb.h	2007-11-24 22:49:56 UTC (rev 12665)
@@ -119,6 +119,8 @@
 void QuatOne(float *);
 void QuatMul(float *, float *, float *);
 void QuatMulVecf(float *q, float *v);
+void QuatMulf(float *q, float f);
+void QuatMulFac(float *q, float fac);
 
 void NormalQuat(float *);
 void VecRotToQuat(float *vec, float phi, float *quat);
@@ -126,7 +128,6 @@
 void QuatSub(float *q, float *q1, float *q2);
 void QuatConj(float *q);
 void QuatInv(float *q);
-void QuatMulf(float *q, float f);
 float QuatDot(float *q1, float *q2);
 void QuatCopy(float *q1, float *q2);
 

Modified: branches/cloth/blender/source/blender/blenlib/intern/arithb.c
===================================================================
--- branches/cloth/blender/source/blender/blenlib/intern/arithb.c	2007-11-24 18:29:33 UTC (rev 12664)
+++ branches/cloth/blender/source/blender/blenlib/intern/arithb.c	2007-11-24 22:49:56 UTC (rev 12665)
@@ -1109,6 +1109,7 @@
 	QuatMulf(q, 1.0f/f);
 }
 
+/* simple mult */
 void QuatMulf(float *q, float f)
 {
 	q[0] *= f;
@@ -1124,6 +1125,20 @@
 	q2[0]= -q2[0];
 }
 
+/* angular mult factor */
+void QuatMulFac(float *q, float fac)
+{
+	float angle= fac*saacos(q[0]);	/* quat[0]= cos(0.5*angle), but now the 0.5 and 2.0 rule out */
+	
+	float co= (float)cos(angle);
+	float si= (float)sin(angle);
+	q[0]= co;
+	Normalize(q+1);
+	q[1]*= si;
+	q[2]*= si;
+	q[3]*= si;
+	
+}
 
 void QuatToMat3( float *q, float m[][3])
 {

Modified: branches/cloth/blender/source/blender/python/api2_2x/Curve.c
===================================================================
--- branches/cloth/blender/source/blender/python/api2_2x/Curve.c	2007-11-24 18:29:33 UTC (rev 12664)
+++ branches/cloth/blender/source/blender/python/api2_2x/Curve.c	2007-11-24 22:49:56 UTC (rev 12665)
@@ -124,6 +124,7 @@
 static PyObject *Curve_iterNext( BPy_Curve * self );
 
 PyObject *Curve_getNurb( BPy_Curve * self, int n );
+static int Curve_setNurb( BPy_Curve * self, int n, PyObject * value );
 static int Curve_length( PyInstanceObject * inst );
 
 
@@ -1111,6 +1112,42 @@
 
 }
 
+/*
+ * Curve_setNurb
+ * In this case only remove the item, we could allow adding later.
+ */
+static int Curve_setNurb( BPy_Curve * self, int n, PyObject * value )
+{
+	Nurb *pNurb;
+	int i;
+
+	/* bail if index < 0 */
+	if( n < 0 )
+		return ( EXPP_ReturnIntError( PyExc_IndexError,
+				 "index less than 0" ) );
+	/* bail if no Nurbs in Curve */
+	if( self->curve->nurb.first == 0 )
+		return ( EXPP_ReturnIntError( PyExc_IndexError,
+				 "no Nurbs in this Curve" ) );
+	/* set pointer to nth Nurb */
+	for( pNurb = self->curve->nurb.first, i = 0;
+			pNurb != 0 && i < n; pNurb = pNurb->next, ++i )
+		/**/;
+
+	if( !pNurb )		/* we came to the end of the list */
+		return ( EXPP_ReturnIntError( PyExc_IndexError,
+				 "index out of range" ) );
+	
+	if (value) {
+		return ( EXPP_ReturnIntError( PyExc_RuntimeError,
+				 "assigning curves is not yet supported" ) );
+	} else {
+		BLI_remlink(&self->curve->nurb, pNurb);
+		freeNurb(pNurb);
+	}
+	return 0;
+}
+
 /*****************************************************************************/
 /* Function:    Curve_compare		                                         */
 /* Description: This compares 2 curve python types, == or != only.			 */
@@ -1430,7 +1467,7 @@
 	( intargfunc ) 0,	/* sq_repeat */
 	( intargfunc ) Curve_getNurb,	/* sq_item */
 	( intintargfunc ) 0,	/* sq_slice */
-	0,			/* sq_ass_item */
+	( intobjargproc ) Curve_setNurb,	/* sq_ass_item - only so you can do del curve[i] */
 	0,			/* sq_ass_slice */
 	( objobjproc ) 0,	/* sq_contains */
 	0,

Modified: branches/cloth/blender/source/blender/python/api2_2x/Mesh.c
===================================================================
--- branches/cloth/blender/source/blender/python/api2_2x/Mesh.c	2007-11-24 18:29:33 UTC (rev 12664)
+++ branches/cloth/blender/source/blender/python/api2_2x/Mesh.c	2007-11-24 22:49:56 UTC (rev 12665)
@@ -7429,28 +7429,34 @@
 	return 0;
 }
 
-static PyObject *Mesh_pointInside( BPy_Mesh * self, VectorObject * vec )
+static PyObject *Mesh_pointInside( BPy_Mesh * self, PyObject * args, PyObject *kwd )
 {
 	Mesh *mesh = self->mesh;
 	MFace *mf = mesh->mface;
 	MVert *mvert = mesh->mvert;
 	int i;
 	int isect_count=0;
+	int selected_only = 0;
+	VectorObject *vec;
+	static char *kwlist[] = {"point", "selected_only", NULL};
 	
-	if(!VectorObject_Check(vec))
-			return EXPP_ReturnPyObjError( PyExc_TypeError,
-					"expected one vector type" );
+	if( !PyArg_ParseTupleAndKeywords(args, kwd, "|O!i", kwlist,
+		 &vector_Type, &vec, &selected_only) ) {
+			 return EXPP_ReturnPyObjError( PyExc_TypeError, "expected a vector and an optional bool argument");
+	}
 	
 	if(vec->size < 3)
 		return EXPP_ReturnPyObjError(PyExc_AttributeError, 
 			"Mesh.pointInside(vec) expects a 3D vector object\n");
 	
 	for( i = 0; i < mesh->totface; mf++, i++ ) {
-		if (pointInside_internal(vec->vec, mvert[mf->v1].co, mvert[mf->v2].co, mvert[mf->v3].co)) {
-			isect_count++;
-		} else if (mf->v4 && pointInside_internal(vec->vec,mvert[mf->v1].co, mvert[mf->v3].co, mvert[mf->v4].co)) {
-			
-			isect_count++;
+		if (!selected_only || mf->flag & ME_FACE_SEL) {
+			if (pointInside_internal(vec->vec, mvert[mf->v1].co, mvert[mf->v2].co, mvert[mf->v3].co)) {
+				isect_count++;
+			} else if (mf->v4 && pointInside_internal(vec->vec,mvert[mf->v1].co, mvert[mf->v3].co, mvert[mf->v4].co)) {
+				
+				isect_count++;
+			}
 		}
 	}
 	
@@ -7536,7 +7542,7 @@
 		"Removes duplicates from selected vertices (experimental)"},
 	{"recalcNormals", (PyCFunction)Mesh_recalcNormals, METH_VARARGS,
 		"Recalculates inside or outside normals (experimental)"},
-	{"pointInside", (PyCFunction)Mesh_pointInside, METH_O,
+	{"pointInside", (PyCFunction)Mesh_pointInside, METH_VARARGS|METH_KEYWORDS,
 		"Recalculates inside or outside normals (experimental)"},
 	
 	/* mesh custom data layers */

Modified: branches/cloth/blender/source/blender/python/api2_2x/doc/Curve.py
===================================================================
--- branches/cloth/blender/source/blender/python/api2_2x/doc/Curve.py	2007-11-24 18:29:33 UTC (rev 12664)
+++ branches/cloth/blender/source/blender/python/api2_2x/doc/Curve.py	2007-11-24 22:49:56 UTC (rev 12665)
@@ -10,7 +10,7 @@
 
 A Blender Curve Data consists of multiple L{CurNurb}(s). Try converting a Text object to a Curve to see an example of this.   Each curve is of
 type Bezier or Nurb.  The underlying L{CurNurb}(s) can be accessed with
-the [] operator.  Operator [] returns an object of type L{CurNurb}.
+the [] operator.  Operator [] returns an object of type L{CurNurb}. Removing a L{CurNurb} can be done this way too. del curve[0] removes the first curve.
 
 Note that L{CurNurb} can be used to acces a curve of any type (Poly, Bezier or Nurb)
 

Modified: branches/cloth/blender/source/blender/python/api2_2x/doc/Mesh.py
===================================================================

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list