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:
authorAlexander Gavrilov <angavrilov@gmail.com>2018-12-15 22:37:12 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2018-12-19 14:20:35 +0300
commit61c941f040d367d18fcaa57c9e8e0c2078193d97 (patch)
tree9cf843e4f19fffda991afb77595ec4d287a0b142 /source/blender/editors/interface/interface_context_menu.c
parent908a2742403b279cd6dfa5c27acb76d68d3f1523 (diff)
RNA: support setting default values for custom properties.
NLA requires a usable default value for all properties that are to be animated via it, without any exceptions. This is the real cause of T36496: using the default of 0 for a scale related custom property obviously doesn't work. Thus, to really fix this it is necessary to support configurable default values for custom properties, which are very frequently used in rigs for auxiliary settings. For common use it is enough to support this for scalar float and integer properties. The default can be set via the custom property configuration popup, or a right click menu option. In addition, to help in updating old rigs, an operator that saves current values as defaults for all object and bone properties is added. Reviewers: campbellbarton, brecht Differential Revision: https://developer.blender.org/D4084
Diffstat (limited to 'source/blender/editors/interface/interface_context_menu.c')
-rw-r--r--source/blender/editors/interface/interface_context_menu.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface_context_menu.c b/source/blender/editors/interface/interface_context_menu.c
index 84460f9f149..d9967625199 100644
--- a/source/blender/editors/interface/interface_context_menu.c
+++ b/source/blender/editors/interface/interface_context_menu.c
@@ -404,7 +404,7 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but)
const PropertySubType subtype = RNA_property_subtype(prop);
bool is_anim = RNA_property_animateable(ptr, prop);
bool is_editable = RNA_property_editable(ptr, prop);
- /*bool is_idprop = RNA_property_is_idprop(prop);*/ /* XXX does not work as expected, not strictly needed */
+ bool is_idprop = RNA_property_is_idprop(prop);
bool is_set = RNA_property_is_set(ptr, prop);
/* second slower test, saved people finding keyframe items in menus when its not possible */
@@ -643,6 +643,13 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but)
ICON_NONE, "UI_OT_unset_property_button");
}
+ if (is_idprop && !is_array_component && ELEM(type, PROP_INT, PROP_FLOAT)) {
+ uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Assign Value as Default"),
+ ICON_NONE, "UI_OT_assign_default_button");
+
+ uiItemS(layout);
+ }
+
if (is_array_component) {
uiItemBooleanO(
layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy All To Selected"),