[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47220] branches/soc-2011-tomato/source/ blender/editors: impliment restrict select option.

Campbell Barton ideasman42 at gmail.com
Wed May 30 14:54:51 CEST 2012


Revision: 47220
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47220
Author:   campbellbarton
Date:     2012-05-30 12:54:50 +0000 (Wed, 30 May 2012)
Log Message:
-----------
impliment restrict select option.

Modified Paths:
--------------
    branches/soc-2011-tomato/source/blender/editors/interface/interface_templates.c
    branches/soc-2011-tomato/source/blender/editors/mask/mask_draw.c
    branches/soc-2011-tomato/source/blender/editors/mask/mask_ops.c
    branches/soc-2011-tomato/source/blender/editors/mask/mask_relationships.c
    branches/soc-2011-tomato/source/blender/editors/mask/mask_select.c
    branches/soc-2011-tomato/source/blender/editors/mask/mask_shapekey.c
    branches/soc-2011-tomato/source/blender/editors/transform/transform_conversions.c

Modified: branches/soc-2011-tomato/source/blender/editors/interface/interface_templates.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/interface/interface_templates.c	2012-05-30 12:53:13 UTC (rev 47219)
+++ branches/soc-2011-tomato/source/blender/editors/interface/interface_templates.c	2012-05-30 12:54:50 UTC (rev 47220)
@@ -2242,14 +2242,15 @@
 		}
 	}
 	else if (itemptr->type == &RNA_MaskObject) {
-		split = uiLayoutSplit(sub, 0.5f, 0);
+		split = uiLayoutSplit(sub, 0.66f, 0);
 
 		uiItemL(split, name, icon);
 
 		uiBlockSetEmboss(block, UI_EMBOSSN);
 		row = uiLayoutRow(split, 1);
-		uiItemR(row, itemptr, "alpha", 0, "", ICON_NONE);
+		// uiItemR(row, itemptr, "alpha", 0, "", ICON_NONE); // enable when used
 		uiItemR(row, itemptr, "hide", 0, "", 0);
+		uiItemR(row, itemptr, "hide_select", 0, "", 0);
 
 		uiBlockSetEmboss(block, UI_EMBOSS);
 	}

