Skip to content

Instantly share code, notes, and snippets.

@sweenist
Created April 15, 2016 10:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sweenist/072821575c445c430731a158778575bd to your computer and use it in GitHub Desktop.
Save sweenist/072821575c445c430731a158778575bd to your computer and use it in GitHub Desktop.
Blender: A quick and easy way to disable relocation of the 3d cursor on LMB click in Blender
bl_info = {
"name": "3D Cursor LMB Toggle",
"author": "Ryan Sweeney",
"version": (1, 0),
"blender": (2, 75, 0),
"location": "View3D > Properties Panel > 3D Cursor",
"description": "Adds a toggle to the 3D Cursor properties tab.",
"warning": "",
"wiki_url": "http://sweenist.wordpress.com/2014/12/22/blender-add-on-3d-cursor-toggle/",
"category": "3D View"}
import bpy
from bpy.types import Panel
from bpy.props import BoolProperty
def draw_item(self, context):
wm = context.window_manager
keymaps = wm.keyconfigs['Blender User'].keymaps['3D View'].keymap_items
cursor_key = keymaps['view3d.cursor3d']
layout = self.layout
col = layout.column()
col.prop(wm, "toggle_3d_key")
cursor_key.active = wm.toggle_3d_key
def register():
bpy.types.VIEW3D_PT_view3d_cursor.append(draw_item)
bpy.types.WindowManager.toggle_3d_key = BoolProperty(name="Place with Click", description="Controls whether the 3D cursor moves on mouse click", default=True)
def unregister():
bpy.types.VIEW3D_PT_view3d_cursor.remove(draw_item)
del bpy.types.WindowManager.toggle_3d_key
if __name__ == "__main__":
register()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment