Hi! Sorry if this was already asked. I tried using the forum’s search engine but couldn’t find something related, so…
Currently I have this small script:
import bpy
class SnapperOBJ(bpy.types.Panel):
bl_space_type = "VIEW_3D"
bl_region_type = "TOOLS"
bl_context = "objectmode"
bl_label = "Snapper Panel"
def draw(self, context):
layout = self.layout
col = layout.column(align=True)
col.label(text="Snap:")
col.operator("view3d.snap_selected_to_cursor", text="Selected to Cursor")
col.operator("view3d.snap_cursor_to_selected", text="Cursor to Selected")
class SnapperEDIT(bpy.types.Panel):
bl_space_type = "VIEW_3D"
bl_region_type = "TOOLS"
bl_context = "editmode"
bl_label = "Snapper Panel"
def draw(self, context):
layout = self.layout
col = layout.column(align=True)
col.label(text="Snap:")
col.operator("view3d.snap_selected_to_cursor", text="Selected to Cursor")
col.operator("view3d.snap_cursor_to_selected", text="Cursor to Selected")
bpy.utils.register_class(SnapperOBJ)
bpy.utils.register_class(SnapperEDIT)
It does register the buttons the way I want in Object mode, which is great, but the menu doesn’t appear in Edit Mode, when I need this the most!
How can I make this work? Specifically, I need to select vertices/faces, and snap the cursor to those.
Also, FYI: I’m using Maya shortcuts, not Blender default.