[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15241] branches/apricot/source: svn merge -r15232:HEAD https://svn.blender.org/svnroot/bf-blender/trunk/ blender/

Campbell Barton ideasman42 at gmail.com
Mon Jun 16 11:23:25 CEST 2008


Revision: 15241
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15241
Author:   campbellbarton
Date:     2008-06-16 11:23:14 +0200 (Mon, 16 Jun 2008)

Log Message:
-----------
svn  merge  -r15232:HEAD https://svn.blender.org/svnroot/bf-blender/trunk/blender/

Modified Paths:
--------------
    branches/apricot/source/blender/blenkernel/intern/armature.c
    branches/apricot/source/blender/imbuf/intern/cineon/dpxlib.c
    branches/apricot/source/blender/src/buttons_editing.c
    branches/apricot/source/blender/src/transform_snap.c
    branches/apricot/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp

Modified: branches/apricot/source/blender/blenkernel/intern/armature.c
===================================================================
--- branches/apricot/source/blender/blenkernel/intern/armature.c	2008-06-16 09:16:04 UTC (rev 15240)
+++ branches/apricot/source/blender/blenkernel/intern/armature.c	2008-06-16 09:23:14 UTC (rev 15241)
@@ -1709,13 +1709,13 @@
 
 	if (tree->totchannel == 0)
 		return;
