Commit: e88e80a6a0c8976ac2d245c274ca5a0388736743 Author: Campbell Barton Date: Tue Aug 14 10:28:41 2018 +1000 Branches: blender2.8 https://developer.blender.org/rBe88e80a6a0c8976ac2d245c274ca5a0388736743
3D View boarder/lasso select tool options Add tool options to control how select operates (add/sub/set/and/xor). Note: edit mode armature select still needs to support all options, this is complicated by how it handles partial end-point selection. =================================================================== M release/scripts/startup/bl_ui/space_toolsystem_toolbar.py M source/blender/editors/animation/anim_channels_edit.c M source/blender/editors/animation/anim_markers.c M source/blender/editors/armature/armature_ops.c M source/blender/editors/armature/armature_select.c M source/blender/editors/armature/pose_select.c M source/blender/editors/curve/curve_ops.c M source/blender/editors/curve/editcurve_select.c M source/blender/editors/gpencil/gpencil_ops.c M source/blender/editors/gpencil/gpencil_select.c M source/blender/editors/include/ED_mesh.h M source/blender/editors/include/ED_particle.h M source/blender/editors/include/ED_sculpt.h A source/blender/editors/include/ED_select_utils.h M source/blender/editors/lattice/editlattice_select.c M source/blender/editors/lattice/lattice_ops.c M source/blender/editors/mask/mask_add.c M source/blender/editors/mask/mask_edit.c M source/blender/editors/mask/mask_ops.c M source/blender/editors/mask/mask_select.c M source/blender/editors/mesh/editface.c M source/blender/editors/mesh/editmesh_select.c M source/blender/editors/mesh/mesh_ops.c M source/blender/editors/metaball/mball_edit.c M source/blender/editors/metaball/mball_ops.c M source/blender/editors/object/object_ops.c M source/blender/editors/object/object_select.c M source/blender/editors/physics/particle_edit.c M source/blender/editors/physics/physics_ops.c M source/blender/editors/sculpt_paint/paint_mask.c M source/blender/editors/sculpt_paint/paint_ops.c M source/blender/editors/space_action/action_ops.c M source/blender/editors/space_action/action_select.c M source/blender/editors/space_clip/clip_graph_ops.c M source/blender/editors/space_clip/space_clip.c M source/blender/editors/space_clip/tracking_select.c M source/blender/editors/space_graph/graph_ops.c M source/blender/editors/space_graph/graph_select.c M source/blender/editors/space_nla/nla_ops.c M source/blender/editors/space_nla/nla_select.c M source/blender/editors/space_node/node_ops.c M source/blender/editors/space_node/node_select.c M source/blender/editors/space_outliner/outliner_edit.c M source/blender/editors/space_outliner/outliner_ops.c M source/blender/editors/space_sequencer/sequencer_ops.c M source/blender/editors/space_sequencer/sequencer_select.c M source/blender/editors/space_view3d/view3d_ops.c M source/blender/editors/space_view3d/view3d_select.c M source/blender/editors/util/CMakeLists.txt A source/blender/editors/util/select_utils.c M source/blender/editors/uvedit/uvedit_ops.c M source/blender/windowmanager/WM_api.h M source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c M source/blender/windowmanager/intern/wm_gesture_ops.c M source/blender/windowmanager/intern/wm_operator_props.c =================================================================== diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py index e1ecba1550a..363b409c688 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py @@ -373,18 +373,22 @@ class _defs_view3d_select: @ToolDef.from_fn def border(): + def draw_settings(context, layout, tool): + props = tool.operator_properties("view3d.select_border") + layout.prop(props, "mode", expand=True) return dict( text="Select Border", icon="ops.generic.select_border", widget=None, keymap=( ("view3d.select_border", - dict(deselect=False), + dict(mode='ADD'), dict(type='EVT_TWEAK_A', value='ANY')), ("view3d.select_border", - dict(deselect=True), + dict(mode='SUB'), dict(type='EVT_TWEAK_A', value='ANY', ctrl=True)), ), + draw_settings=draw_settings, ) @ToolDef.from_fn @@ -405,18 +409,22 @@ class _defs_view3d_select: @ToolDef.from_fn def lasso(): + def draw_settings(context, layout, tool): + props = tool.operator_properties("view3d.select_lasso") + layout.prop(props, "mode", expand=True) return dict( text="Select Lasso", icon="ops.generic.select_lasso", widget=None, keymap=( ("view3d.select_lasso", - dict(deselect=False), + dict(mode='ADD'), dict(type='EVT_TWEAK_A', value='ANY')), ("view3d.select_lasso", - dict(deselect=True), + dict(mode='SUB'), dict(type='EVT_TWEAK_A', value='ANY', ctrl=True)), ), + draw_settings=draw_settings, ) # ----------------------------------------------------------------------------- # Object Modes (named based on context.mode) diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 3f22ac6fa3a..a6eb9c5f3b5 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -67,6 +67,7 @@ #include "ED_keyframes_edit.h" // XXX move the select modes out of there! #include "ED_object.h" #include "ED_screen.h" +#include "ED_select_utils.h" #include "WM_api.h" #include "WM_types.h" diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index e1f4092c494..fe6c36d4cdb 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -71,6 +71,7 @@ #include "ED_anim_api.h" #include "ED_markers.h" #include "ED_screen.h" +#include "ED_select_utils.h" #include "ED_util.h" #include "ED_numinput.h" #include "ED_object.h" diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c index 039bb7f1847..d43d051deba 100644 --- a/source/blender/editors/armature/armature_ops.c +++ b/source/blender/editors/armature/armature_ops.c @@ -35,6 +35,7 @@ #include "ED_armature.h" #include "ED_screen.h" +#include "ED_select_utils.h" #include "ED_transform.h" #include "armature_intern.h" diff --git a/source/blender/editors/armature/armature_select.c b/source/blender/editors/armature/armature_select.c index 7602bccc48c..365771a1430 100644 --- a/source/blender/editors/armature/armature_select.c +++ b/source/blender/editors/armature/armature_select.c @@ -55,6 +55,7 @@ #include "ED_armature.h" #include "ED_screen.h" +#include "ED_select_utils.h" #include "ED_view3d.h" #include "DEG_depsgraph.h" diff --git a/source/blender/editors/armature/pose_select.c b/source/blender/editors/armature/pose_select.c index 72f0c68f660..621b20c0ca7 100644 --- a/source/blender/editors/armature/pose_select.c +++ b/source/blender/editors/armature/pose_select.c @@ -60,6 +60,7 @@ #include "ED_mesh.h" #include "ED_object.h" #include "ED_screen.h" +#include "ED_select_utils.h" #include "ED_view3d.h" #include "armature_intern.h" diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c index 925358b5304..2cfbc2f44c6 100644 --- a/source/blender/editors/curve/curve_ops.c +++ b/source/blender/editors/curve/curve_ops.c @@ -44,6 +44,7 @@ #include "ED_curve.h" #include "ED_object.h" #include "ED_screen.h" +#include "ED_select_utils.h" #include "ED_transform.h" #include "curve_intern.h" diff --git a/source/blender/editors/curve/editcurve_select.c b/source/blender/editors/curve/editcurve_select.c index 0fae39776a9..7fcf7e073dc 100644 --- a/source/blender/editors/curve/editcurve_select.c +++ b/source/blender/editors/curve/editcurve_select.c @@ -49,6 +49,7 @@ #include "WM_types.h" #include "ED_screen.h" +#include "ED_select_utils.h" #include "ED_types.h" #include "ED_view3d.h" #include "ED_curve.h" diff --git a/source/blender/editors/gpencil/gpencil_ops.c b/source/blender/editors/gpencil/gpencil_ops.c index b2e1758b169..1f238fccdc4 100644 --- a/source/blender/editors/gpencil/gpencil_ops.c +++ b/source/blender/editors/gpencil/gpencil_ops.c @@ -50,6 +50,7 @@ #include "RNA_access.h" #include "ED_gpencil.h" +#include "ED_select_utils.h" #include "ED_object.h" #include "ED_transform.h" diff --git a/source/blender/editors/gpencil/gpencil_select.c b/source/blender/editors/gpencil/gpencil_select.c index 3e0caa8d5d8..401a4e2a550 100644 --- a/source/blender/editors/gpencil/gpencil_select.c +++ b/source/blender/editors/gpencil/gpencil_select.c @@ -62,6 +62,7 @@ #include "UI_view2d.h" #include "ED_gpencil.h" +#include "ED_select_utils.h" #include "DEG_depsgraph.h" #include "DEG_depsgraph_query.h" diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index a473974eb3f..d791c055d95 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -204,7 +204,7 @@ void EMBM_project_snap_verts(struct bContext *C, struct ARegion *ar, struct BMEd /* editface.c */ void paintface_flush_flags(struct Object *ob, short flag); bool paintface_mouse_select(struct bContext *C, struct Object *ob, const int mval[2], bool extend, bool deselect, bool toggle); -int do_paintface_box_select(struct ViewContext *vc, struct rcti *rect, bool select, bool extend); +int do_paintface_box_select(struct ViewContext *vc, struct rcti *rect, int sel_op); void paintface_deselect_all_visible(struct Object *ob, int action, bool flush_flags); void paintface_select_linked(struct bContext *C, struct Object *ob, const int mval[2], const bool select); bool paintface_minmax(struct Object *ob, float r_min[3], float r_max[3]); diff --git a/source/blender/editors/include/ED_particle.h b/source/blender/editors/include/ED_particle.h index 08ed8097ea6..552975b9e55 100644 --- a/source/blender/editors/include/ED_particle.h +++ b/source/blender/editors/include/ED_particle.h @@ -62,9 +62,9 @@ void PE_update_object( /* selection tools */ int PE_mouse_particles(struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle); -int PE_border_select(struct bContext *C, const struct rcti *rect, bool select, bool extend); +int PE_border_select(struct bContext *C, const struct rcti *rect, const int sel_op); int PE_circle_select(struct bContext *C, int selecting, const int mval[2], float rad); -int PE_lasso_select(struct bContext *C, const int mcords[][2], const short moves, bool extend, bool select); +int PE_lasso_select(struct bContext *C, const int mcords[][2], const short moves, const int sel_op); void PE_deselect_all_visible(struct PTCacheEdit *edit); /* particle_edit_undo.c */ diff --git a/source/blender/editors/include/ED_sculpt.h b/source/blender/editors/include/ED_sculpt.h index c624405cd0c..94508a98dcb 100644 --- a/source/blender/editors/include/ED_sculpt.h +++ b/source/blender/editors/include/ED_sculpt.h @@ -43,7 +43,7 @@ struct ListBase; /* sculpt.c */ void ED_operatortypes_sculpt(void); void ED_sculpt_redraw_planes_get(float planes[4][4], struct ARegion *ar, struct Object *ob); -int ED_sculpt_mask_box_select(struct bContext *C, struct ViewContext *vc, const struct rcti *rect, bool select, bool extend); +int ED_sculpt_mask_box_select(struct bContext *C, struct ViewContext *vc, const struct rcti *rect, bool select); /* sculpt_undo.c */ void ED_sculpt_undosys_type(struct UndoType *ut); diff --git a/source/blender/editors/include/ED_sculpt.h b/source/blender/editors/include/ED_select_utils.h similarity index 50% copy from source/blender/editors/include/ED_sculpt.h copy to source/blender/editors/include/ED_select_utils.h index c624405cd0c..add1c812e1f 100644 --- a/source/blender/editors/include/ED_sculpt.h +++ b/source/blender/editors/include/ED_select_utils.h @@ -15,37 +15,38 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * The Original Code is Copyright (C) 2008 Blender Foundation. - * All rights reserved. - * - * Contributor(s): Nicholas Bishop - * * ***** END GPL LICENSE BLOCK ***** */ -/** \file ED_sculpt.h +/** \file ED_select_utils.h * \ingroup editors */ -#ifndef __ED_SCULPT_H__ -#define __ED_SCULPT_H__ +#ifndef __ED_SELECT_UTILS_H__ +#define __ED_SELECT_UTILS_H__ + +enum { + SEL_TOGGLE = 0, + SEL_SELECT = 1, + SEL_DESELECT = 2, + SEL_INVERT = 3, +}; -struct ARegion; -struct bContext; -struct Object; -struct RegionView3D; -struct ViewContext; -struct rcti; -struct UndoStep; -struct UndoType; -struct ListBase; +/** See #WM_operator_properties_select_operation */ +typedef enum { + SEL_OP_ADD = 1, + SEL_OP_SUB, + SEL_OP_SET, + SEL_OP_AND, + SEL_OP_XOR, +} eSelectOp; -/* sculpt.c */ -void ED_operatortypes_sculpt(void); -void ED_sculpt_redraw_planes_get(float planes[4][4], struct ARegion *ar, struct Object *ob); -int ED_sculpt_mask_box_select(struct bContext *C, @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs