[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35829] trunk/blender/source/blender/ editors/transform: [#26622] Blender crashes when calling transform operator

Martin Poirier theeth at yahoo.com
Mon Mar 28 00:15:38 CEST 2011


Revision: 35829
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35829
Author:   theeth
Date:     2011-03-27 22:15:37 +0000 (Sun, 27 Mar 2011)
Log Message:
-----------
[#26622] Blender crashes when calling transform operator

Add cancellation checks for time* transforms that only run in specific spaces.

Hide Transform Mode operator property (it shouldn't be modified after the operator is run), made default mode Translate, not the useless Dummy.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/transform/transform.c
    trunk/blender/source/blender/editors/transform/transform_ops.c

Modified: trunk/blender/source/blender/editors/transform/transform.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform.c	2011-03-27 22:02:54 UTC (rev 35828)
+++ trunk/blender/source/blender/editors/transform/transform.c	2011-03-27 22:15:37 UTC (rev 35829)
@@ -1650,11 +1650,6 @@
 		break;
 	case TFM_EDGE_SLIDE:
 		initEdgeSlide(t);
-		if(t->state == TRANS_CANCEL)
-		{
-			postTrans(C, t);
-			return 0;
-		}
 		break;
 	case TFM_BONE_ROLL:
 		initBoneRoll(t);
@@ -1709,6 +1704,13 @@
 		break;
 	}
 
+	if(t->state == TRANS_CANCEL)
+	{
+		postTrans(C, t);
+		return 0;
+	}
+
+
 	/* overwrite initial values if operator supplied a non-null vector */
 	if (RNA_property_is_set(op->ptr, "value"))
 	{
@@ -5515,6 +5517,11 @@
 
 void initTimeTranslate(TransInfo *t)
 {
+	/* this tool is only really available in the Action Editor... */
+	if (t->spacetype != SPACE_ACTION) {
+		t->state = TRANS_CANCEL;
+	}
+
 	t->mode = TFM_TIME_TRANSLATE;
 	t->transform = TimeTranslate;
 
@@ -5663,8 +5670,11 @@
 
 		/* set flag for drawing stuff */
 		saction->flag |= SACTION_MOVING;
+	} else {
+		t->state = TRANS_CANCEL;
 	}
 
+
 	t->mode = TFM_TIME_SLIDE;
 	t->transform = TimeSlide;
 	t->flag |= T_FREE_CUSTOMDATA;
@@ -5789,6 +5799,11 @@
 {
 	int center[2];
 
+	/* this tool is only really available in the Action Editor... */
+	if (t->spacetype != SPACE_ACTION) {
+		t->state = TRANS_CANCEL;
+	}
+
 	t->mode = TFM_TIME_SCALE;
 	t->transform = TimeScale;
 

Modified: trunk/blender/source/blender/editors/transform/transform_ops.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform_ops.c	2011-03-27 22:02:54 UTC (rev 35828)
+++ trunk/blender/source/blender/editors/transform/transform_ops.c	2011-03-27 22:15:37 UTC (rev 35829)
@@ -755,6 +755,8 @@
 
 void TRANSFORM_OT_transform(struct wmOperatorType *ot)
 {
+	PropertyRNA *prop;
+
 	static EnumPropertyItem transform_mode_types[] = {
 			{TFM_INIT, "INIT", 0, "Init", ""},
 			{TFM_DUMMY, "DUMMY", 0, "Dummy", ""},
@@ -800,7 +802,8 @@
 	ot->cancel  = transform_cancel;
 	ot->poll   = ED_operator_areaactive;
 
-	RNA_def_enum(ot->srna, "mode", transform_mode_types, 0, "Mode", "");
+	prop= RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", "");
+	RNA_def_property_flag(prop, PROP_HIDDEN);
 
 	RNA_def_float_vector(ot->srna, "value", 4, NULL, -FLT_MAX, FLT_MAX, "Values", "", -FLT_MAX, FLT_MAX);
 




More information about the Bf-blender-cvs mailing list