-
+	
 	iktree= MEM_mallocN(sizeof(void*)*tree->totchannel, "ik tree");
 
 	for(a=0; a<tree->totchannel; a++) {
 		pchan= tree->pchan[a];
 		bone= pchan->bone;
-
+		
 		/* set DoF flag */
 		flag= 0;
 		if(!(pchan->ikflag & BONE_IK_NO_XDOF) && !(pchan->ikflag & BONE_IK_NO_XDOF_TEMP))
@@ -1724,32 +1724,32 @@
 			flag |= IK_YDOF;
 		if(!(pchan->ikflag & BONE_IK_NO_ZDOF) && !(pchan->ikflag & BONE_IK_NO_ZDOF_TEMP))
 			flag |= IK_ZDOF;
-
+		
 		if(tree->stretch && (pchan->ikstretch > 0.0)) {
 			flag |= IK_TRANS_YDOF;
 			hasstretch = 1;
 		}
-
+		
 		seg= iktree[a]= IK_CreateSegment(flag);
-
+		
 		/* find parent */
 		if(a == 0)
 			parent= NULL;
 		else
 			parent= iktree[tree->parent[a]];
-
+			
 		IK_SetParent(seg, parent);
-	
+			
 		/* get the matrix that transforms from prevbone into this bone */
 		Mat3CpyMat4(R_bonemat, pchan->pose_mat);
-
+		
 		/* gather transformations for this IK segment */
-
+		
 		if (pchan->parent)
 			Mat3CpyMat4(R_parmat, pchan->parent->pose_mat);
 		else
 			Mat3One(R_parmat);
-
+		
 		/* bone offset */
 		if (pchan->parent && (a > 0))
 			VecSubf(start, pchan->pose_head, pchan->parent->pose_tail);
@@ -1759,37 +1759,37 @@
 		
 		/* change length based on bone size */
 		length= bone->length*VecLength(R_bonemat[1]);
-
+		
 		/* compute rest basis and its inverse */
 		Mat3CpyMat3(rest_basis, bone->bone_mat);
 		Mat3CpyMat3(irest_basis, bone->bone_mat);
 		Mat3Transp(irest_basis);
-
+		
 		/* compute basis with rest_basis removed */
 		Mat3Inv(iR_parmat, R_parmat);
 		Mat3MulMat3(full_basis, iR_parmat, R_bonemat);
 		Mat3MulMat3(basis, irest_basis, full_basis);
-
+		
 		/* basis must be pure rotation */
 		Mat3Ortho(basis);
-
+		
 		/* transform offset into local bone space */
 		Mat3Ortho(iR_parmat);
 		Mat3MulVecfl(iR_parmat, start);
-
+		
 		IK_SetTransform(seg, start, rest_basis, basis, length);
-
+		
 		if (pchan->ikflag & BONE_IK_XLIMIT)
 			IK_SetLimit(seg, IK_X, pchan->limitmin[0], pchan->limitmax[0]);
 		if (pchan->ikflag & BONE_IK_YLIMIT)
 			IK_SetLimit(seg, IK_Y, pchan->limitmin[1], pchan->limitmax[1]);
 		if (pchan->ikflag & BONE_IK_ZLIMIT)
 			IK_SetLimit(seg, IK_Z, pchan->limitmin[2], pchan->limitmax[2]);
-
+		
 		IK_SetStiffness(seg, IK_X, pchan->stiffness[0]);
 		IK_SetStiffness(seg, IK_Y, pchan->stiffness[1]);
 		IK_SetStiffness(seg, IK_Z, pchan->stiffness[2]);
-
+		
 		if(tree->stretch && (pchan->ikstretch > 0.0)) {
 			float ikstretch = pchan->ikstretch*pchan->ikstretch;
 			IK_SetStiffness(seg, IK_TRANS_Y, MIN2(1.0-ikstretch, 0.99));
@@ -1818,7 +1818,7 @@
 	for (target=tree->targets.first; target; target=target->next) {
 		float polepos[3];
 		int poleconstrain= 0;
-
+		
 		data= (bKinematicConstraint*)target->con->data;
 		
 		/* 1.0=ctime, we pass on object for auto-ik (owner-type here is object, even though
@@ -1835,7 +1835,7 @@
 		/* same for pole vector target */
 		if(data->poletar) {
 			get_constraint_target_matrix(target->con, 1, CONSTRAINT_OBTYPE_OBJECT, ob, rootmat, 1.0);
-
+			
 			if(data->flag & CONSTRAINT_IK_SETANGLE) {
 				/* don't solve IK when we are setting the pole angle */
 				break;
@@ -1844,7 +1844,7 @@
 				Mat4MulMat4(goal, rootmat, goalinv);
 				VECCOPY(polepos, goal[3]);
 				poleconstrain= 1;
-
+				
 				if(data->flag & CONSTRAINT_IK_GETANGLE) {
 					poleangledata= data;
 					data->flag &= ~CONSTRAINT_IK_GETANGLE;
@@ -1903,36 +1903,35 @@
 	tree->basis_change= MEM_mallocN(sizeof(float[3][3])*tree->totchannel, "ik basis change");
 	if(hasstretch)
 		ikstretch= MEM_mallocN(sizeof(float)*tree->totchannel, "ik stretch");
-
+		
 	for(a=0; a<tree->totchannel; a++) {
 		IK_GetBasisChange(iktree[a], tree->basis_change[a]);
-
+		
 		if(hasstretch) {
 			/* have to compensate for scaling received from parent */
 			float parentstretch, stretch;
-
+			
 			pchan= tree->pchan[a];
 			parentstretch= (tree->parent[a] >= 0)? ikstretch[tree->parent[a]]: 1.0;
-
+			
 			if(tree->stretch && (pchan->ikstretch > 0.0)) {
 				float trans[3], length;
-
+				
 				IK_GetTranslationChange(iktree[a], trans);
 				length= pchan->bone->length*VecLength(pchan->pose_mat[1]);
-
+				
 				ikstretch[a]= (length == 0.0)? 1.0: (trans[1]+length)/length;
 			}
 			else
 				ikstretch[a] = 1.0;
-
+			
 			stretch= (parentstretch == 0.0)? 1.0: ikstretch[a]/parentstretch;
-
+			
 			VecMulf(tree->basis_change[a][0], stretch);
 			VecMulf(tree->basis_change[a][1], stretch);
 			VecMulf(tree->basis_change[a][2], stretch);
-
 		}
-
+		
 		IK_FreeSegment(iktree[a]);
 	}
 	

Modified: branches/apricot/source/blender/imbuf/intern/cineon/dpxlib.c
===================================================================
--- branches/apricot/source/blender/imbuf/intern/cineon/dpxlib.c	2008-06-16 09:16:04 UTC (rev 15240)
+++ branches/apricot/source/blender/imbuf/intern/cineon/dpxlib.c	2008-06-16 09:23:14 UTC (rev 15241)
@@ -441,10 +441,15 @@
 		default: break;
 		}
 	}
-	dpx->bitsPerPixel = 10;
-	/* dpx->bitsPerPixel = header.imageInfo.channel[0].bits_per_pixel; */
+	/* dpx->bitsPerPixel = 10; */
+	dpx->bitsPerPixel = header.imageInfo.channel[0].bits_per_pixel;
+	if (dpx->bitsPerPixel != 10) {
+		if (verbose) d_printf("Don't support depth: %d\n", dpx->bitsPerPixel);
+		dpxClose(dpx);
+		return 0;
+	}
+
 	dpx->imageOffset = ntohl(header.fileInfo.offset);
-
 	dpx->lineBufferLength = pixelsToLongs(dpx->width * dpx->depth);
 	dpx->lineBuffer = malloc(dpx->lineBufferLength * 4);
 	if (dpx->lineBuffer == 0) {
@@ -471,6 +476,26 @@
 	dpx->fileYPos = 0;
 
 	logImageGetByteConversionDefaults(&dpx->params);
+	/* The SMPTE define this code:
+	 *  2 - Linear
+	 *  3 - Logarithmic
+	 *
+	 * Note that transfer_characteristics is U8, don't need
+	 * check the byte order.
+	 */
+	switch (header.imageInfo.channel[0].transfer_characteristics) {
+		case 2:
+			dpx->params.doLogarithm= 0;
+			break;
+		case 3:
+			dpx->params.doLogarithm= 1;
+			break;
+		default:
+			if (verbose) d_printf("Un-supported Transfer Characteristics: %d\n", header.imageInfo.channel[0].transfer_characteristics);
+			dpxClose(dpx);
+			return 0;
+			break;
+	}
 	setupLut(dpx);
 
 	dpx->getRow = &dpxGetRowBytes;
@@ -563,6 +588,18 @@
 		++shortFilename;
 	}
 	initDpxMainHeader(dpx, &header, shortFilename);
+	logImageGetByteConversionDefaults(&dpx->params);
+	/* Need set the file type before write the header!
+	 *  2 - Linear
+	 *  3 - Logarithmic
+	 *
+	 * Note that transfer characteristics is U8, don't need
+	 * check the byte order.
+	 */
+	if (dpx->params.doLogarithm == 0)
+		header.imageInfo.channel[0].transfer_characteristics= 2;
+	else
+		header.imageInfo.channel[0].transfer_characteristics= 3;
 
 	if (fwrite(&header, sizeof(header), 1, dpx->file) == 0) {
 		if (verbose) d_printf("Couldn't write image header\n");
@@ -570,8 +607,6 @@
 		return 0;
 	}
 	dpx->fileYPos = 0;
-
-	logImageGetByteConversionDefaults(&dpx->params);
 	setupLut(dpx);
 
 	dpx->getRow = 0;

Modified: branches/apricot/source/blender/src/buttons_editing.c
===================================================================
--- branches/apricot/source/blender/src/buttons_editing.c	2008-06-16 09:16:04 UTC (rev 15240)
+++ branches/apricot/source/blender/src/buttons_editing.c	2008-06-16 09:23:14 UTC (rev 15241)
@@ -2403,7 +2403,7 @@
 				but= uiDefBut(block, BUT, B_MODIFIER_RECALC, "Bind", lx,(cy-=24), buttonWidth,19, 0, 0, 0, 0, 0, "Bind mesh to cage");
 				uiButSetFunc(but,modifiers_bindMeshDeform,ob,md);
 				uiDefButS(block, NUM, B_NOP, "Precision:", lx,(cy-19), buttonWidth/2 + 20,19, &mmd->gridsize, 2, 10, 0.5, 0, "The grid size for binding");
-				uiDefButBitS(block, TOG, MOD_MDEF_DYNAMIC_BIND, B_MODIFIER_RECALC, "Dynamic", lx+(buttonWidth+1)/2 + 20, (cy-=19), buttonWidth/2 - 20,19, &mmd->flag, 0.0, 31.0, 0, 0, "Invert vertex group influence");
+				uiDefButBitS(block, TOG, MOD_MDEF_DYNAMIC_BIND, B_MODIFIER_RECALC, "Dynamic", lx+(buttonWidth+1)/2 + 20, (cy-=19), buttonWidth/2 - 20,19, &mmd->flag, 0.0, 31.0, 0, 0, "Recompute binding dynamically on top of other deformers like Shape Keys (slower and more memory consuming!)");
 			}
 			uiBlockEndAlign(block);
 		} else if (md->type==eModifierType_ParticleSystem) {

Modified: branches/apricot/source/blender/src/transform_snap.c
===================================================================
--- branches/apricot/source/blender/src/transform_snap.c	2008-06-16 09:16:04 UTC (rev 15240)
+++ branches/apricot/source/blender/src/transform_snap.c	2008-06-16 09:23:14 UTC (rev 15241)
@@ -739,9 +739,10 @@
 
 
 /* find snapping point on face, return 1 on success */
-int snapFace(MFace *face, MVert *verts, float *intersect, float *loc, float *no)
+int snapFace(MFace *face, EditFace *efa, MVert *verts, float *intersect, float *loc, float *no)
 {
 	MVert *v[4];
+	EditVert *eve[4];
 	int totvert;
 	int result = 0;
 	
@@ -760,6 +761,14 @@
 		totvert = 3;
 	}
 	
+	if (efa)
+	{
+		eve[0] = efa->v1;
+		eve[1] = efa->v2;
+		eve[2] = efa->v3;
+		eve[3] = efa->v4;
+	}
+	
 	switch(G.scene->snap_mode)
 	{
 		case SCE_SNAP_MODE_VERTEX:
@@ -769,16 +778,20 @@
 				
 				for(i = 0; i < totvert; i++)
 				{
-					float vert_dist = VecLenf(v[i]->co, intersect);
 					
-					if (vert_dist < min_dist)
+					if (efa == NULL || (eve[i]->f1 & SELECT) == 0)
 					{
-						result = 1;
+						float vert_dist = VecLenf(v[i]->co, intersect);
 						
-						min_dist = vert_dist;
-
-						VECCOPY(loc, v[i]->co);
-						NormalShortToFloat(no, v[i]->no);						
+						if (vert_dist < min_dist)
+						{
+							result = 1;
+							
+							min_dist = vert_dist;
+	
+							VECCOPY(loc, v[i]->co);
+							NormalShortToFloat(no, v[i]->no);						
+						}
 					}
 				}
 				break;
@@ -791,51 +804,62 @@
 				for(i = 0; i < totvert; i++)
 				{
 					MVert *v1, *v2;
-					float edge_loc[3];
-					float vec[3];
-					float mul;
-					float edge_dist;
+					EditVert *eve1, *eve2;
 					
 					v1 = v[i];
 					v2 = v[(i + 1) % totvert];
 					
-					VecSubf(edge_loc, v2->co, v1->co);
-					VecSubf(vec, intersect, v1->co);
+					eve1 = eve[i];
+					eve2 = eve[(i + 1) % totvert];
 					
-					mul = Inpf(vec, edge_loc) / Inpf(edge_loc, edge_loc);
-					
-					VecMulf(edge_loc, mul);
-					VecAddf(edge_loc, edge_loc, v1->co);
-					

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list