[Bf-blender-cvs] [0a69e3b307f] master: Option not to select with un-hide

Campbell Barton noreply at git.blender.org
Sun Nov 19 16:21:33 CET 2017


Commit: 0a69e3b307f05aeab8bd84f69560b4118c9bfaf2
Author: Campbell Barton
Date:   Mon Nov 20 02:28:07 2017 +1100
Branches: master
https://developer.blender.org/rB0a69e3b307f05aeab8bd84f69560b4118c9bfaf2

Option not to select with un-hide

D1518 from @mba105 w/ edits

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

M	source/blender/editors/armature/armature_edit.c
M	source/blender/editors/armature/pose_edit.c
M	source/blender/editors/curve/editcurve.c
M	source/blender/editors/gpencil/gpencil_data.c
M	source/blender/editors/include/ED_mesh.h
M	source/blender/editors/mask/mask_ops.c
M	source/blender/editors/mesh/editface.c
M	source/blender/editors/mesh/editmesh_tools.c
M	source/blender/editors/mesh/editmesh_utils.c
M	source/blender/editors/metaball/mball_edit.c
M	source/blender/editors/object/object_edit.c
M	source/blender/editors/physics/particle_edit.c
M	source/blender/editors/sculpt_paint/paint_utils.c
M	source/blender/editors/space_graph/graph_ops.c
M	source/blender/editors/uvedit/uvedit_ops.c

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

diff --git a/source/blender/editors/armature/armature_edit.c b/source/blender/editors/armature/armature_edit.c
index ab9a3e068d0..a2fbfe645f7 100644
--- a/source/blender/editors/armature/armature_edit.c
+++ b/source/blender/editors/armature/armature_edit.c
@@ -1564,17 +1564,18 @@ void ARMATURE_OT_hide(wmOperatorType *ot)
 	RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected");
 }
 
-static int armature_reveal_exec(bContext *C, wmOperator *UNUSED(op))
+static int armature_reveal_exec(bContext *C, wmOperator *op)
 {
 	Object *obedit = CTX_data_edit_object(C);
 	bArmature *arm = obedit->data;
 	EditBone *ebone;
+	const bool select = RNA_boolean_get(op->ptr, "select");
 	
 	for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
 		if (arm->layer & ebone->layer) {
 			if (ebone->flag & BONE_HIDDEN_A) {
 				if (!(ebone->flag & BONE_UNSELECTABLE)) {
-					ebone->flag |= (BONE_TIPSEL | BONE_SELECTED | BONE_ROOTSEL);
+					SET_FLAG_FROM_TEST(ebone->flag, select, (BONE_TIPSEL | BONE_SELECTED | BONE_ROOTSEL));
 				}
 				ebone->flag &= ~BONE_HIDDEN_A;
 			}
@@ -1593,7 +1594,7 @@ void ARMATURE_OT_reveal(wmOperatorType *ot)
 	/* identifiers */
 	ot->name = "Reveal Bones";
 	ot->idname = "ARMATURE_OT_reveal";
-	ot->description = "Unhide all bones that have been tagged to be hidden in Edit Mode";
+	ot->description = "Reveal all bones hidden in Edit Mode";
 	
 	/* api callbacks */
 	ot->exec = armature_reveal_exec;
@@ -1602,4 +1603,5 @@ void ARMATURE_OT_reveal(wmOperatorType *ot)
 	/* flags */
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
+	RNA_def_boolean(ot->srna, "select", true, "Select", "");
 }
diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c
index 57c01157f8e..acbf23ecf82 100644
--- a/source/blender/editors/armature/pose_edit.c
+++ b/source/blender/editors/armature/pose_edit.c
@@ -1098,16 +1098,18 @@ void POSE_OT_hide(wmOperatorType *ot)
 	RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "");
 }
 
-static int show_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr)) 
+static int show_pose_bone_cb(Object *ob, Bone *bone, void *data) 
 {
+	const bool select = GET_INT_FROM_POINTER(data);
+
 	bArmature *arm = ob->data;
 	
 	if (arm->layer & bone->layer) {
 		if (bone->flag & BONE_HIDDEN_P) {
-			bone->flag &= ~BONE_HIDDEN_P;
 			if (!(bone->flag & BONE_UNSELECTABLE)) {
-				bone->flag |= BONE_SELECTED;
+				SET_FLAG_FROM_TEST(bone->flag, select, BONE_SELECTED);
 			}
+			bone->flag &= ~BONE_HIDDEN_P;
 		}
 	}
 	
@@ -1115,12 +1117,13 @@ static int show_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr))
 }
 
 /* active object is armature in posemode, poll checked */
