[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11381] branches/soc-2007-red_fox: Merge 11319:11378 from /trunk/blender

Levi Schooley redfox at hhofministries.org
Fri Jul 27 03:33:44 CEST 2007


Revision: 11381
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11381
Author:   red_fox
Date:     2007-07-27 03:33:14 +0200 (Fri, 27 Jul 2007)

Log Message:
-----------
Merge 11319:11378 from /trunk/blender

Just my weekly sync with /trunk/blender.

Levi

Modified Paths:
--------------
    branches/soc-2007-red_fox/release/scripts/uv_export.py
    branches/soc-2007-red_fox/source/blender/blenkernel/BKE_constraint.h
    branches/soc-2007-red_fox/source/blender/blenkernel/intern/constraint.c
    branches/soc-2007-red_fox/source/blender/blenloader/intern/readfile.c
    branches/soc-2007-red_fox/source/blender/blenloader/intern/writefile.c
    branches/soc-2007-red_fox/source/blender/include/butspace.h
    branches/soc-2007-red_fox/source/blender/makesdna/DNA_constraint_types.h
    branches/soc-2007-red_fox/source/blender/makesdna/DNA_texture_types.h
    branches/soc-2007-red_fox/source/blender/nodes/intern/CMP_nodes/CMP_math.c
    branches/soc-2007-red_fox/source/blender/python/BPY_interface.c
    branches/soc-2007-red_fox/source/blender/python/api2_2x/Constraint.c
    branches/soc-2007-red_fox/source/blender/python/api2_2x/Curve.c
    branches/soc-2007-red_fox/source/blender/python/api2_2x/Draw.c
    branches/soc-2007-red_fox/source/blender/python/api2_2x/Draw.h
    branches/soc-2007-red_fox/source/blender/python/api2_2x/Object.c
    branches/soc-2007-red_fox/source/blender/python/api2_2x/Scene.c
    branches/soc-2007-red_fox/source/blender/python/api2_2x/Texture.c
    branches/soc-2007-red_fox/source/blender/python/api2_2x/Window.c
    branches/soc-2007-red_fox/source/blender/python/api2_2x/doc/Constraint.py
    branches/soc-2007-red_fox/source/blender/render/intern/include/render_types.h
    branches/soc-2007-red_fox/source/blender/render/intern/include/rendercore.h
    branches/soc-2007-red_fox/source/blender/render/intern/source/convertblender.c
    branches/soc-2007-red_fox/source/blender/render/intern/source/envmap.c
    branches/soc-2007-red_fox/source/blender/render/intern/source/pipeline.c
    branches/soc-2007-red_fox/source/blender/render/intern/source/rendercore.c
    branches/soc-2007-red_fox/source/blender/render/intern/source/shadeoutput.c
    branches/soc-2007-red_fox/source/blender/render/intern/source/texture.c
    branches/soc-2007-red_fox/source/blender/src/buttons_object.c
    branches/soc-2007-red_fox/source/blender/src/buttons_shading.c
    branches/soc-2007-red_fox/source/blender/src/drawaction.c
    branches/soc-2007-red_fox/source/blender/src/editaction.c
    branches/soc-2007-red_fox/source/blender/src/editconstraint.c
    branches/soc-2007-red_fox/source/blender/src/editipo.c
    branches/soc-2007-red_fox/source/blender/src/transform.c
    branches/soc-2007-red_fox/source/blender/src/transform_conversions.c

Added Paths:
-----------
    branches/soc-2007-red_fox/source/blender/render/extern/include/RE_raytrace.h
    branches/soc-2007-red_fox/source/blender/render/intern/source/rayshade.c
    branches/soc-2007-red_fox/source/blender/render/intern/source/raytrace.c

Removed Paths:
-------------
    branches/soc-2007-red_fox/bin/.blender/locale/pt_br/
    branches/soc-2007-red_fox/bin/.blender/locale/zh_cn/
    branches/soc-2007-red_fox/source/blender/render/intern/source/ray.c

Modified: branches/soc-2007-red_fox/release/scripts/uv_export.py
===================================================================
--- branches/soc-2007-red_fox/release/scripts/uv_export.py	2007-07-26 16:27:02 UTC (rev 11380)
+++ branches/soc-2007-red_fox/release/scripts/uv_export.py	2007-07-27 01:33:14 UTC (rev 11381)
@@ -9,7 +9,7 @@
 
 __author__ = "Martin 'theeth' Poirier"
 __url__ = ("http://www.blender.org", "http://blenderartists.org/")
-__version__ = "2.4"
+__version__ = "2.5"
 
 __bpydoc__ = """\
 This script exports the UV face layout of the selected mesh object to
@@ -96,6 +96,11 @@
 #	Version 2.4
 # Port from NMesh to Mesh by Daniel Salazar (zanqdo)
 # --------------------------
+#	Version 2.5
+# Fixed some old off by one rasterizing errors (didn't render points at 1.0 in the UV scale properly).
+# Fixed wire drawing for non 1 wire size (didn't wrap or stretch properly 
+# and would often raise exceptions)
+# --------------------------
 
 
 FullPython = False
@@ -322,7 +327,7 @@
 	
 	step = 0
 
-	img = Buffer(size+1,size+1)
+	img = Buffer(size,size)
 
 	if wrap:
 		wrapSize = size
@@ -333,15 +338,16 @@
 		for f in vList:
 			for v in f:
 				x = int(v[0] * size)
-				maxx = max (x, maxx)
-				minx = min (x, minx)
+				maxx = max (x + wsize - 1, maxx)
+				minx = min (x - wsize + 1, minx)
 				
 				y = int(v[1] * size)
-				maxy = max (y, maxy)
-				miny = min (y, miny)
+				maxy = max (y + wsize - 1, maxy)
+				miny = min (y - wsize + 1, miny)
 		wrapSize = max (maxx - minx + 1, maxy - miny + 1)
 		scale = float (size) / float (wrapSize)
 
+	max_index = size - 1 # max index of the buffer (height or width)
 	fnum = 0
 	fcnt = len (vList)
 
@@ -361,31 +367,31 @@
 			if step:
 				try:
 					for t in xrange(step):
-							x = int(floor((co1[0] + t*(co2[0]-co1[0])/step) * size))
-							y = int(floor((co1[1] + t*(co2[1]-co1[1])/step) * size))
+							x = int(floor((co1[0] + t*(co2[0]-co1[0])/step) * max_index))
+							y = int(floor((co1[1] + t*(co2[1]-co1[1])/step) * max_index))
 		
-							if wrap:
-								x = x % wrapSize
-								y = y % wrapSize
-							else:
-								x = int ((x - minx) * scale)
-								y = int ((y - miny) * scale)
-								
-							co = x * 1 + y * 1 * size;
-							
-							img[co] = 0
-							if wsize > 1:
-								for x in range(-1*wsize + 1,wsize):
-									for y in range(-1*wsize,wsize):
-										img[co + 1 * x + y * 1 * size] = 0
+							for dx in range(-1*wsize + 1, wsize):
+								if wrap:
+									wx = (x + dx) % wrapSize
+								else:
+									wx = int ((x - minx + dx) * scale)
+									
+								for dy in range(-1*wsize + 1, wsize):
+									if wrap:
+										wy = (y + dy) % wrapSize
+									else:
+										wy = int ((y - miny + dy) * scale)
+									
+									co = wx * 1 + wy * 1 * size
+									img[co] = 0
 				except OverflowError:
 					if not extreme_warning:
 						print "Skipping extremely long UV edges, check your layout for excentric values"
 						extreme_warning = True
 		
 		for v in f:
-			x = int(v[0] * size)
-			y = int(v[1] * size)
+			x = int(v[0] * max_index)
+			y = int(v[1] * max_index)
 
 			if wrap:
 				x = x % wrapSize

Modified: branches/soc-2007-red_fox/source/blender/blenkernel/BKE_constraint.h
===================================================================
--- branches/soc-2007-red_fox/source/blender/blenkernel/BKE_constraint.h	2007-07-26 16:27:02 UTC (rev 11380)
+++ branches/soc-2007-red_fox/source/blender/blenkernel/BKE_constraint.h	2007-07-27 01:33:14 UTC (rev 11381)
@@ -25,7 +25,7 @@
  *
  * The Original Code is: all of this file.
  *
- * Contributor(s): none yet.
+ * Contributor(s): 2007 - Joshua Leung (major recode)
  *
  * ***** END GPL/BL DUAL LICENSE BLOCK *****
  */

Modified: branches/soc-2007-red_fox/source/blender/blenkernel/intern/constraint.c
===================================================================
--- branches/soc-2007-red_fox/source/blender/blenkernel/intern/constraint.c	2007-07-26 16:27:02 UTC (rev 11380)
+++ branches/soc-2007-red_fox/source/blender/blenkernel/intern/constraint.c	2007-07-27 01:33:14 UTC (rev 11381)
@@ -267,6 +267,12 @@
 			if (data->tar) return 1;
 		}
 		break;
+	case CONSTRAINT_TYPE_TRANSFORM:
+		{
+			bTransformConstraint *data = con->data;
+			if (data->tar) return 1;
+		}
+		break;
 	}
 	
 	/* Unknown types or CONSTRAINT_TYPE_NULL or no target */
@@ -377,6 +383,13 @@
 			return data->tar;
 		}
 		break;
+	case CONSTRAINT_TYPE_TRANSFORM:	
+		{
+			bTransformConstraint *data = con->data;
+			*subtarget= data->subtarget;
+			return data->tar;
+		}
+		break;
 	default:
 		*subtarget= NULL;
 		break;
@@ -484,6 +497,13 @@
 			if (subtarget) BLI_strncpy(data->subtarget, subtarget, 32);
 		}
 			break;
+		case CONSTRAINT_TYPE_TRANSFORM:
+		{
+			bTransformConstraint *data = con->data;
+			data->tar= ob;
+			if (subtarget) BLI_strncpy(data->subtarget, subtarget, 32);
+		}
+			break;
 	}
 }
 
@@ -714,6 +734,18 @@
 			result = data;
 		}
 		break;
+	case CONSTRAINT_TYPE_TRANSFORM:
+		{
+			bTransformConstraint *data;
+			data = MEM_callocN(sizeof(bTransformConstraint), "TransformationConstraint");
+			
+			data->map[0]= 0;
+			data->map[1]= 1;
+			data->map[2]= 2;
+			
+			result = data;
+		}
+		break;
   
    	default:
 		result = NULL;
@@ -786,7 +818,7 @@
 				cob->type = datatype;
 				
 				/* matrix in world-space */
-				Mat4MulMat4 (cob->matrix, cob->pchan->pose_mat, ob->obmat);
+				Mat4MulMat4(cob->matrix, cob->pchan->pose_mat, ob->obmat);
 				Mat4CpyMat4(cob->startmat, cob->matrix);
 			}
 			else
@@ -985,9 +1017,30 @@
 							VECCOPY(offs_bone[3], pchan->bone->head);
 							offs_bone[3][1]+= pchan->parent->bone->length;
 							
-							Mat4MulMat4(diff_mat, offs_bone, pchan->parent->pose_mat);
-							Mat4CpyMat4(tempmat, mat);
-							Mat4MulMat4(mat, tempmat, diff_mat);
+							if (pchan->bone->flag & BONE_HINGE) {
+								/* pose_mat = par_pose-space_location * chan_mat */
+								float tmat[4][4];
+								
+								/* the rotation of the parent restposition */
+								Mat4CpyMat4(tmat, pchan->parent->bone->arm_mat);
+								
+								/* the location of actual parent transform */
+								VECCOPY(tmat[3], offs_bone[3]);
+								offs_bone[3][0]= offs_bone[3][1]= offs_bone[3][2]= 0.0f;
+								Mat4MulVecfl(pchan->parent->pose_mat, tmat[3]);
+								
+								Mat4MulMat4(diff_mat, offs_bone, tmat);
+								
+								Mat4MulMat4(diff_mat, pchan->parent->pose_mat, offs_bone);
+								Mat4CpyMat4(tempmat, mat);
+								Mat4MulMat4(mat, tempmat, diff_mat);
+							}
+							else {
+								/* pose_mat = par_pose_mat * bone_mat * chan_mat */
+								Mat4MulMat4(diff_mat, pchan->parent->pose_mat, offs_bone);
+								Mat4CpyMat4(tempmat, mat);
+								Mat4MulMat4(mat, tempmat, diff_mat);
+							}
 						}
 						else {
 							Mat4CpyMat4(diff_mat, pchan->bone->arm_mat);
@@ -1504,6 +1557,19 @@
 				Mat4One(mat);
 		}
 		break;
+	case CONSTRAINT_TYPE_TRANSFORM:
+		{
+			bTransformConstraint *data;
+			data= (bTransformConstraint *)con->data;
+			
+			if (data->tar) {
+				constraint_target_to_mat4(data->tar, data->subtarget, mat, CONSTRAINT_SPACE_WORLD, con->tarspace);
+				valid = 1;
+			}
+			else
+				Mat4One(mat);
+		}
+		break;
 
 	default:
 		Mat4One(mat);
@@ -2466,8 +2532,109 @@
 			}
 		}
 		break;
+	case CONSTRAINT_TYPE_TRANSFORM:
+		{
+			bTransformConstraint *data;
+			
+			data = constraint->data;
+			
+			/* only work if there is a target */
+			if (data->tar) {
+				float loc[3], eul[3], size[3];
+				float dvec[3], sval[3];
+				short i;
+				
+				/* obtain target effect */
+				switch (data->from) {
+					case 2:	/* scale */
+					{
+						Mat4ToSize(targetmat, dvec);
+					}
+						break;
+					case 1: /* rotation */
+					{
+						/* copy, and reduce to smallest rotation distance */
+						Mat4ToEul(targetmat, dvec);
+						
+						/* reduce rotation */
+						for (i=0; i<3; i++)
+							dvec[i]= fmod(dvec[i], M_PI*2);
+					}
+						break;
+					default: /* location */
+					{
+						VECCOPY(dvec, targetmat[3]);
+					}
+						break;
+				}
+				
+				/* extract components of owner's matrix */
+				VECCOPY(loc, ownermat[3]);
+				Mat4ToEul(ownermat, eul);
+				Mat4ToSize(ownermat, size);
+				
+				/* determine where in range current transforms lie */
+				if (data->expo) {
+					for (i=0; i<3; i++) {
+						if (data->from_max[i] - data->from_min[i])
+							sval[i]= (dvec[i] - data->from_min[i]) / (data->from_max[i] - data->from_min[i]);
+						else
+							sval[i]= 0.0f;
+					}
+				}
+				else {
+					/* clamp transforms out of range */
+					for (i=0; i<3; i++) {
+						CLAMP(dvec[i], data->from_min[i], data->from_max[i]);
+						if (data->from_max[i] - data->from_min[i])
+							sval[i]= (dvec[i] - data->from_min[i]) / (data->from_max[i] - data->from_min[i]);
+						else
+							sval[i]= 0.0f;
+					}
+				}
+				
+				/* convert radian<->degree */
+				if (data->from==1 && data->to==0) {
+					/* from radians to degrees */
+					for (i=0; i<3; i++) 
+						sval[i] = sval[i] / M_PI * 180;
+				}
+				else if (data->from==0 && data->to==1) {
+					/* from degrees to radians */
+					for (i=0; i<3; i++) 
+						sval[i] = sval[i] / 180 * M_PI;
+				}
+				
+				/* apply transforms */
+				switch (data->to) {
+					case 2: /* scaling */
+						for (i=0; i<3; i++)
+							size[i]= data->to_min[i] + (sval[data->map[i]] * (data->to_max[i] - data->to_min[i])); 
+						break;
+					case 1: /* rotation */
+						for (i=0; i<3; i++) {
+							float tmin, tmax;
+							
+							/* convert destination min/max ranges from degrees to radians */
+							tmin= data->to_min[i] / M_PI * 180;
+							tmax= data->to_max[i] / M_PI * 180;
+							
+							eul[i]= tmin + (sval[data->map[i]] * (tmax - tmin)); 
+						}
+						break;
+					default: /* location */
+						for (i=0; i<3; i++)
+							loc[i] += (data->to_min[i] + (sval[data->map[i]] * (data->to_max[i] - data->to_min[i]))); 
+						break;
+				}
+				
+				/* apply to matrix */
+				LocEulSizeToMat4(ownermat, loc, eul, size);
+			}
+		}
+		break;
 	default:
-		printf ("Error: Unknown constraint type\n");
+		printf("Error: Unknown constraint type\n");
 		break;
 	}
 }
@@ -2489,6 +2656,8 @@
 	for (con= conlist->first; con; con= con->next) {
 		/* this we can skip completely */
 		if (con->flag & CONSTRAINT_DISABLE) continue;
+		/* influence == 0 should be ignored */
+		if (con->enforce == 0.0f) continue;
 		/* and inverse kinematics is solved seperate */ 
 		if (con->type==CONSTRAINT_TYPE_KINEMATIC) continue;
 		/* rigidbody is really a game-engine thing - and is not solved here */


@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list