[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46977] branches/soc-2011-tomato/source/ blender: fix bug in own recent edits - shape key insertion

Campbell Barton ideasman42 at gmail.com
Thu May 24 17:29:51 CEST 2012


Revision: 46977
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46977
Author:   campbellbarton
Date:     2012-05-24 15:29:50 +0000 (Thu, 24 May 2012)
Log Message:
-----------
fix bug in own recent edits - shape key insertion 

Modified Paths:
--------------
    branches/soc-2011-tomato/source/blender/blenkernel/intern/mask.c
    branches/soc-2011-tomato/source/blender/editors/mask/mask_shapekey.c

Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/mask.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/mask.c	2012-05-24 14:56:09 UTC (rev 46976)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/mask.c	2012-05-24 15:29:50 UTC (rev 46977)
@@ -1186,7 +1186,7 @@
 		if (frame == maskobj_shape->frame) {
 			return maskobj_shape;
 		}
-		else if (frame > maskobj_shape->frame) {
+		else if (frame < maskobj_shape->frame) {
 			break;
 		}
 	}
@@ -1249,6 +1249,19 @@
 		BKE_mask_object_shape_sort(maskobj);
 	}
 
+#if 0
+		{
+			MaskObjectShape *maskobj_shape;
+			int i = 0;
+			for (maskobj_shape = maskobj->splines_shapes.first;
+			     maskobj_shape;
+			     maskobj_shape = maskobj_shape->next)
+			{
+				printf("mask %d, %d\n", i++, maskobj_shape->frame);
+			}
+		}
+#endif
+
 	return maskobj_shape;
 }
 

Modified: branches/soc-2011-tomato/source/blender/editors/mask/mask_shapekey.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/mask/mask_shapekey.c	2012-05-24 14:56:09 UTC (rev 46976)
+++ branches/soc-2011-tomato/source/blender/editors/mask/mask_shapekey.c	2012-05-24 15:29:50 UTC (rev 46977)
@@ -62,18 +62,25 @@
 	const int frame = CFRA;
 	Mask *mask = CTX_data_edit_mask(C);
 	MaskObject *maskobj;
+	int change = FALSE;
 
 	for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
 		MaskObjectShape *maskobj_shape;
 
 		maskobj_shape = BKE_mask_object_shape_varify_frame(maskobj, frame);
 		BKE_mask_object_shape_from_mask(maskobj, maskobj_shape);
+		change = TRUE;
 	}
 
-	WM_event_add_notifier(C, NC_MASK | ND_DATA, mask);
-	DAG_id_tag_update(&mask->id, 0);
+	if (change) {
+		WM_event_add_notifier(C, NC_MASK | ND_DATA, mask);
+		DAG_id_tag_update(&mask->id, 0);
 
-	return OPERATOR_FINISHED;
+		return OPERATOR_FINISHED;
+	}
+	else {
+		return OPERATOR_CANCELLED;
+	}
 }
 
 void MASK_OT_shape_key_insert(wmOperatorType *ot)
@@ -97,6 +104,7 @@
 	const int frame = CFRA;
 	Mask *mask = CTX_data_edit_mask(C);
 	MaskObject *maskobj;
+	int change = FALSE;
 
 	for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
 		MaskObjectShape *maskobj_shape;
@@ -105,13 +113,19 @@
 
 		if (maskobj_shape) {
 			BKE_mask_object_shape_unlink(maskobj, maskobj_shape);
+			change = TRUE;
 		}
 	}
 
-	WM_event_add_notifier(C, NC_MASK | ND_DATA, mask);
-	DAG_id_tag_update(&mask->id, 0);
+	if (change) {
+		WM_event_add_notifier(C, NC_MASK | ND_DATA, mask);
+		DAG_id_tag_update(&mask->id, 0);
 
-	return OPERATOR_FINISHED;
+		return OPERATOR_FINISHED;
+	}
+	else {
+		return OPERATOR_CANCELLED;
+	}
 }
 
 void MASK_OT_shape_key_clear(wmOperatorType *ot)




More information about the Bf-blender-cvs mailing list