-static int pose_reveal_exec(bContext *C, wmOperator *UNUSED(op)) 
+static int pose_reveal_exec(bContext *C, wmOperator *op) 
 {
 	Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
 	bArmature *arm = ob->data;
+	const bool select = RNA_boolean_get(op->ptr, "select");
 	
-	bone_looper(ob, arm->bonebase.first, NULL, show_pose_bone_cb);
+	bone_looper(ob, arm->bonebase.first, SET_INT_IN_POINTER(select), show_pose_bone_cb);
 	
 	/* note, notifier might evolve */
 	WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, ob);
@@ -1133,7 +1136,7 @@ void POSE_OT_reveal(wmOperatorType *ot)
 	/* identifiers */
 	ot->name = "Reveal Selected";
 	ot->idname = "POSE_OT_reveal";
-	ot->description = "Unhide all bones that have been tagged to be hidden in Pose Mode";
+	ot->description = "Reveal all bones hidden in Pose Mode";
 	
 	/* api callbacks */
 	ot->exec = pose_reveal_exec;
@@ -1141,6 +1144,8 @@ void POSE_OT_reveal(wmOperatorType *ot)
 	
 	/* flags */
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+	RNA_def_boolean(ot->srna, "select", true, "Select", "");
 }
 
 /* ********************************************** */
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 4916c206a85..fc363475608 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -2926,7 +2926,7 @@ void CURVE_OT_hide(wmOperatorType *ot)
 
 /********************** reveal operator *********************/
 
-static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
+static int reveal_exec(bContext *C, wmOperator *op)
 {
 	Object *obedit = CTX_data_edit_object(C);
 	ListBase *editnurb = object_editcurve_get(obedit);
@@ -2934,6 +2934,7 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
 	BPoint *bp;
 	BezTriple *bezt;
 	int a;
+	const bool select = RNA_boolean_get(op->ptr, "select");
 
 	for (nu = editnurb->first; nu; nu = nu->next) {
 		nu->hide = 0;
@@ -2942,7 +2943,7 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
 			a = nu->pntsu;
 			while (a--) {
 				if (bezt->hide) {
-					select_beztriple(bezt, SELECT, SELECT, HIDDEN);
+					select_beztriple(bezt, select, SELECT, HIDDEN);
 					bezt->hide = 0;
 				}
 				bezt++;
@@ -2953,7 +2954,7 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
 			a = nu->pntsu * nu->pntsv;
 			while (a--) {
 				if (bp->hide) {
-					select_bpoint(bp, SELECT, SELECT, HIDDEN);
+					select_bpoint(bp, select, SELECT, HIDDEN);
 					bp->hide = 0;
 				}
 				bp++;
@@ -2972,7 +2973,7 @@ void CURVE_OT_reveal(wmOperatorType *ot)
 	/* identifiers */
 	ot->name = "Reveal Hidden";
 	ot->idname = "CURVE_OT_reveal";
-	ot->description = "Show again hidden control points";
+	ot->description = "Reveal hidden control points";
 	
 	/* api callbacks */
 	ot->exec = reveal_exec;
@@ -2980,6 +2981,8 @@ void CURVE_OT_reveal(wmOperatorType *ot)
 	
 	/* flags */
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+	RNA_def_boolean(ot->srna, "select", true, "Select", "");
 }
 
 /********************** subdivide operator *********************/
diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c
index 93c9d21e717..5bd5c9c74b9 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -423,18 +423,59 @@ static int gp_reveal_poll(bContext *C)
 	return ED_gpencil_data_get_active(C) != NULL;
 }
 
-static int gp_reveal_exec(bContext *C, wmOperator *UNUSED(op))
+static void gp_reveal_select_frame(bContext *C, bGPDframe *frame, bool select)
+{
+	bGPDstroke *gps;
+	for (gps = frame->strokes.first; gps; gps = gps->next) {
+
+		/* only deselect strokes that are valid in this view */
+		if (ED_gpencil_stroke_can_use(C, gps)) {
+
+			/* (de)select points */
+			int i;
+			bGPDspoint *pt;
+			for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
+				SET_FLAG_FROM_TEST(pt->flag, select, GP_SPOINT_SELECT);
+			}
+
+			/* (de)select stroke */
+			SET_FLAG_FROM_TEST(gps->flag, select, GP_STROKE_SELECT);
+		}
+	}
+}
+
+static int gp_reveal_exec(bContext *C, wmOperator *op)
 {
 	bGPdata *gpd = ED_gpencil_data_get_active(C);
 	bGPDlayer *gpl;
-	
+	const bool select = RNA_boolean_get(op->ptr, "select");
+
 	/* sanity checks */
 	if (gpd == NULL)
 		return OPERATOR_CANCELLED;
 	
-	/* make all layers visible */
 	for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
-		gpl->flag &= ~GP_LAYER_HIDE;
+
+		if (gpl->flag & GP_LAYER_HIDE) {
+			gpl->flag &= ~GP_LAYER_HIDE;
+
+			/* select or deselect if requested, only on hidden layers */
+			if (gpd->flag & GP_DATA_STROKE_EDITMODE) {
+				if (select) {
+					/* select all strokes on active frame only (same as select all operator) */
+					if (gpl->actframe) {
+						gp_reveal_select_frame(C, gpl->actframe, true);
+					}
+				}
+				else {
+					/* deselect strokes on all frames (same as deselect all operator) */
+					bGPDframe *gpf;
+					for (gpf = gpl->frames.first; gpf; gpf = gpf->next) {
+						gp_reveal_select_frame(C, gpf, false);
+					}
+				}
+			}
+		}
 	}
 	
 	/* notifiers */
@@ -456,6 +497,9 @@ void GPENCIL_OT_reveal(wmOperatorType *ot)
 	
 	/* flags */
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+	/* props */
+	RNA_def_boolean(ot->srna, "select", true, "Select", "");
 }
 
 /* ***************** Lock/Unlock All Layers ************************ */
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h
index c867df2d01a..c2c00ad5635 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -103,7 +103,7 @@ void undo_push_mesh(struct bContext *C, const char *name);
 bool EDBM_vert_color_check(struct BMEditMesh *em);
 
 void EDBM_mesh_hide(struct BMEditMesh *em, bool swap);
