diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-03-26 10:47:55 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-03-26 12:25:25 +0300 |
commit | 40f8ddf8297a062968fc6a1523aa210d69c22626 (patch) | |
tree | 27e26dd44f3e8778ad06012d184fcb11ed175c94 /release/scripts/startup | |
parent | 30fbf905ef8bd587eef43030b81d75b9eb704bec (diff) |
3D View: move deselect all logic into an option
This removes `VIEW3D_OT_select_or_deselect_all`, adding a
deselect_all option to the `VIEW3D_OT_select` operator.
- Add utility functions to simplify de-selecting all.
- Return true from selection functions when they change the selection
to avoid redundant updates.
- Use arrays of bases when passing objects between selection utility
functions since some users require bases.
- Fix logical error in box selection that updated all objects after
the first hit.
Diffstat (limited to 'release/scripts/startup')
-rw-r--r-- | release/scripts/startup/bl_operators/view3d.py | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/release/scripts/startup/bl_operators/view3d.py b/release/scripts/startup/bl_operators/view3d.py index 50d2b49b529..2216dce2d28 100644 --- a/release/scripts/startup/bl_operators/view3d.py +++ b/release/scripts/startup/bl_operators/view3d.py @@ -139,109 +139,8 @@ class VIEW3D_OT_edit_mesh_extrude_shrink_fatten(Operator): return self.execute(context) -class VIEW3D_OT_select_or_deselect_all(Operator): - """Select element under the mouse, deselect everything is there's nothing under the mouse""" - bl_label = "Select or Deselect All" - bl_idname = "view3d.select_or_deselect_all" - - extend: BoolProperty( - name="Extend", - description="Extend selection instead of deselecting everything first", - default=False, - options={'SKIP_SAVE'}, - ) - - toggle: BoolProperty( - name="Toggle", - description="Toggle the selection", - default=False, - options={'SKIP_SAVE'}, - ) - - deselect: BoolProperty( - name="Deselect", - description="Remove from selection", - default=False, - options={'SKIP_SAVE'}, - ) - - center: BoolProperty( - name="Center", - description="Use the object center when selecting, in editmode used to extend object selection", - default=False, - options={'SKIP_SAVE'}, - ) - - enumerate: BoolProperty( - name="Enumerate", - description="List objects under the mouse (object mode only)", - default=False, - options={'SKIP_SAVE'}, - ) - - object: BoolProperty( - name="Object", - description="Use object selection (editmode only)", - default=False, - options={'SKIP_SAVE'}, - ) - - def invoke(self, context, event): - retval = bpy.ops.view3d.select( - 'INVOKE_DEFAULT', - True, # undo push - extend=self.extend, - deselect=self.deselect, - toggle=self.toggle, - center=self.center, - enumerate=self.enumerate, - object=self.object, - ) - - # Finished means something was selected. - if 'FINISHED' in retval: - return retval - if self.extend or self.toggle or self.deselect: - return retval - - active_object = context.active_object - if active_object: - if active_object.mode == 'OBJECT': - select_all = bpy.ops.object.select_all - elif active_object.mode == 'EDIT': - if active_object.type == 'MESH': - select_all = bpy.ops.mesh.select_all - elif active_object.type == 'CURVE': - select_all = bpy.ops.curve.select_all - elif active_object.type == 'SURFACE': - select_all = bpy.ops.curve.select_all - elif active_object.type == 'LATTICE': - select_all = bpy.ops.lattice.select_all - elif active_object.type == 'META': - select_all = bpy.ops.mball.select_all - elif active_object.type == 'ARMATURE': - select_all = bpy.ops.armature.select_all - else: - return retval - elif active_object.mode == 'POSE': - select_all = bpy.ops.pose.select_all - elif active_object.mode == 'PARTICLE_EDIT': - select_all = bpy.ops.particle.select_all - else: - # Don nothing in paint and sculpt modes. - return retval - else: - select_all = bpy.ops.object.select_all - - if select_all.poll(): - return select_all('INVOKE_DEFAULT', True, action='DESELECT') - else: - return retval - - classes = ( VIEW3D_OT_edit_mesh_extrude_individual_move, VIEW3D_OT_edit_mesh_extrude_move, VIEW3D_OT_edit_mesh_extrude_shrink_fatten, - VIEW3D_OT_select_or_deselect_all, ) |