Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_handlers.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
| Show First 20 Lines • Show All 7,034 Lines • ▼ Show 20 Lines | else if ((event->type == EKEY) && (event->val == KM_PRESS)) { | ||||
| (RNA_property_array_check(but->rnaprop) == false)) | (RNA_property_array_check(but->rnaprop) == false)) | ||||
| { | { | ||||
| WM_operator_name_call(C, "UI_OT_eyedropper_depth", WM_OP_INVOKE_DEFAULT, NULL); | WM_operator_name_call(C, "UI_OT_eyedropper_depth", WM_OP_INVOKE_DEFAULT, NULL); | ||||
| return WM_UI_HANDLER_BREAK; | return WM_UI_HANDLER_BREAK; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* handle keyframing */ | |||||
| else if ((event->type == IKEY) && | |||||
| !IS_EVENT_MOD(event, ctrl, oskey) && | |||||
| (event->val == KM_PRESS)) | |||||
| { | |||||
| if (event->alt) { | |||||
| if (event->shift) { | |||||
| ui_but_anim_clear_keyframe(C); | |||||
| } | |||||
| else { | |||||
| ui_but_anim_delete_keyframe(C); | |||||
| } | |||||
| } | |||||
| else { | |||||
| ui_but_anim_insert_keyframe(C); | |||||
| } | |||||
| ED_region_tag_redraw(data->region); | |||||
| return WM_UI_HANDLER_BREAK; | |||||
| } | |||||
| /* handle drivers */ | /* handle drivers */ | ||||
| else if ((event->type == DKEY) && | else if ((event->type == DKEY) && | ||||
| !IS_EVENT_MOD(event, shift, oskey) && | !IS_EVENT_MOD(event, shift, oskey) && | ||||
| (event->val == KM_PRESS)) | (event->val == KM_PRESS)) | ||||
| { | { | ||||
| /* quick check to prevent this opening within the popup menu its self */ | /* quick check to prevent this opening within the popup menu its self */ | ||||
| if (!ELEM(NULL, but->rnapoin.data, but->rnaprop)) { | if (!ELEM(NULL, but->rnapoin.data, but->rnaprop)) { | ||||
| if (event->alt) | if (event->alt) | ||||
| ▲ Show 20 Lines • Show All 1,005 Lines • ▼ Show 20 Lines | static uiBut *ui_context_rna_button_active(const bContext *C) | ||||
| return ui_context_button_active(C, ui_context_rna_button_active_test); | return ui_context_button_active(C, ui_context_rna_button_active_test); | ||||
| } | } | ||||
| uiBut *UI_context_active_but_get(const struct bContext *C) | uiBut *UI_context_active_but_get(const struct bContext *C) | ||||
| { | { | ||||
| return ui_context_button_active(C, NULL); | return ui_context_button_active(C, NULL); | ||||
| } | } | ||||
| /* helper function for insert keyframe, reset to default, etc operators */ | /** | ||||
| void UI_context_active_but_prop_get( | * Version of #UI_context_active_but_get that also returns RNA property info. | ||||
| * Helper function for insert keyframe, reset to default, etc operators. | |||||
| * | |||||
| * \return active button or NULL if none found or if it doesn't contain valid RNA data. | |||||
| */ | |||||
| uiBut *UI_context_active_but_prop_get( | |||||
| const bContext *C, | const bContext *C, | ||||
| struct PointerRNA *r_ptr, struct PropertyRNA **r_prop, int *r_index) | struct PointerRNA *r_ptr, struct PropertyRNA **r_prop, int *r_index) | ||||
| { | { | ||||
| uiBut *activebut = ui_context_rna_button_active(C); | uiBut *activebut = ui_context_rna_button_active(C); | ||||
| if (activebut && activebut->rnapoin.data) { | if (activebut && activebut->rnapoin.data) { | ||||
| *r_ptr = activebut->rnapoin; | *r_ptr = activebut->rnapoin; | ||||
| *r_prop = activebut->rnaprop; | *r_prop = activebut->rnaprop; | ||||
| *r_index = activebut->rnaindex; | *r_index = activebut->rnaindex; | ||||
| } | } | ||||
| else { | else { | ||||
| memset(r_ptr, 0, sizeof(*r_ptr)); | memset(r_ptr, 0, sizeof(*r_ptr)); | ||||
| *r_prop = NULL; | *r_prop = NULL; | ||||
| *r_index = 0; | *r_index = 0; | ||||
| } | } | ||||
| return activebut; | |||||
| } | } | ||||
| void UI_context_active_but_prop_handle(bContext *C) | void UI_context_active_but_prop_handle(bContext *C) | ||||
| { | { | ||||
| uiBut *activebut = ui_context_rna_button_active(C); | uiBut *activebut = ui_context_rna_button_active(C); | ||||
| if (activebut) { | if (activebut) { | ||||
| /* TODO, look into a better way to handle the button change | /* TODO, look into a better way to handle the button change | ||||
| * currently this is mainly so reset defaults works for the | * currently this is mainly so reset defaults works for the | ||||
| ▲ Show 20 Lines • Show All 2,149 Lines • Show Last 20 Lines | |||||