[Bf-blender-cvs] [d2382f782e] master: Fix T49527: Blender stalls when changing armature ghosting range with stepsize = 0

Joshua Leung noreply at git.blender.org
Sat Jan 21 14:56:31 CET 2017


Commit: d2382f782e74f9e7b4df49ffc8e40dabb0b8af50
Author: Joshua Leung
Date:   Sun Jan 22 02:54:35 2017 +1300
Branches: master
https://developer.blender.org/rBd2382f782e74f9e7b4df49ffc8e40dabb0b8af50

Fix T49527: Blender stalls when changing armature ghosting range with stepsize = 0

A big thanks to Steffen Mortensen (stifan) for finding the root cause of this bug!

===================================================================

M	source/blender/blenkernel/intern/armature.c
M	source/blender/editors/space_view3d/drawarmature.c

===================================================================

diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 2b333941c6..0287d6ae9c 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -87,6 +87,7 @@ bArmature *BKE_armature_add(Main *bmain, const char *name)
 	arm->deformflag = ARM_DEF_VGROUP | ARM_DEF_ENVELOPE;
 	arm->flag = ARM_COL_CUSTOM; /* custom bone-group colors */
 	arm->layer = 1;
+	arm->ghostsize = 1;
 	return arm;
 }
 
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index 95a2df68e4..149144d969 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -2463,6 +2463,10 @@ static void draw_ghost_poses_range(Scene *scene, View3D *v3d, ARegion *ar, Base
 	if (end <= start)
 		return;
 	
+	/* prevent infinite loops if this is set to 0 - T49527 */
+	if (arm->ghostsize < 1)
+		arm->ghostsize = 1;
+	
 	stepsize = (float)(arm->ghostsize);
 	range = (float)(end - start);
 	
@@ -2608,7 +2612,11 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
 	calc_action_range(adt->action, &start, &end, 0);
 	if (start == end)
 		return;
-
+	
+	/* prevent infinite loops if this is set to 0 - T49527 */
+	if (arm->ghostsize < 1)
+		arm->ghostsize = 1;
+	
 	stepsize = (float)(arm->ghostsize);
 	range = (float)(arm->ghostep) * stepsize + 0.5f;   /* plus half to make the for loop end correct */




More information about the Bf-blender-cvs mailing list