Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-10-26 12:09:13 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-10-26 12:09:13 +0400
commit52551aa23aceaff22612ea9fd4ba1af518aea908 (patch)
treefa1e0d769d60bafe2ef2b01b0b4d628ca3dda065 /mesh_surface_sketch.py
parent1c53e9126aefaaa8587795de6a2ce3475eeae074 (diff)
bugfix [#23787] Addon keybindings assume view3d keymaps are available.
Diffstat (limited to 'mesh_surface_sketch.py')
-rw-r--r--mesh_surface_sketch.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/mesh_surface_sketch.py b/mesh_surface_sketch.py
index fb08e490..80cd6c04 100644
--- a/mesh_surface_sketch.py
+++ b/mesh_surface_sketch.py
@@ -793,8 +793,12 @@ def register():
bpy.types.Scene.SURFSK_precision = bpy.props.IntProperty(name="Precision", description="Precision level of the surface calculation", default=4, min=0, max=100000)
bpy.types.Scene.SURFSK_keep_strokes = bpy.props.BoolProperty(name="Keep strokes", description="Keeps the sketched strokes after adding the surface", default=False)
- keymap_item_add_surf = bpy.data.window_managers[0].keyconfigs.default.keymaps["3D View"].items.new("GPENCIL_OT_SURFSK_add_surface","E","PRESS", key_modifier="D")
- keymap_item_stroke_to_curve = bpy.data.window_managers[0].keyconfigs.default.keymaps["3D View"].items.new("GPENCIL_OT_SURFSK_strokes_to_curves","C","PRESS", key_modifier="D")
+ kc = bpy.data.window_managers[0].keyconfigs.default
+ km = kc.keymaps.get("3D View")
+ if km is None:
+ km = kc.keymaps.new(name="3D View")
+ keymap_item_add_surf = km.items.new("GPENCIL_OT_SURFSK_add_surface","E","PRESS", key_modifier="D")
+ keymap_item_stroke_to_curve = km.items.new("GPENCIL_OT_SURFSK_strokes_to_curves","C","PRESS", key_modifier="D")
def unregister():
@@ -803,7 +807,8 @@ def unregister():
del bpy.types.Scene.SURFSK_precision
del bpy.types.Scene.SURFSK_keep_strokes
- km = bpy.data.window_managers[0].keyconfigs.default.keymaps["3D View"]
+ kc = bpy.data.window_managers[0].keyconfigs.default
+ km = kc.keymaps["3D View"]
for kmi in km.items:
if kmi.idname == 'wm.call_menu':
if kmi.properties.name == "GPENCIL_OT_SURFSK_add_surface":