diff options
author | Matt Ebb <matt@mke3.net> | 2010-01-04 03:18:08 +0300 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2010-01-04 03:18:08 +0300 |
commit | 1cbe3c06d64e628c1f3a9a1ed157be39f5d2c9e1 (patch) | |
tree | 7f70b4b0ac8e0589632285f10a324bfe802b622b | |
parent | 4494ec80191a4f7fe37d5f43bb9a2aab48035519 (diff) |
* Added new hotkeys [ and ] to decrease/increase brush size by 20 in all paint modes.
The actual value to increment/decrement by can be customised in key maps.
-rw-r--r-- | release/scripts/op/wm.py | 12 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_ops.c | 20 |
2 files changed, 28 insertions, 4 deletions
diff --git a/release/scripts/op/wm.py b/release/scripts/op/wm.py index f1eda24b7ca..230a3b8b492 100644 --- a/release/scripts/op/wm.py +++ b/release/scripts/op/wm.py @@ -61,7 +61,10 @@ def context_path_validate(context, path): def execute_context_assign(self, context): if context_path_validate(context, self.properties.path) is Ellipsis: return {'PASS_THROUGH'} - exec("context.%s=self.properties.value" % self.properties.path) + if self.properties.relative: + exec("context.%s+=self.properties.value" % self.properties.path) + else: + exec("context.%s=self.properties.value" % self.properties.path) return {'FINISHED'} @@ -86,6 +89,8 @@ class WM_OT_context_set_int(bpy.types.Operator): # same as enum path = rna_path_prop value = IntProperty(name="Value", description="Assign value", default=0) + relative = BoolProperty(name="Relative", + description="Apply the value as a relative difference", default=False) execute = execute_context_assign @@ -97,8 +102,9 @@ class WM_OT_context_set_float(bpy.types.Operator): # same as enum bl_undo = True path = rna_path_prop - value = FloatProperty(name="Value", - description="Assignment value", default=0.0) + value = FloatProperty(name="Value", description="Assignment value", default=0.0) + relative = BoolProperty(name="Relative", + description="Apply the value as a relative difference", default=False) execute = execute_context_assign diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index 57b56da2fcd..715a41e6431 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -176,6 +176,21 @@ static void ed_keymap_paint_brush_switch(wmKeyMap *keymap, const char *path) RNA_int_set(kmi->ptr, "value", 9); } +static void ed_keymap_paint_brush_size(wmKeyMap *keymap, const char *path) +{ + wmKeyMapItem *kmi; + + kmi= WM_keymap_add_item(keymap, "WM_OT_context_set_int", LEFTBRACKETKEY, KM_PRESS, 0, 0); + RNA_string_set(kmi->ptr, "path", path); + RNA_int_set(kmi->ptr, "value", -20); + RNA_boolean_set(kmi->ptr, "relative", 1); + + kmi= WM_keymap_add_item(keymap, "WM_OT_context_set_int", RIGHTBRACKETKEY, KM_PRESS, 0, 0); + RNA_string_set(kmi->ptr, "path", path); + RNA_int_set(kmi->ptr, "value", 20); + RNA_boolean_set(kmi->ptr, "relative", 1); +} + void ED_keymap_paint(wmKeyConfig *keyconf) { wmKeyMap *keymap; @@ -205,8 +220,8 @@ void ED_keymap_paint(wmKeyConfig *keyconf) RNA_int_set(kmi->ptr, "level", -1); RNA_boolean_set(kmi->ptr, "relative", 1); - /* toggles */ ed_keymap_paint_brush_switch(keymap, "tool_settings.sculpt.active_brush_index"); + ed_keymap_paint_brush_size(keymap, "tool_settings.sculpt.brush.size"); 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"); @@ -259,6 +274,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf) "PAINT_OT_vertex_color_set",KKEY, KM_PRESS, KM_SHIFT, 0); ed_keymap_paint_brush_switch(keymap, "tool_settings.vertex_paint.active_brush_index"); + ed_keymap_paint_brush_size(keymap, "tool_settings.vertex_paint.brush.size"); /* Weight Paint mode */ keymap= WM_keymap_find(keyconf, "Weight Paint", 0, 0); @@ -273,6 +289,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf) "PAINT_OT_weight_set", KKEY, KM_PRESS, KM_SHIFT, 0); ed_keymap_paint_brush_switch(keymap, "tool_settings.weight_paint.active_brush_index"); + ed_keymap_paint_brush_size(keymap, "tool_settings.weight_paint.brush.size"); /* Image/Texture Paint mode */ keymap= WM_keymap_find(keyconf, "Image Paint", 0, 0); @@ -286,6 +303,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "PAINT_OT_clone_cursor_set", LEFTMOUSE, KM_PRESS, KM_CTRL, 0); ed_keymap_paint_brush_switch(keymap, "tool_settings.image_paint.active_brush_index"); + ed_keymap_paint_brush_size(keymap, "tool_settings.image_paint.brush.size"); /* face-mask mode */ keymap= WM_keymap_find(keyconf, "Face Mask", 0, 0); |