4
$\begingroup$

I would want that backside selected only by border select and lasso, but not mouse click. I would like that mouse click does not select backside faces. Only lasso and border selection would do it. Is it possible to do? enter image description here

$\endgroup$
3
  • $\begingroup$ For the first question; I'm not sure what you're asking. Could you elaborate? $\endgroup$
    – Cyberchipz
    May 21, 2015 at 19:13
  • $\begingroup$ i guess he means how to see the cage and don't select backfaces. First question. $\endgroup$
    – mifth
    May 21, 2015 at 19:37
  • $\begingroup$ I'm pretty sure this isn't possible without some major tricks (python or editing C source).. $\endgroup$
    – gandalf3
    May 21, 2015 at 22:03

1 Answer 1

5
$\begingroup$

This is the basic idea : we keep the occluding OFF but switch it ON only when selecting with mouse click, and for this you create your own operator for selection and replace the shortcuts to point to this new operator.( or simply override the old operator )

Here is the code that does that run it then set the shortcuts

import bpy
from bpy.props import BoolProperty, IntVectorProperty

class SelectionOperator(bpy.types.Operator):
    """ Costum selection
    """
    bl_idname = "view3d.select_costum" #to override the old selection replace this with "view3d.select"
    bl_label = "costum selection"

    extend = BoolProperty(default = False)
    deselect = BoolProperty(default = False)
    toggle = BoolProperty(default = False)
    center = BoolProperty(default = False)
    enumerate = BoolProperty(default = False)
    object = BoolProperty(default = False)
    location = IntVectorProperty(default = (0,0),subtype ='XYZ', size = 2)

    def execute(self, context):
        context.space_data.use_occlude_geometry = True
        bpy.ops.view3d.select(extend=self.extend, deselect=self.deselect, toggle=self.toggle, center=self.center, enumerate=self.enumerate, object=self.object, location=(self.location[0] , self.location[1] ))
        context.space_data.use_occlude_geometry = False    
        return {'FINISHED'}

    def invoke(self, context, event):
        if context.space_data.type == 'VIEW_3D':
            self.location[0] = event.mouse_region_x
            self.location[1]  = event.mouse_region_y
            return self.execute(context)
        else:
                self.report({'WARNING'}, "Active space must be a View3d")
                return {'CANCELLED'}

bpy.utils.register_class(SelectionOperator)

if you didn't override the old selection you have to change the shortcuts :

  • hit Ctrl+Alt+U
  • in Input➝3D view➝3D view Global➝Activate/Select
  • change the operator to view3d.select_costum
  • repeat for all the Activate/Select entries below this one

enter image description here

$\endgroup$
2
  • $\begingroup$ If I wish to override the original selection operator (e.g. for an addon), where can I store the original operator to still be able to call it from the new custom selection tool (as running bpy.ops.view3d.select() will cause an infinite loop)? $\endgroup$
    – dwitvliet
    May 27, 2015 at 3:19
  • $\begingroup$ @Banana overriding seems to crash blender ( at least mine ) so it's not the way to go , but i have done a shortcut replacement which is safer and can be reversed $\endgroup$
    – Chebhou
    May 27, 2015 at 14:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .