How to use gizmo only when moving? Similarly, setting "Activate Gizmo: Press/Drag"

I need to be able to select geometry in gizmo mode, but my custom gizmo is always active and does not allow to select points, faces, faces behind gizmo.
There is a similar setting for the standard gizmo, Preferences> Keymap> “Activate Gizmo: Press/Drag”

I haven’t got that option in the keymap on my Mac version (Official 2.80), but I have noticed that you cannot select behind the gizmos using normal Blender Gizmos. Is there a setting in the Gizmo API references?

EDIT:

This is all I get if I put “Active” in the search window:

31

image
perhaps the Mac is not present.
I need to select points in the edit mode, but my gizmo prevents me from doing this, so I need to activate the gizmo only when moving and at the same time to be able to click on the gizmo and select points behind it.

OK, tried on my Ubuntu machine, made settings as you did, Pressing tilde allows me to hide the gizmo, then I can select what was behind it, then I can press tilde again and show the gizmo, I can find no way to select through it, only hide it first.

The code you want to switch off the various bits is something like:
bpy.data.screen['Layout"]... show_gizmo_object_rotate for the rotate bit, you probably need to flip all three, Move Rotate and Scale, to hide the Gizmo while you select.

This page might help you:

https://docs.blender.org/api/current/bpy.types.SpaceView3D.html#bpy.types.SpaceView3D.show_gizmo_object_rotate

Cheers, Clock.

that is, you offer when you click to hide the gizmo, and the gizmo will activate only when dragging? isn’t it implemented in the standard gizmo?

Not that I can make it do! I cannot select behind the Gizmo in any circumstances…

EDIT:

I can using a box; key (B), or by keying C then it works behind the gizmo, but not with Mouse Select.

EDIT2:

OK I got all that working so Drag activates the gizmo and I can now select behind it with Mouse Select, but I cannot find in the API how to switch this on, or off… Sorry, I know very little about gizmos.

What I try to do is to establish an object in Python Console, then try “AutoComplete” to see what options I might have, but it’s late here and my brain is dead now…

thank you for your help, but I thought there was a different approach at the API level. but I can’t find it either. there are bl_options = {‘SELECT’} but it doesn’t seem to be for that

is it possible to do this through the hide_select attribute?
Here’s my custom gizmo code. Everything about the modal operator is my guess.

class SHAPE_GGT_cone(Gizmo):
bl_idname = "shape.cone"


__slots__ = (
    "custom_shape",
 
)

def draw(self, context):
    
    bgl.glEnable(bgl.GL_BLEND)
    bgl.glEnable(bgl.GL_LINE_SMOOTH)
 
    self.draw_custom_shape(self.custom_shape)
    bgl.glDisable(bgl.GL_LINE_SMOOTH)
    bgl.glDisable(bgl.GL_BLEND)

def draw_select(self, context, select_id):

    self.draw_custom_shape(self.new_custom_shape('TRIS', custom_shape_cone), select_id=select_id)

def setup(self):
    if not hasattr(self, "custom_shape"):
        #self.batch = batch_for_shader(shader,'TRIS', {"pos": custom_shape_cone})
        #self.custom_shape = batch_for_shader(self.shader, 'TRIS', {"pos": custom_shape_cone})
        self.custom_shape = self.new_custom_shape('TRIS', custom_shape_cone)


#test
def invoke(self, context, event):
    return {'RUNNING_MODAL'}

""" def exit(self, context, cancel):
    self.hide_select = False """

def modal(self, context, event, tweak):
    if event.type == 'LEFTMOUSE' and event.value == 'CLICK':
        self.hide_select = True
    else:
        self.hide_select = False
    return{'PASS_THROUGH'}

I was able to do the following:

class ROTATE_OT_view(bpy.types.Operator):
bl_idname = "rotate.view"
bl_label = "Rotate View"
bl_description = "Rotate View"

__slots__ = (
    "init_mouse_x",
    "init_mouse_y",
    )

  def modal(self, context, event):
    
    

    if event.type == 'MOUSEMOVE':
        bpy.ops.transform.rotate('INVOKE_DEFAULT', release_confirm = True)
        return {'FINISHED'}


    elif event.shift and event.type == 'LEFTMOUSE' and event.value == 'RELEASE':
        bpy.ops.view3d.select(extend = True, toggle  = True, location=(self.init_mouse_x, self.init_mouse_y))
    elif event.type == 'LEFTMOUSE' and event.value == 'RELEASE':
        bpy.ops.view3d.select(location=(self.init_mouse_x, self.init_mouse_y))

    return {'FINISHED'}

  def invoke(self, context, event):
    self.init_mouse_x = event.mouse_x
    self.init_mouse_y = event.mouse_y

    context.window_manager.modal_handler_add(self)
    return {'RUNNING_MODAL'}

Looks OK to me! Does this do what you wanted it to do?

Yes, but there is some kind of inaccuracy in the mode of selection of edges and polygons. Sometimes polygons and edges that are slightly higher or to the right or to the left are selected…(

But there is a plus, with such an allocation. Moving works without delay, and the standard tool has it. Small, but there is.

1 Like