[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22814] trunk/blender/source: - BGE crash fix when casting a ray to the same location as the object from python .

Campbell Barton ideasman42 at gmail.com
Thu Aug 27 08:55:55 CEST 2009


Revision: 22814
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22814
Author:   campbellbarton
Date:     2009-08-27 08:55:54 +0200 (Thu, 27 Aug 2009)

Log Message:
-----------
- BGE crash fix when casting a ray to the same location as the object from python.
- Incorrect Mathutils vector docstrings.
- last rayshade commit had an incomplete comment.

Modified Paths:
--------------
    trunk/blender/source/blender/python/api2_2x/vector.c
    trunk/blender/source/blender/render/intern/source/rayshade.c
    trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp

Modified: trunk/blender/source/blender/python/api2_2x/vector.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/vector.c	2009-08-27 06:03:41 UTC (rev 22813)
+++ trunk/blender/source/blender/python/api2_2x/vector.c	2009-08-27 06:55:54 UTC (rev 22814)
@@ -58,8 +58,8 @@
 	{"normalize", (PyCFunction) Vector_Normalize, METH_NOARGS, Vector_Normalize_doc},
 	{"negate", (PyCFunction) Vector_Negate, METH_NOARGS, Vector_Negate_doc},
 	{"resize2D", (PyCFunction) Vector_Resize2D, METH_NOARGS, Vector_Resize2D_doc},
-	{"resize3D", (PyCFunction) Vector_Resize3D, METH_NOARGS, Vector_Resize2D_doc},
-	{"resize4D", (PyCFunction) Vector_Resize4D, METH_NOARGS, Vector_Resize2D_doc},
+	{"resize3D", (PyCFunction) Vector_Resize3D, METH_NOARGS, Vector_Resize3D_doc},
+	{"resize4D", (PyCFunction) Vector_Resize4D, METH_NOARGS, Vector_Resize4D_doc},
 	{"toTrackQuat", ( PyCFunction ) Vector_ToTrackQuat, METH_VARARGS, Vector_ToTrackQuat_doc},
 	{"reflect", ( PyCFunction ) Vector_Reflect, METH_O, Vector_Reflect_doc},
 	{"cross", ( PyCFunction ) Vector_Cross, METH_O, Vector_Dot_doc},

Modified: trunk/blender/source/blender/render/intern/source/rayshade.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/rayshade.c	2009-08-27 06:03:41 UTC (rev 22813)
+++ trunk/blender/source/blender/render/intern/source/rayshade.c	2009-08-27 06:55:54 UTC (rev 22814)
@@ -1240,7 +1240,9 @@
 			
 			if(shi->combinedflag & SCE_PASS_REFLECT) {
 				/* values in shr->spec can be greater then 1.0.
-				 * in the case when it is 1.0 diff */
+				 * In this case the mircol uses a zero blending factor, so ignoring it is ok.
+				 * Fixes bug #18837 - when the spec is higher then 1.0,
+				 * diff can become a negative color - Campbell  */
 				
 				f1= 1.0f-i;
 				

Modified: trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp	2009-08-27 06:03:41 UTC (rev 22813)
+++ trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp	2009-08-27 06:55:54 UTC (rev 22814)
@@ -2597,12 +2597,10 @@
 		}
 	}
 	MT_Point3 fromPoint = NodeGetWorldPosition();
+	
 	if (dist != 0.0f)
-	{
-		MT_Vector3 toDir = toPoint-fromPoint;
-		toDir.normalize();
-		toPoint = fromPoint + (dist) * toDir;
-	}
+		toPoint = fromPoint + dist * (toPoint-fromPoint).safe_normalized();
+	
 	PHY_IPhysicsEnvironment* pe = KX_GetActiveScene()->GetPhysicsEnvironment();
 	KX_IPhysicsController *spc = GetPhysicsController();
 	KX_GameObject *parent = GetParent();





More information about the Bf-blender-cvs mailing list