key shortcits for sculpt back
authorCampbell Barton <ideasman42@gmail.com>
Wed, 23 Dec 2009 12:13:48 +0000 (12:13 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 23 Dec 2009 12:13:48 +0000 (12:13 +0000)
- T was 'Flatten Brush', now Shift+T
- added an option to OBJECT_OT_subdivision_set to set the level relatively (so page up/down works), however RNA lets it set one level higher then the maximum, this seems displays OK in the 3D view so not sure whats going on here (as if there is always an extra hidden multires level).

release/scripts/op/object.py
source/blender/editors/object/object_ops.c
source/blender/editors/sculpt_paint/paint_ops.c
source/blender/editors/transform/transform_ops.c

index 2ecd7b31b34b2ac40a533d317a7f8414e855d105..228d8566f77277892f146c8114134b1410191dc9 100644 (file)
@@ -84,7 +84,9 @@ class SubdivisionSet(bpy.types.Operator):
     bl_undo = True
 
     level = IntProperty(name="Level",
-            default=1, min=0, max=100, soft_min=0, soft_max=6)
+            default=1, min=-100, max=100, soft_min=-6, soft_max=6)
+
+    relative = BoolProperty(name="Relative", description="Apply the subsurf level as an offset relative to the current level", default=False)
 
     def poll(self, context):
         obs = context.selected_editable_objects
@@ -92,19 +94,35 @@ class SubdivisionSet(bpy.types.Operator):
 
     def execute(self, context):
         level = self.properties.level
+        relative = self.properties.relative
+
+        if relative and level == 0:
+            return ('CANCELLED',) # nothing to do
 
         def set_object_subd(obj):
             for mod in obj.modifiers:
                 if mod.type == 'MULTIRES':
-                    if level < mod.total_levels:
-                        if obj.mode == 'SCULPT' and mod.sculpt_levels != level:
-                            mod.sculpt_levels = level
-                        elif obj.mode == 'OBJECT' and mod.levels != level:
-                            mod.levels = level
+                    if level <= mod.total_levels:
+                        if obj.mode == 'SCULPT':
+                            if relative:
+                                mod.sculpt_levels += level
+                            else:
+                                if mod.sculpt_levels != level:
+                                    mod.sculpt_levels = level
+                        elif obj.mode == 'OBJECT':
+                            if relative:
+                                mod.levels += level
+                            else:
+                                if mod.levels != level:
+                                    mod.levels = level
                     return
                 elif mod.type == 'SUBSURF':
-                    if mod.levels != level:
-                        mod.levels = level
+                    if relative:
+                        mod.levels += level
+                    else:
+                        if mod.levels != level:
+                            mod.levels = level
+
                     return
 
             # adda new modifier