Modified: branches/soc-2011-tomato/source/blender/editors/mask/mask_draw.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/mask/mask_draw.c	2012-05-30 12:53:13 UTC (rev 47219)
+++ branches/soc-2011-tomato/source/blender/editors/mask/mask_draw.c	2012-05-30 12:54:50 UTC (rev 47220)
@@ -51,7 +51,7 @@
 
 static void set_spline_color(MaskObject *maskobj, MaskSpline *spline)
 {
-	if (spline->flag & SELECT) {
+	if ((spline->flag & SELECT) && (maskobj->restrictflag & MASK_RESTRICT_SELECT) == 0) {
 		if (maskobj->act_spline == spline)
 			glColor3f(1.0f, 1.0f, 1.0f);
 		else
@@ -246,7 +246,7 @@
 	feather_points = BKE_mask_spline_feather_differentiated_points(spline, &tot_feather_point);
 
 	/* draw feather */
-	if (spline->flag & SELECT)
+	if ((spline->flag & SELECT) && (maskobj->restrictflag & MASK_RESTRICT_SELECT) == 0)
 		glColor3f(0.0f, 1.0f, 0.0f);
 	else
 		glColor3f(0.0f, 0.5f, 0.0f);
@@ -278,8 +278,10 @@
 
 //			draw_spline_parents(maskobj, spline);
 
-			/* ...and then handles over the curve so they're nicely visible */
-			draw_spline_points(maskobj, spline);
+			if (!(maskobj->restrictflag & MASK_RESTRICT_SELECT)) {
+				/* ...and then handles over the curve so they're nicely visible */
+				draw_spline_points(maskobj, spline);
+			}
 
 			/* show undeform for testing */
 			if (0) {

Modified: branches/soc-2011-tomato/source/blender/editors/mask/mask_ops.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/mask/mask_ops.c	2012-05-30 12:53:13 UTC (rev 47219)
+++ branches/soc-2011-tomato/source/blender/editors/mask/mask_ops.c	2012-05-30 12:54:50 UTC (rev 47220)
@@ -143,7 +143,7 @@
 	for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
 		MaskSpline *spline;
 
-		if (maskobj->restrictflag & MASK_RESTRICT_VIEW) {
+		if (maskobj->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
 			continue;
 		}
 
@@ -245,7 +245,7 @@
 			int i, tot_feather_point;
 			float *feather_points, *fp;
 
-			if (maskobj->restrictflag & MASK_RESTRICT_VIEW) {
+			if (maskobj->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
 				continue;
 			}
 
@@ -336,7 +336,7 @@
 	for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
 		MaskSpline *spline;
 
-		if (maskobj->restrictflag & MASK_RESTRICT_VIEW) {
+		if (maskobj->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
 			continue;
 		}
 
@@ -1060,9 +1060,8 @@
 	}
 }
 
-static int add_vertex_extrude(bContext *C, Mask *mask, const float co[2])
+static int add_vertex_extrude(bContext *C, Mask *mask, MaskObject *maskobj, const float co[2])
 {
-	MaskObject *maskobj;
 	MaskSpline *spline;
 	MaskSplinePoint *point;
 	MaskSplinePoint *new_point = NULL, *ref_point = NULL;
@@ -1077,8 +1076,6 @@
 
 	ED_mask_select_toggle_all(mask, SEL_DESELECT);
 
-	maskobj = BKE_mask_object_active(mask);
-
 	if (!maskobj) {
 		return FALSE;
 	}
@@ -1163,17 +1160,14 @@
 	return TRUE;
 }
 
-static int add_vertex_new(bContext *C, Mask *mask, const float co[2])
+static int add_vertex_new(bContext *C, Mask *mask, MaskObject *maskobj, const float co[2])
 {
-	MaskObject *maskobj;
 	MaskSpline *spline;
 	MaskSplinePoint *point;
 	MaskSplinePoint *new_point = NULL, *ref_point = NULL;
 
 	ED_mask_select_toggle_all(mask, SEL_DESELECT);
 
-	maskobj = BKE_mask_object_active(mask);
-
 	if (!maskobj) {
 		/* if there's no maskobj currently operationg on, create new one */
 		maskobj = BKE_mask_object_new(mask, "");
@@ -1216,7 +1210,7 @@
 
 	maskobj = BKE_mask_object_active(mask);
 
-	if (maskobj && maskobj->restrictflag & MASK_RESTRICT_VIEW) {
+	if (maskobj->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
 		maskobj = NULL;
 	}
 
@@ -1255,14 +1249,14 @@
 		}
 
 		if (!add_vertex_subdivide(C, mask, co)) {
-			if (!add_vertex_extrude(C, mask, co)) {
+			if (!add_vertex_extrude(C, mask, maskobj, co)) {
 				return OPERATOR_CANCELLED;
 			}
 		}
 	}
 	else {
 		if (!add_vertex_subdivide(C, mask, co)) {
-			if (!add_vertex_new(C, mask, co)) {
+			if (!add_vertex_new(C, mask, maskobj, co)) {
 				return OPERATOR_CANCELLED;
 			}
 		}
@@ -1376,7 +1370,7 @@
 	for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
 		MaskSpline *spline;
 
-		if (maskobj->restrictflag & MASK_RESTRICT_VIEW) {
+		if (maskobj->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
 			continue;
 		}
 
@@ -1454,7 +1448,7 @@
 	for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
 		MaskSpline *spline;
 
-		if (maskobj->restrictflag & MASK_RESTRICT_VIEW) {
+		if (maskobj->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
 			continue;
 		}
 
@@ -1563,7 +1557,7 @@
 		MaskSpline *spline;
 		int i;
 
-		if (maskobj->restrictflag & MASK_RESTRICT_VIEW) {
+		if (maskobj->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
 			continue;
 		}
 
@@ -1664,6 +1658,11 @@
 	int changed = FALSE;
 
 	for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
+
+		if (maskobj->restrictflag & MASK_RESTRICT_SELECT) {
+			continue;
+		}
+
 		if (!unselected) {
 			if (ED_mask_object_select_check(maskobj)) {
 				ED_mask_object_select_set(maskobj, FALSE);

Modified: branches/soc-2011-tomato/source/blender/editors/mask/mask_relationships.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/mask/mask_relationships.c	2012-05-30 12:53:13 UTC (rev 47219)
+++ branches/soc-2011-tomato/source/blender/editors/mask/mask_relationships.c	2012-05-30 12:54:50 UTC (rev 47220)
@@ -66,7 +66,7 @@
 		MaskSpline *spline;
 		int i;
 
-		if (maskobj->restrictflag & MASK_RESTRICT_VIEW) {
+		if (maskobj->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
 			continue;
 		}
 
@@ -136,7 +136,7 @@
 		MaskSpline *spline;
 		int i;
 
-		if (maskobj->restrictflag & MASK_RESTRICT_VIEW) {
+		if (maskobj->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
 			continue;
 		}
 

Modified: branches/soc-2011-tomato/source/blender/editors/mask/mask_select.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/mask/mask_select.c	2012-05-30 12:53:13 UTC (rev 47219)
+++ branches/soc-2011-tomato/source/blender/editors/mask/mask_select.c	2012-05-30 12:54:50 UTC (rev 47220)
@@ -75,6 +75,10 @@
 {
 	MaskSpline *spline;
 
+	if (maskobj->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
+		return FALSE;
+	}
+
 	for (spline = maskobj->splines.first; spline; spline = spline->next) {
 		if (ED_mask_spline_select_check(spline->points, spline->tot_point)) {
 			return TRUE;
@@ -101,6 +105,12 @@
 {
 	MaskSpline *spline;
 
+	if (maskobj->restrictflag & MASK_RESTRICT_SELECT) {
+		if (select == TRUE) {
+			return;
+		}
+	}
+
 	for (spline = maskobj->splines.first; spline; spline = spline->next) {
 		int i;
 
@@ -375,7 +385,7 @@
 	for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
 		MaskSpline *spline;
 
-		if (maskobj->restrictflag & MASK_RESTRICT_VIEW) {
+		if (maskobj->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
 			continue;
 		}
 
@@ -447,7 +457,7 @@
 	for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
 		MaskSpline *spline;
 
-		if (maskobj->restrictflag & MASK_RESTRICT_VIEW) {
+		if (maskobj->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
 			continue;
 		}
 
@@ -573,7 +583,7 @@
 	for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
 		MaskSpline *spline;
 
-		if (maskobj->restrictflag & MASK_RESTRICT_VIEW) {
+		if (maskobj->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
 			continue;
 		}
 

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-30 12:53:13 UTC (rev 47219)
+++ branches/soc-2011-tomato/source/blender/editors/mask/mask_shapekey.c	2012-05-30 12:54:50 UTC (rev 47220)
@@ -67,7 +67,7 @@
 	for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
 		MaskObjectShape *maskobj_shape;
 
-		if (maskobj->restrictflag & MASK_RESTRICT_VIEW) {
+		if (maskobj->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
 			continue;
 		}
 
@@ -113,7 +113,7 @@
 	for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
 		MaskObjectShape *maskobj_shape;
 
-		if (maskobj->restrictflag & MASK_RESTRICT_VIEW) {
+		if (maskobj->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
 			continue;
 		}
 

Modified: branches/soc-2011-tomato/source/blender/editors/transform/transform_conversions.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/transform/transform_conversions.c	2012-05-30 12:53:13 UTC (rev 47219)
+++ branches/soc-2011-tomato/source/blender/editors/transform/transform_conversions.c	2012-05-30 12:54:50 UTC (rev 47220)
@@ -5985,7 +5985,7 @@
 	for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
 		MaskSpline *spline = maskobj->splines.first;
 
-		if (maskobj->restrictflag & MASK_RESTRICT_VIEW) {
+		if (maskobj->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
 			continue;
 		}
 
@@ -6024,7 +6024,7 @@
 	for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
 		MaskSpline *spline = maskobj->splines.first;
 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list