diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-11-19 18:28:07 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-11-19 18:28:07 +0300 |
commit | 0a69e3b307f05aeab8bd84f69560b4118c9bfaf2 (patch) | |
tree | 2dfeaae34f13c78bfd1594a78637ce31a95aba33 /source | |
parent | 92ea28101725631f8ebe6c6cfd37007175f1af03 (diff) |
Option not to select with un-hide
D1518 from @mba105 w/ edits
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/armature/armature_edit.c | 8 | ||||
-rw-r--r-- | source/blender/editors/armature/pose_edit.c | 17 | ||||
-rw-r--r-- | source/blender/editors/curve/editcurve.c | 11 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_data.c | 52 | ||||
-rw-r--r-- | source/blender/editors/include/ED_mesh.h | 4 | ||||
-rw-r--r-- | source/blender/editors/mask/mask_ops.c | 7 | ||||
-rw-r--r-- | source/blender/editors/mesh/editface.c | 6 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 9 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_utils.c | 4 | ||||
-rw-r--r-- | source/blender/editors/metaball/mball_edit.c | 19 | ||||
-rw-r--r-- | source/blender/editors/object/object_edit.c | 7 | ||||
-rw-r--r-- | source/blender/editors/physics/particle_edit.c | 13 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_utils.c | 7 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_ops.c | 12 | ||||
-rw-r--r-- | source/blender/editors/uvedit/uvedit_ops.c | 18 |
15 files changed, 139 insertions, 55 deletions
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_hide_view_clear(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + RNA_def_boolean(ot->srna, "select", true, "Select", ""); } static int mask_hide_view_set_exec(bContext *C, wmOperator *op) diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index 4336fff45d5..87c8c55b0a1 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -138,7 +138,7 @@ void paintface_hide(Object *ob, const bool unselected) } -void paintface_reveal(Object *ob) +void paintface_reveal(Object *ob, const bool select) { Mesh *me; MPoly *mpoly; @@ -151,8 +151,8 @@ void paintface_reveal(Object *ob) a = me->totpoly; while (a--) { if (mpoly->flag & ME_HIDE) { - mpoly->flag |= ME_FACE_SEL; - mpoly->flag -= ME_HIDE; + SET_FLAG_FROM_TEST(mpoly->flag, select, ME_FACE_SEL); + mpoly->flag &= ~ME_HIDE; } mpoly++; } diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index bf25f7ee7d1..bc251869e3d 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -1652,12 +1652,13 @@ void MESH_OT_hide(wmOperatorType *ot) RNA_def_boolean(ot->srna, "unselected", false, "Unselected", "Hide unselected rather than selected"); } -static int edbm_reveal_exec(bContext *C, wmOperator *UNUSED(op)) +static int edbm_reveal_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BKE_editmesh_from_object(obedit); - - EDBM_mesh_reveal(em); + const bool select = RNA_boolean_get(op->ptr, "select"); + + EDBM_mesh_reveal(em, select); EDBM_update_generic(em, true, false); @@ -1677,6 +1678,8 @@ void MESH_OT_reveal(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + RNA_def_boolean(ot->srna, "select", true, "Select", ""); } static int edbm_normals_make_consistent_exec(bContext *C, wmOperator *op) diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index c8151862b6c..fc568a8b8ee 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -1225,7 +1225,7 @@ void EDBM_mesh_hide(BMEditMesh *em, bool swap) } -void EDBM_mesh_reveal(BMEditMesh *em) +void EDBM_mesh_reveal(BMEditMesh *em, bool select) { const char iter_types[3] = {BM_VERTS_OF_MESH, BM_EDGES_OF_MESH, @@ -1264,7 +1264,7 @@ void EDBM_mesh_reveal(BMEditMesh *em) BM_ITER_MESH (ele, &iter, em->bm, iter_types[i]) { if (BM_elem_flag_test(ele, BM_ELEM_TAG)) { - BM_elem_select_set(em->bm, ele, true); + BM_elem_select_set(em->bm, ele, select); } } } diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c index 009aa921e11..5b4078b98b7 100644 --- a/source/blender/editors/metaball/mball_edit.c +++ b/source/blender/editors/metaball/mball_edit.c @@ -542,19 +542,21 @@ void MBALL_OT_hide_metaelems(wmOperatorType *ot) /***************************** Unhide operator *****************************/ /* Unhide all edited MetaElems */ -static int reveal_metaelems_exec(bContext *C, wmOperator *UNUSED(op)) +static int reveal_metaelems_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); MetaBall *mb = (MetaBall *)obedit->data; - MetaElem *ml; - - ml = mb->editelems->first; + const bool select = RNA_boolean_get(op->ptr, "select"); + bool changed = false; - if (ml) { - while (ml) { + for (MetaElem *ml = mb->editelems->first; ml; ml = ml->next) { + if (ml->flag & MB_HIDE) { + SET_FLAG_FROM_TEST(ml->flag, select, SELECT); ml->flag &= ~MB_HIDE; - ml = ml->next; + changed = true; } + } + if (changed) { WM_event_add_notifier(C, NC_GEOM | ND_DATA, mb); DAG_id_tag_update(obedit->data, 0); } @@ -575,6 +577,9 @@ void MBALL_OT_reveal_metaelems(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + /* props */ + RNA_def_boolean(ot->srna, "select", true, "Select", ""); } /* Select MetaElement with mouse click (user can select radius circle or diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 4e949c82a9f..d7c7976c344 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -133,7 +133,7 @@ Object *ED_object_active_context(bContext *C) /* ********* clear/set restrict view *********/ -static int object_hide_view_clear_exec(bContext *C, wmOperator *UNUSED(op)) +static int object_hide_view_clear_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); ScrArea *sa = CTX_wm_area(C); @@ -141,12 +141,13 @@ static int object_hide_view_clear_exec(bContext *C, wmOperator *UNUSED(op)) Scene *scene = CTX_data_scene(C); Base *base; bool changed = false; + const bool select = RNA_boolean_get(op->ptr, "select"); /* XXX need a context loop to handle such cases */ for (base = FIRSTBASE; base; base = base->next) { if ((base->lay & v3d->lay) && base->object->restrictflag & OB_RESTRICT_VIEW) { if (!(base->object->restrictflag & OB_RESTRICT_SELECT)) { - base->flag |= SELECT; + SET_FLAG_FROM_TEST(base->flag, select, SELECT); } base->object->flag = base->flag; base->object->restrictflag &= ~OB_RESTRICT_VIEW; @@ -176,6 +177,8 @@ void OBJECT_OT_hide_view_clear(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + RNA_def_boolean(ot->srna, "select", true, "Select", ""); } static int object_hide_view_set_exec(bContext *C, wmOperator *op) diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 199d5e0fbfa..da66ec44235 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -1950,11 +1950,12 @@ void PARTICLE_OT_hide(wmOperatorType *ot) /*************************** reveal operator **************************/ -static int reveal_exec(bContext *C, wmOperator *UNUSED(op)) +static int reveal_exec(bContext *C, wmOperator *op) { Object *ob= CTX_data_active_object(C); Scene *scene= CTX_data_scene(C); - PTCacheEdit *edit= PE_get_current(scene, ob); + PTCacheEdit *edit = PE_get_current(scene, ob); + const bool select = RNA_boolean_get(op->ptr, "select"); POINT_P; KEY_K; LOOP_POINTS { @@ -1962,8 +1963,9 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op)) point->flag &= ~PEP_HIDE; point->flag |= PEP_EDIT_RECALC; - LOOP_KEYS - key->flag |= PEK_SELECT; + LOOP_KEYS { + SET_FLAG_FROM_TEST(key->flag, select, PEK_SELECT); + } } } @@ -1986,6 +1988,9 @@ void PARTICLE_OT_reveal(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + + /* props */ + RNA_def_boolean(ot->srna, "select", true, "Select", ""); } /************************ select less operator ************************/ diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index 8304e782b07..1c2ab442e95 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -749,10 +749,11 @@ void PAINT_OT_face_select_hide(wmOperatorType *ot) RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected objects"); } -static int face_select_reveal_exec(bContext *C, wmOperator *UNUSED(op)) +static int face_select_reveal_exec(bContext *C, wmOperator *op) { + const bool select = RNA_boolean_get(op->ptr, "select"); Object *ob = CTX_data_active_object(C); - paintface_reveal(ob); + paintface_reveal(ob, select); ED_region_tag_redraw(CTX_wm_region(C)); return OPERATOR_FINISHED; } @@ -768,5 +769,5 @@ void PAINT_OT_face_select_reveal(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected objects"); + RNA_def_boolean(ot->srna, "select", true, "Select", ""); } diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c index 5c670a216d8..62275abcd02 100644 --- a/source/blender/editors/space_graph/graph_ops.c +++ b/source/blender/editors/space_graph/graph_ops.c @@ -333,13 +333,14 @@ static void GRAPH_OT_hide(wmOperatorType *ot) /* ........ */ -static int graphview_curves_reveal_exec(bContext *C, wmOperator *UNUSED(op)) +static int graphview_curves_reveal_exec(bContext *C, wmOperator *op) { bAnimContext ac; ListBase anim_data = {NULL, NULL}; ListBase all_data = {NULL, NULL}; bAnimListElem *ale; int filter; + const bool select = RNA_boolean_get(op->ptr, "select"); /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) @@ -364,8 +365,11 @@ static int graphview_curves_reveal_exec(bContext *C, wmOperator *UNUSED(op)) continue; /* select if it is not visible */ - if (ANIM_channel_setting_get(&ac, ale, ACHANNEL_SETTING_VISIBLE) == 0) - ANIM_channel_setting_set(&ac, ale, ACHANNEL_SETTING_SELECT, ACHANNEL_SETFLAG_ADD); + if (ANIM_channel_setting_get(&ac, ale, ACHANNEL_SETTING_VISIBLE) == 0) { + ANIM_channel_setting_set( + &ac, ale, ACHANNEL_SETTING_SELECT, + select ? ACHANNEL_SETFLAG_ADD : ACHANNEL_SETFLAG_CLEAR); + } /* change the visibility setting */ ANIM_channel_setting_set(&ac, ale, ACHANNEL_SETTING_VISIBLE, ACHANNEL_SETFLAG_ADD); @@ -397,6 +401,8 @@ static void GRAPH_OT_reveal(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + RNA_def_boolean(ot->srna, "select", true, "Select", ""); } /* ************************** registration - operator types **********************************/ diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index c369068fe05..d69588e91c6 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -3761,7 +3761,7 @@ static void UV_OT_hide(wmOperatorType *ot) /****************** reveal operator ******************/ -static int uv_reveal_exec(bContext *C, wmOperator *UNUSED(op)) +static int uv_reveal_exec(bContext *C, wmOperator *op) { SpaceImage *sima = CTX_wm_space_image(C); Object *obedit = CTX_data_edit_object(C); @@ -3777,12 +3777,14 @@ static int uv_reveal_exec(bContext *C, wmOperator *UNUSED(op)) const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV); + const bool select = RNA_boolean_get(op->ptr, "select"); + /* note on tagging, selecting faces needs to be delayed so it doesn't select the verts and * confuse our checks on selected verts. */ /* call the mesh function if we are in mesh sync sel */ if (ts->uv_flag & UV_SYNC_SELECTION) { - EDBM_mesh_reveal(em); + EDBM_mesh_reveal(em, select); WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); return OPERATOR_FINISHED; @@ -3794,7 +3796,7 @@ static int uv_reveal_exec(bContext *C, wmOperator *UNUSED(op)) if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN) && !BM_elem_flag_test(efa, BM_ELEM_SELECT)) { BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); - luv->flag |= MLOOPUV_VERTSEL; + SET_FLAG_FROM_TEST(luv->flag, select, MLOOPUV_VERTSEL); } /* BM_face_select_set(em->bm, efa, true); */ BM_elem_flag_enable(efa, BM_ELEM_TAG); @@ -3815,7 +3817,7 @@ static int uv_reveal_exec(bContext *C, wmOperator *UNUSED(op)) if (!totsel) { BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); - luv->flag |= MLOOPUV_VERTSEL; + SET_FLAG_FROM_TEST(luv->flag, select, MLOOPUV_VERTSEL); } /* BM_face_select_set(em->bm, efa, true); */ BM_elem_flag_enable(efa, BM_ELEM_TAG); @@ -3830,7 +3832,7 @@ static int uv_reveal_exec(bContext *C, wmOperator *UNUSED(op)) BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { if (BM_elem_flag_test(l->v, BM_ELEM_SELECT) == 0) { luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); - luv->flag |= MLOOPUV_VERTSEL; + SET_FLAG_FROM_TEST(luv->flag, select, MLOOPUV_VERTSEL); } } /* BM_face_select_set(em->bm, efa, true); */ @@ -3846,7 +3848,7 @@ static int uv_reveal_exec(bContext *C, wmOperator *UNUSED(op)) if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN) && !BM_elem_flag_test(efa, BM_ELEM_SELECT)) { BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); - luv->flag |= MLOOPUV_VERTSEL; + SET_FLAG_FROM_TEST(luv->flag, select, MLOOPUV_VERTSEL); } /* BM_face_select_set(em->bm, efa, true); */ BM_elem_flag_enable(efa, BM_ELEM_TAG); @@ -3860,7 +3862,7 @@ static int uv_reveal_exec(bContext *C, wmOperator *UNUSED(op)) BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { if (BM_elem_flag_test(l->v, BM_ELEM_SELECT) == 0) { luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); - luv->flag |= MLOOPUV_VERTSEL; + SET_FLAG_FROM_TEST(luv->flag, select, MLOOPUV_VERTSEL); } } /* BM_face_select_set(em->bm, efa, true); */ @@ -3888,6 +3890,8 @@ static void UV_OT_reveal(wmOperatorType *ot) /* api callbacks */ ot->exec = uv_reveal_exec; ot->poll = ED_operator_uvedit; + + RNA_def_boolean(ot->srna, "select", true, "Select", ""); } /******************** set 3d cursor operator ********************/ |