index bd43e9c24c466d1be144d217b8a3b5c122fbca09..7b11bc5895011ea890e20eb274132c928fe41662 100644 (file)
@@ -317,7 +317,7 @@ void ED_keymap_object(wmKeyConfig *keyconf)
        WM_keymap_verify_item(keymap, "GROUP_OT_objects_add_active", GKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
        WM_keymap_verify_item(keymap, "GROUP_OT_objects_remove_active", GKEY, KM_PRESS, KM_SHIFT|KM_ALT, 0);
 
-       for(i=1; i<=5; i++) {
+       for(i=0; i<=5; i++) {
                kmi = WM_keymap_add_item(keymap, "OBJECT_OT_subdivision_set", ZEROKEY+i, KM_PRESS, KM_CTRL, 0);
                RNA_int_set(kmi->ptr, "level", i);
        }
@@ -342,15 +342,15 @@ void ED_object_generic_keymap(struct wmKeyConfig *keyconf, struct wmKeyMap *keym
        if(do_pet) {
                /* context ops */
                km = WM_keymap_add_item(keymap, "WM_OT_context_cycle_enum", OKEY, KM_PRESS, KM_SHIFT, 0);
-               RNA_string_set(km->ptr, "path", "scene.tool_settings.proportional_editing_falloff");
+               RNA_string_set(km->ptr, "path", "tool_settings.proportional_editing_falloff");
 
                km = WM_keymap_add_item(keymap, "WM_OT_context_toggle_enum", OKEY, KM_PRESS, 0, 0);
-               RNA_string_set(km->ptr, "path", "scene.tool_settings.proportional_editing");
+               RNA_string_set(km->ptr, "path", "tool_settings.proportional_editing");
                RNA_string_set(km->ptr, "value_1", "DISABLED");
                RNA_string_set(km->ptr, "value_2", "ENABLED");
 
                km = WM_keymap_add_item(keymap, "WM_OT_context_toggle_enum", OKEY, KM_PRESS, KM_ALT, 0);
-               RNA_string_set(km->ptr, "path", "scene.tool_settings.proportional_editing");
+               RNA_string_set(km->ptr, "path", "tool_settings.proportional_editing");
                RNA_string_set(km->ptr, "value_1", "DISABLED");
                RNA_string_set(km->ptr, "value_2", "CONNECTED");
        }
index a54c2b71ee75f0b1f1f0291f0b251bd4f8514507..b87d229545e26fbdfa5e8c0c0bf4002120f33b04 100644 (file)
@@ -179,6 +179,7 @@ static void ed_keymap_paint_brush_switch(wmKeyMap *keymap, const char *path)
 void ED_keymap_paint(wmKeyConfig *keyconf)
 {
        wmKeyMap *keymap;
+       wmKeyMapItem *kmi;
        int i;
        
        /* Sculpt mode */
@@ -194,9 +195,51 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
 
        ed_keymap_paint_brush_switch(keymap, "tool_settings.sculpt.active_brush_index");
 
-       for(i=1; i<=5; i++)
+       for(i=0; i<=5; i++)
                RNA_int_set(WM_keymap_add_item(keymap, "OBJECT_OT_subdivision_set", ZEROKEY+i, KM_PRESS, KM_CTRL, 0)->ptr, "level", i);
 
+       /* multires switch */
+       kmi= WM_keymap_add_item(keymap, "OBJECT_OT_subdivision_set", PAGEUPKEY, KM_PRESS, 0, 0);
+       RNA_int_set(kmi->ptr, "level", 1);
+       RNA_boolean_set(kmi->ptr, "relative", 1);
+
+       kmi= WM_keymap_add_item(keymap, "OBJECT_OT_subdivision_set", PAGEDOWNKEY, KM_PRESS, 0, 0);
+       RNA_int_set(kmi->ptr, "level", -1);
+       RNA_boolean_set(kmi->ptr, "relative", 1);
+
+       /* toggles */
+       kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", AKEY, KM_PRESS, 0, 0);
+       RNA_string_set(kmi->ptr, "path", "tool_settings.sculpt.brush.use_anchor");
+
+       kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", SKEY, KM_PRESS, KM_SHIFT, 0);
+       RNA_string_set(kmi->ptr, "path", "tool_settings.sculpt.brush.use_smooth_stroke");
+
+       /* brush switching */
+       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", DKEY, KM_PRESS, 0, 0);
+       RNA_string_set(kmi->ptr, "path", "tool_settings.sculpt.brush.sculpt_tool");
+       RNA_string_set(kmi->ptr, "value", "DRAW");
+
+       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", SKEY, KM_PRESS, 0, 0);
+       RNA_string_set(kmi->ptr, "path", "tool_settings.sculpt.brush.sculpt_tool");
+       RNA_string_set(kmi->ptr, "value", "SMOOTH");
+
+       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", PKEY, KM_PRESS, 0, 0);
+       RNA_string_set(kmi->ptr, "path", "tool_settings.sculpt.brush.sculpt_tool");
+       RNA_string_set(kmi->ptr, "value", "PINCH");
+
+       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", GKEY, KM_PRESS, 0, 0);
+       RNA_string_set(kmi->ptr, "path", "tool_settings.sculpt.brush.sculpt_tool");
+       RNA_string_set(kmi->ptr, "value", "GRAB");
+
+       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", LKEY, KM_PRESS, 0, 0);
+       RNA_string_set(kmi->ptr, "path", "tool_settings.sculpt.brush.sculpt_tool");
+       RNA_string_set(kmi->ptr, "value", "LAYER");
+
+       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", TKEY, KM_PRESS, KM_SHIFT, 0); /* was just T in 2.4x */
+       RNA_string_set(kmi->ptr, "path", "tool_settings.sculpt.brush.sculpt_tool");
+       RNA_string_set(kmi->ptr, "value", "FLATTEN");
+
+
        /* Vertex Paint mode */
        keymap= WM_keymap_find(keyconf, "Vertex Paint", 0, 0);
        keymap->poll= vertex_paint_poll;
index 63218369a90f53a0ba0f109233a00f3f6410853a..4c118aa26252a8c08345f46e2e18e60969930987 100644 (file)
@@ -825,7 +825,7 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
                        km = WM_keymap_add_item(keymap, OP_MIRROR, MKEY, KM_PRESS, KM_CTRL, 0);
 
                        km = WM_keymap_add_item(keymap, "WM_OT_context_toggle", TABKEY, KM_PRESS, KM_SHIFT, 0);
-                       RNA_string_set(km->ptr, "path", "scene.tool_settings.snap");
+                       RNA_string_set(km->ptr, "path", "tool_settings.snap");
 
                        km = WM_keymap_add_item(keymap, "TRANSFORM_OT_snap_type", TABKEY, KM_PRESS, KM_SHIFT|KM_CLICK, 0);
 
@@ -902,7 +902,7 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
                        km = WM_keymap_add_item(keymap, "TRANSFORM_OT_mirror", MKEY, KM_PRESS, KM_CTRL, 0);
 
                        km = WM_keymap_add_item(keymap, "WM_OT_context_toggle", TABKEY, KM_PRESS, KM_SHIFT, 0);
-                       RNA_string_set(km->ptr, "path", "scene.tool_settings.snap");
+                       RNA_string_set(km->ptr, "path", "tool_settings.snap");
                        break;
                default:
                        break;