Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_context_menu.c
| Show First 20 Lines • Show All 398 Lines • ▼ Show 20 Lines | bool ui_popup_context_menu_for_button(bContext *C, uiBut *but) | ||||
| } | } | ||||
| else if (but->rnapoin.data && but->rnaprop) { | else if (but->rnapoin.data && but->rnaprop) { | ||||
| PointerRNA *ptr = &but->rnapoin; | PointerRNA *ptr = &but->rnapoin; | ||||
| PropertyRNA *prop = but->rnaprop; | PropertyRNA *prop = but->rnaprop; | ||||
| const PropertyType type = RNA_property_type(prop); | const PropertyType type = RNA_property_type(prop); | ||||
| const PropertySubType subtype = RNA_property_subtype(prop); | const PropertySubType subtype = RNA_property_subtype(prop); | ||||
| bool is_anim = RNA_property_animateable(ptr, prop); | bool is_anim = RNA_property_animateable(ptr, prop); | ||||
| bool is_editable = RNA_property_editable(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); | bool is_set = RNA_property_is_set(ptr, prop); | ||||
| /* second slower test, saved people finding keyframe items in menus when its not possible */ | /* second slower test, saved people finding keyframe items in menus when its not possible */ | ||||
| if (is_anim) | if (is_anim) | ||||
| is_anim = RNA_property_path_from_ID_check(&but->rnapoin, but->rnaprop); | is_anim = RNA_property_path_from_ID_check(&but->rnapoin, but->rnaprop); | ||||
| /* determine if we can key a single component of an array */ | /* determine if we can key a single component of an array */ | ||||
| const bool is_array = RNA_property_array_length(&but->rnapoin, but->rnaprop) != 0; | const bool is_array = RNA_property_array_length(&but->rnapoin, but->rnaprop) != 0; | ||||
| ▲ Show 20 Lines • Show All 222 Lines • ▼ Show 20 Lines | else { | ||||
| uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Reset to Default Value"), | uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Reset to Default Value"), | ||||
| ICON_LOOP_BACK, "UI_OT_reset_default_button", "all", 1); | ICON_LOOP_BACK, "UI_OT_reset_default_button", "all", 1); | ||||
| } | } | ||||
| if (is_editable /*&& is_idprop*/ && is_set) { | if (is_editable /*&& is_idprop*/ && is_set) { | ||||
| uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Unset"), | uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Unset"), | ||||
| ICON_NONE, "UI_OT_unset_property_button"); | 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) { | if (is_array_component) { | ||||
| uiItemBooleanO( | uiItemBooleanO( | ||||
| layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy All To Selected"), | layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy All To Selected"), | ||||
| ICON_NONE, "UI_OT_copy_to_selected_button", "all", true); | ICON_NONE, "UI_OT_copy_to_selected_button", "all", true); | ||||
| uiItemBooleanO( | uiItemBooleanO( | ||||
| layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy Single To Selected"), | layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy Single To Selected"), | ||||
| ICON_NONE, "UI_OT_copy_to_selected_button", "all", false); | ICON_NONE, "UI_OT_copy_to_selected_button", "all", false); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 222 Lines • Show Last 20 Lines | |||||