Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/screen/screen_context.c
| Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | |||||
| #include "BKE_object.h" | #include "BKE_object.h" | ||||
| #include "RNA_access.h" | #include "RNA_access.h" | ||||
| #include "ED_anim_api.h" | #include "ED_anim_api.h" | ||||
| #include "ED_armature.h" | #include "ED_armature.h" | ||||
| #include "ED_gpencil.h" | #include "ED_gpencil.h" | ||||
| #include "SEQ_select.h" | |||||
| #include "SEQ_sequencer.h" | #include "SEQ_sequencer.h" | ||||
| #include "UI_interface.h" | #include "UI_interface.h" | ||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| #include "screen_intern.h" | #include "screen_intern.h" | ||||
| const char *screen_context_dir[] = { | const char *screen_context_dir[] = { | ||||
| Show All 19 Lines | const char *screen_context_dir[] = { | ||||
| "object", | "object", | ||||
| "edit_object", | "edit_object", | ||||
| "sculpt_object", | "sculpt_object", | ||||
| "vertex_paint_object", | "vertex_paint_object", | ||||
| "weight_paint_object", | "weight_paint_object", | ||||
| "image_paint_object", | "image_paint_object", | ||||
| "particle_edit_object", | "particle_edit_object", | ||||
| "pose_object", | "pose_object", | ||||
| "active_sequence_strip", | |||||
| "sequences", | "sequences", | ||||
| "selected_sequences", | "selected_sequences", | ||||
| "selected_editable_sequences", /* sequencer */ | "selected_editable_sequences", /* sequencer */ | ||||
| "selected_nla_strips", /* nla editor */ | "selected_nla_strips", /* nla editor */ | ||||
| "gpencil_data", | "gpencil_data", | ||||
| "gpencil_data_owner", /* grease pencil data */ | "gpencil_data_owner", /* grease pencil data */ | ||||
| "annotation_data", | "annotation_data", | ||||
| "annotation_data_owner", | "annotation_data_owner", | ||||
| ▲ Show 20 Lines • Show All 496 Lines • ▼ Show 20 Lines | static eContextResult screen_ctx_pose_object(const bContext *C, bContextDataResult *result) | ||||
| ViewLayer *view_layer = WM_window_get_active_view_layer(win); | ViewLayer *view_layer = WM_window_get_active_view_layer(win); | ||||
| Object *obact = view_layer->basact ? view_layer->basact->object : NULL; | Object *obact = view_layer->basact ? view_layer->basact->object : NULL; | ||||
| Object *obpose = BKE_object_pose_armature_get(obact); | Object *obpose = BKE_object_pose_armature_get(obact); | ||||
| if (obpose) { | if (obpose) { | ||||
| CTX_data_id_pointer_set(result, &obpose->id); | CTX_data_id_pointer_set(result, &obpose->id); | ||||
| } | } | ||||
| return CTX_RESULT_OK; | return CTX_RESULT_OK; | ||||
| } | } | ||||
| static eContextResult screen_ctx_active_sequence_strip(const bContext *C, bContextDataResult *result) | |||||
| { | |||||
| wmWindow *win = CTX_wm_window(C); | |||||
| Scene *scene = WM_window_get_active_scene(win); | |||||
| Sequence *seq = SEQ_select_active_get(scene); | |||||
| if (seq) { | |||||
| CTX_data_pointer_set(result, &scene->id, &RNA_Sequence, seq); | |||||
| return CTX_RESULT_OK; | |||||
| } | |||||
| return CTX_RESULT_NO_DATA; | |||||
| } | |||||
| static eContextResult screen_ctx_sequences(const bContext *C, bContextDataResult *result) | static eContextResult screen_ctx_sequences(const bContext *C, bContextDataResult *result) | ||||
| { | { | ||||
| wmWindow *win = CTX_wm_window(C); | wmWindow *win = CTX_wm_window(C); | ||||
| Scene *scene = WM_window_get_active_scene(win); | Scene *scene = WM_window_get_active_scene(win); | ||||
| Editing *ed = SEQ_editing_get(scene, false); | Editing *ed = SEQ_editing_get(scene, false); | ||||
| if (ed) { | if (ed) { | ||||
| LISTBASE_FOREACH (Sequence *, seq, ed->seqbasep) { | LISTBASE_FOREACH (Sequence *, seq, ed->seqbasep) { | ||||
| CTX_data_list_add(result, &scene->id, &RNA_Sequence, seq); | CTX_data_list_add(result, &scene->id, &RNA_Sequence, seq); | ||||
| ▲ Show 20 Lines • Show All 478 Lines • ▼ Show 20 Lines | static void ensure_ed_screen_context_functions(void) | ||||
| register_context_function("object", screen_ctx_object); | register_context_function("object", screen_ctx_object); | ||||
| register_context_function("edit_object", screen_ctx_edit_object); | register_context_function("edit_object", screen_ctx_edit_object); | ||||
| register_context_function("sculpt_object", screen_ctx_sculpt_object); | register_context_function("sculpt_object", screen_ctx_sculpt_object); | ||||
| register_context_function("vertex_paint_object", screen_ctx_vertex_paint_object); | register_context_function("vertex_paint_object", screen_ctx_vertex_paint_object); | ||||
| register_context_function("weight_paint_object", screen_ctx_weight_paint_object); | register_context_function("weight_paint_object", screen_ctx_weight_paint_object); | ||||
| register_context_function("image_paint_object", screen_ctx_image_paint_object); | register_context_function("image_paint_object", screen_ctx_image_paint_object); | ||||
| register_context_function("particle_edit_object", screen_ctx_particle_edit_object); | register_context_function("particle_edit_object", screen_ctx_particle_edit_object); | ||||
| register_context_function("pose_object", screen_ctx_pose_object); | register_context_function("pose_object", screen_ctx_pose_object); | ||||
| register_context_function("active_sequence_strip", screen_ctx_active_sequence_strip); | |||||
| register_context_function("sequences", screen_ctx_sequences); | register_context_function("sequences", screen_ctx_sequences); | ||||
| register_context_function("selected_sequences", screen_ctx_selected_sequences); | register_context_function("selected_sequences", screen_ctx_selected_sequences); | ||||
| register_context_function("selected_editable_sequences", screen_ctx_selected_editable_sequences); | register_context_function("selected_editable_sequences", screen_ctx_selected_editable_sequences); | ||||
| register_context_function("selected_nla_strips", screen_ctx_selected_nla_strips); | register_context_function("selected_nla_strips", screen_ctx_selected_nla_strips); | ||||
| register_context_function("gpencil_data", screen_ctx_gpencil_data); | register_context_function("gpencil_data", screen_ctx_gpencil_data); | ||||
| register_context_function("gpencil_data_owner", screen_ctx_gpencil_data_owner); | register_context_function("gpencil_data_owner", screen_ctx_gpencil_data_owner); | ||||
| register_context_function("annotation_data", screen_ctx_annotation_data); | register_context_function("annotation_data", screen_ctx_annotation_data); | ||||
| register_context_function("annotation_data_owner", screen_ctx_annotation_data_owner); | register_context_function("annotation_data_owner", screen_ctx_annotation_data_owner); | ||||
| Show All 33 Lines | |||||