-void EDBM_mesh_reveal(struct BMEditMesh *em);
+void EDBM_mesh_reveal(struct BMEditMesh *em, bool select);
 
 void EDBM_update_generic(struct BMEditMesh *em, const bool do_tessface, const bool is_destructive);
 
@@ -205,7 +205,7 @@ void paintface_select_linked(struct bContext *C, struct Object *ob, const int mv
 bool paintface_minmax(struct Object *ob, float r_min[3], float r_max[3]);
 
 void paintface_hide(struct Object *ob, const bool unselected);
-void paintface_reveal(struct Object *ob);
+void paintface_reveal(struct Object *ob, const bool select);
 
 void paintvert_deselect_all_visible(struct Object *ob, int action, bool flush_flags);
 void paintvert_select_ungrouped(struct Object *ob, bool extend, bool flush_flags);
diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c
index 101ef70fb70..97d5ee1eff0 100644
--- a/source/blender/editors/mask/mask_ops.c
+++ b/source/blender/editors/mask/mask_ops.c
@@ -1937,16 +1937,17 @@ void MASK_OT_handle_type_set(wmOperatorType *ot)
 
 
 /* ********* clear/set restrict view *********/
-static int mask_hide_view_clear_exec(bContext *C, wmOperator *UNUSED(op))
+static int mask_hide_view_clear_exec(bContext *C, wmOperator *op)
 {
 	Mask *mask = CTX_data_edit_mask(C);
 	MaskLayer *masklay;
 	bool changed = false;
+	const bool select = RNA_boolean_get(op->ptr, "select");
 
 	for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
 
 		if (masklay->restrictflag & OB_RESTRICT_VIEW) {
-			ED_mask_layer_select_set(masklay, true);
+			ED_mask_layer_select_set(masklay, select);
 			masklay->restrictflag &= ~OB_RESTRICT_VIEW;
 			changed = true;
 		}
@@ -1977,6 +1978,8 @@ void MASK_OT_hid

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list