Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/animation/keyframing.c
| Show First 20 Lines • Show All 1,396 Lines • ▼ Show 20 Lines | static int insert_key_menu_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| /* if prompting or no active Keying Set, show the menu */ | /* if prompting or no active Keying Set, show the menu */ | ||||
| if ((scene->active_keyingset == 0) || RNA_boolean_get(op->ptr, "always_prompt")) { | if ((scene->active_keyingset == 0) || RNA_boolean_get(op->ptr, "always_prompt")) { | ||||
| uiPopupMenu *pup; | uiPopupMenu *pup; | ||||
| uiLayout *layout; | uiLayout *layout; | ||||
| /* call the menu, which will call this operator again, hence the canceled */ | /* call the menu, which will call this operator again, hence the canceled */ | ||||
| pup = uiPupMenuBegin(C, RNA_struct_ui_name(op->type->srna), ICON_NONE); | pup = UI_popup_menu_begin(C, RNA_struct_ui_name(op->type->srna), ICON_NONE); | ||||
| layout = uiPupMenuLayout(pup); | layout = UI_popup_menu_layout(pup); | ||||
| uiItemsEnumO(layout, "ANIM_OT_keyframe_insert_menu", "type"); | uiItemsEnumO(layout, "ANIM_OT_keyframe_insert_menu", "type"); | ||||
| uiPupMenuEnd(C, pup); | UI_popup_menu_end(C, pup); | ||||
| return OPERATOR_INTERFACE; | return OPERATOR_INTERFACE; | ||||
| } | } | ||||
| else { | else { | ||||
| /* just call the exec() on the active keyingset */ | /* just call the exec() on the active keyingset */ | ||||
| RNA_enum_set(op->ptr, "type", 0); | RNA_enum_set(op->ptr, "type", 0); | ||||
| RNA_boolean_set(op->ptr, "confirm_success", true); | RNA_boolean_set(op->ptr, "confirm_success", true); | ||||
| ▲ Show 20 Lines • Show All 282 Lines • ▼ Show 20 Lines | static int insert_key_button_exec(bContext *C, wmOperator *op) | ||||
| int a, index, length; | int a, index, length; | ||||
| const bool all = RNA_boolean_get(op->ptr, "all"); | const bool all = RNA_boolean_get(op->ptr, "all"); | ||||
| short flag = 0; | short flag = 0; | ||||
| /* flags for inserting keyframes */ | /* flags for inserting keyframes */ | ||||
| flag = ANIM_get_keyframing_flags(scene, 1); | flag = ANIM_get_keyframing_flags(scene, 1); | ||||
| /* try to insert keyframe using property retrieved from UI */ | /* try to insert keyframe using property retrieved from UI */ | ||||
| uiContextActiveProperty(C, &ptr, &prop, &index); | UI_context_active_but_prop_get(C, &ptr, &prop, &index); | ||||
| if ((ptr.id.data && ptr.data && prop) && RNA_property_animateable(&ptr, prop)) { | if ((ptr.id.data && ptr.data && prop) && RNA_property_animateable(&ptr, prop)) { | ||||
| path = RNA_path_from_ID_to_property(&ptr, prop); | path = RNA_path_from_ID_to_property(&ptr, prop); | ||||
| if (path) { | if (path) { | ||||
| if (all) { | if (all) { | ||||
| length = RNA_property_array_length(&ptr, prop); | length = RNA_property_array_length(&ptr, prop); | ||||
| Show All 30 Lines | else { | ||||
| BKE_reportf(op->reports, RPT_WARNING, | BKE_reportf(op->reports, RPT_WARNING, | ||||
| "Button doesn't appear to have any property information attached (ptr.data = %p, prop = %p)", | "Button doesn't appear to have any property information attached (ptr.data = %p, prop = %p)", | ||||
| (void *)ptr.data, (void *)prop); | (void *)ptr.data, (void *)prop); | ||||
| } | } | ||||
| } | } | ||||
| if (success) { | if (success) { | ||||
| /* send updates */ | /* send updates */ | ||||
| uiContextAnimUpdate(C); | UI_context_update_anim_flag(C); | ||||
| /* send notifiers that keyframes have been changed */ | /* send notifiers that keyframes have been changed */ | ||||
| WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_ADDED, NULL); | WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_ADDED, NULL); | ||||
| } | } | ||||
| return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED; | return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED; | ||||
| } | } | ||||
| Show All 24 Lines | static int delete_key_button_exec(bContext *C, wmOperator *op) | ||||
| PropertyRNA *prop = NULL; | PropertyRNA *prop = NULL; | ||||
| char *path; | char *path; | ||||
| float cfra = (float)CFRA; // XXX for now, don't bother about all the yucky offset crap | float cfra = (float)CFRA; // XXX for now, don't bother about all the yucky offset crap | ||||
| short success = 0; | short success = 0; | ||||
| int a, index, length; | int a, index, length; | ||||
| const bool all = RNA_boolean_get(op->ptr, "all"); | const bool all = RNA_boolean_get(op->ptr, "all"); | ||||
| /* try to insert keyframe using property retrieved from UI */ | /* try to insert keyframe using property retrieved from UI */ | ||||
| uiContextActiveProperty(C, &ptr, &prop, &index); | UI_context_active_but_prop_get(C, &ptr, &prop, &index); | ||||
| if (ptr.id.data && ptr.data && prop) { | if (ptr.id.data && ptr.data && prop) { | ||||
| path = RNA_path_from_ID_to_property(&ptr, prop); | path = RNA_path_from_ID_to_property(&ptr, prop); | ||||
| if (path) { | if (path) { | ||||
| if (all) { | if (all) { | ||||
| length = RNA_property_array_length(&ptr, prop); | length = RNA_property_array_length(&ptr, prop); | ||||
| Show All 13 Lines | static int delete_key_button_exec(bContext *C, wmOperator *op) | ||||
| } | } | ||||
| else if (G.debug & G_DEBUG) { | else if (G.debug & G_DEBUG) { | ||||
| printf("ptr.data = %p, prop = %p\n", (void *)ptr.data, (void *)prop); | printf("ptr.data = %p, prop = %p\n", (void *)ptr.data, (void *)prop); | ||||
| } | } | ||||
| if (success) { | if (success) { | ||||
| /* send updates */ | /* send updates */ | ||||
| uiContextAnimUpdate(C); | UI_context_update_anim_flag(C); | ||||
| /* send notifiers that keyframes have been changed */ | /* send notifiers that keyframes have been changed */ | ||||
| WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_REMOVED, NULL); | WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_REMOVED, NULL); | ||||
| } | } | ||||
| return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED; | return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED; | ||||
| } | } | ||||
| Show All 23 Lines | static int clear_key_button_exec(bContext *C, wmOperator *op) | ||||
| PointerRNA ptr = {{NULL}}; | PointerRNA ptr = {{NULL}}; | ||||
| PropertyRNA *prop = NULL; | PropertyRNA *prop = NULL; | ||||
| char *path; | char *path; | ||||
| short success = 0; | short success = 0; | ||||
| int a, index, length; | int a, index, length; | ||||
| const bool all = RNA_boolean_get(op->ptr, "all"); | const bool all = RNA_boolean_get(op->ptr, "all"); | ||||
| /* try to insert keyframe using property retrieved from UI */ | /* try to insert keyframe using property retrieved from UI */ | ||||
| uiContextActiveProperty(C, &ptr, &prop, &index); | UI_context_active_but_prop_get(C, &ptr, &prop, &index); | ||||
| if (ptr.id.data && ptr.data && prop) { | if (ptr.id.data && ptr.data && prop) { | ||||
| path = RNA_path_from_ID_to_property(&ptr, prop); | path = RNA_path_from_ID_to_property(&ptr, prop); | ||||
| if (path) { | if (path) { | ||||
| if (all) { | if (all) { | ||||
| length = RNA_property_array_length(&ptr, prop); | length = RNA_property_array_length(&ptr, prop); | ||||
| Show All 13 Lines | static int clear_key_button_exec(bContext *C, wmOperator *op) | ||||
| } | } | ||||
| else if (G.debug & G_DEBUG) { | else if (G.debug & G_DEBUG) { | ||||
| printf("ptr.data = %p, prop = %p\n", (void *)ptr.data, (void *)prop); | printf("ptr.data = %p, prop = %p\n", (void *)ptr.data, (void *)prop); | ||||
| } | } | ||||
| if (success) { | if (success) { | ||||
| /* send updates */ | /* send updates */ | ||||
| uiContextAnimUpdate(C); | UI_context_update_anim_flag(C); | ||||
| /* send notifiers that keyframes have been changed */ | /* send notifiers that keyframes have been changed */ | ||||
| WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_REMOVED, NULL); | WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_REMOVED, NULL); | ||||
| } | } | ||||
| return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED; | return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 245 Lines • Show Last 20 Lines | |||||