diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-02-12 08:31:23 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-02-12 14:05:24 +0400 |
commit | bd89528a5e159349003b90ec9f9a2460d0b45227 (patch) | |
tree | f7a5cbeddcd7324b0cd0ed6e5a3a5324c527b673 /release/scripts/startup/bl_operators/wm.py | |
parent | 054094f5827f3b6c0c1a6316c2e624f197244ec8 (diff) |
Code cleanup: replace WM_OT_ndof_sensitivity_change -> WM_OT_context_scale_float
also increase maximum sensitivity
Diffstat (limited to 'release/scripts/startup/bl_operators/wm.py')
-rw-r--r-- | release/scripts/startup/bl_operators/wm.py | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index a249d3dffdc..332e4de124e 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -191,10 +191,38 @@ class WM_OT_context_set_int(Operator): # same as enum execute = execute_context_assign +class WM_OT_context_scale_float(Operator): + """Scale a float context value""" + bl_idname = "wm.context_scale_float" + bl_label = "Context Scale Float" + bl_options = {'UNDO', 'INTERNAL'} + + data_path = rna_path_prop + value = FloatProperty( + name="Value", + description="Assign value", + default=1.0, + ) + + def execute(self, context): + data_path = self.data_path + if context_path_validate(context, data_path) is Ellipsis: + return {'PASS_THROUGH'} + + value = self.value + + if value == 1.0: # nothing to do + return {'CANCELLED'} + + exec("context.%s *= value" % data_path) + + return operator_path_undo_return(context, data_path) + + class WM_OT_context_scale_int(Operator): """Scale an int context value""" bl_idname = "wm.context_scale_int" - bl_label = "Context Set" + bl_label = "Context Scale Int" bl_options = {'UNDO', 'INTERNAL'} data_path = rna_path_prop |