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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--release/scripts/startup/bl_operators/wm.py32
-rw-r--r--source/blender/editors/object/object_ops.c1
2 files changed, 23 insertions, 10 deletions
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py
index 557badb500c..ba475f56b96 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -43,6 +43,12 @@ rna_reverse_prop = BoolProperty(
default=False,
)
+rna_wrap_prop = BoolProperty(
+ name="Wrap",
+ description="Wrap back to the first/last values",
+ default=False,
+ )
+
rna_relative_prop = BoolProperty(
name="Relative",
description="Apply relative to the current value (delta)",
@@ -399,6 +405,7 @@ class WM_OT_context_cycle_int(Operator):
data_path = rna_path_prop
reverse = rna_reverse_prop
+ wrap = rna_wrap_prop
def execute(self, context):
data_path = self.data_path
@@ -413,14 +420,15 @@ class WM_OT_context_cycle_int(Operator):
exec("context.%s = value" % data_path)
- if value != eval("context.%s" % data_path):
- # relies on rna clamping integers out of the range
- if self.reverse:
- value = (1 << 31) - 1
- else:
- value = -1 << 31
+ if self.wrap:
+ if value != eval("context.%s" % data_path):
+ # relies on rna clamping integers out of the range
+ if self.reverse:
+ value = (1 << 31) - 1
+ else:
+ value = -1 << 31
- exec("context.%s = value" % data_path)
+ exec("context.%s = value" % data_path)
return operator_path_undo_return(context, data_path)
@@ -433,6 +441,7 @@ class WM_OT_context_cycle_enum(Operator):
data_path = rna_path_prop
reverse = rna_reverse_prop
+ wrap = rna_wrap_prop
def execute(self, context):
data_path = self.data_path
@@ -460,15 +469,18 @@ class WM_OT_context_cycle_enum(Operator):
enums = rna_struct.properties[rna_prop_str].enum_items.keys()
orig_index = enums.index(orig_value)
- # Have the info we need, advance to the next item
+ # Have the info we need, advance to the next item.
+ #
+ # When wrap's disabled we may set the value to its self,
+ # this is done to ensure update callbacks run.
if self.reverse:
if orig_index == 0:
- advance_enum = enums[-1]
+ advance_enum = enums[-1] if self.wrap else enums[0]
else:
advance_enum = enums[orig_index - 1]
else:
if orig_index == len(enums) - 1:
- advance_enum = enums[0]
+ advance_enum = enums[0] if self.wrap else enums[-1]
else:
advance_enum = enums[orig_index + 1]
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index 22cac8638d9..eddd67ae8f1 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -464,6 +464,7 @@ void ED_keymap_proportional_cycle(struct wmKeyConfig *UNUSED(keyconf), struct wm
kmi = WM_keymap_add_item(keymap, "WM_OT_context_cycle_enum", OKEY, KM_PRESS, KM_SHIFT, 0);
RNA_string_set(kmi->ptr, "data_path", "tool_settings.proportional_edit_falloff");
+ RNA_boolean_set(kmi->ptr, "wrap", true);
}
void ED_keymap_proportional_obmode(struct wmKeyConfig *UNUSED(keyconf), struct wmKeyMap *keymap)