Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_screen.c
| Show First 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | |||||
| #include "BKE_depsgraph.h" | #include "BKE_depsgraph.h" | ||||
| #include "UI_view2d.h" | #include "UI_view2d.h" | ||||
| #ifdef WITH_PYTHON | #ifdef WITH_PYTHON | ||||
| # include "BPY_extern.h" | # include "BPY_extern.h" | ||||
| #endif | #endif | ||||
| static void rna_Screen_scene_set(PointerRNA *ptr, PointerRNA value) | |||||
| { | |||||
| bScreen *sc = (bScreen *)ptr->data; | |||||
| if (value.data == NULL) | |||||
| return; | |||||
| sc->newscene = value.data; | |||||
| } | |||||
| static void rna_Screen_scene_update(bContext *C, PointerRNA *ptr) | |||||
| { | |||||
| bScreen *sc = (bScreen *)ptr->data; | |||||
| /* exception: must use context so notifier gets to the right window */ | |||||
| if (sc->newscene) { | |||||
| #ifdef WITH_PYTHON | |||||
| BPy_BEGIN_ALLOW_THREADS; | |||||
| #endif | |||||
| ED_screen_set_scene(C, sc, sc->newscene); | |||||
| #ifdef WITH_PYTHON | |||||
| BPy_END_ALLOW_THREADS; | |||||
| #endif | |||||
| WM_event_add_notifier(C, NC_SCENE | ND_SCENEBROWSE, sc->newscene); | |||||
| if (G.debug & G_DEBUG) | |||||
| printf("scene set %p\n", sc->newscene); | |||||
| sc->newscene = NULL; | |||||
| } | |||||
| } | |||||
| static void rna_Screen_redraw_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) | static void rna_Screen_redraw_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) | ||||
| { | { | ||||
| bScreen *screen = (bScreen *)ptr->data; | bScreen *screen = (bScreen *)ptr->data; | ||||
| /* the settings for this are currently only available from a menu in the TimeLine, hence refresh=SPACE_TIME */ | /* the settings for this are currently only available from a menu in the TimeLine, hence refresh=SPACE_TIME */ | ||||
| ED_screen_animation_timer_update(screen, screen->redraws_flag, SPACE_TIME); | ED_screen_animation_timer_update(screen, screen->redraws_flag, SPACE_TIME); | ||||
| } | } | ||||
| static int rna_Screen_is_animation_playing_get(PointerRNA *UNUSED(ptr)) | static int rna_Screen_is_animation_playing_get(PointerRNA *UNUSED(ptr)) | ||||
| { | { | ||||
| /* can be NULL on file load, T42619 */ | /* can be NULL on file load, T42619 */ | ||||
| wmWindowManager *wm = G.main->wm.first; | wmWindowManager *wm = G.main->wm.first; | ||||
| return wm ? (ED_screen_animation_playing(wm) != NULL) : 0; | return wm ? (ED_screen_animation_playing(wm) != NULL) : 0; | ||||
| } | } | ||||
| static int rna_Screen_fullscreen_get(PointerRNA *ptr) | static int rna_Screen_fullscreen_get(PointerRNA *ptr) | ||||
| Show All 28 Lines | |||||
| { | { | ||||
| wmWindowManager *wm = CTX_wm_manager(C); | wmWindowManager *wm = CTX_wm_manager(C); | ||||
| wmWindow *win; | wmWindow *win; | ||||
| bScreen *sc = (bScreen *)ptr->id.data; | bScreen *sc = (bScreen *)ptr->id.data; | ||||
| ScrArea *sa = (ScrArea *)ptr->data; | ScrArea *sa = (ScrArea *)ptr->data; | ||||
| /* XXX this call still use context, so we trick it to work in the right context */ | /* XXX this call still use context, so we trick it to work in the right context */ | ||||
| for (win = wm->windows.first; win; win = win->next) { | for (win = wm->windows.first; win; win = win->next) { | ||||
| if (sc == win->screen) { | if (sc == WM_window_get_active_screen(win)) { | ||||
| wmWindow *prevwin = CTX_wm_window(C); | wmWindow *prevwin = CTX_wm_window(C); | ||||
| ScrArea *prevsa = CTX_wm_area(C); | ScrArea *prevsa = CTX_wm_area(C); | ||||
| ARegion *prevar = CTX_wm_region(C); | ARegion *prevar = CTX_wm_region(C); | ||||
| CTX_wm_window_set(C, win); | CTX_wm_window_set(C, win); | ||||
| CTX_wm_area_set(C, sa); | CTX_wm_area_set(C, sa); | ||||
| CTX_wm_region_set(C, NULL); | CTX_wm_region_set(C, NULL); | ||||
| ▲ Show 20 Lines • Show All 208 Lines • ▼ Show 20 Lines | static void rna_def_screen(BlenderRNA *brna) | ||||
| StructRNA *srna; | StructRNA *srna; | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| srna = RNA_def_struct(brna, "Screen", "ID"); | srna = RNA_def_struct(brna, "Screen", "ID"); | ||||
| RNA_def_struct_sdna(srna, "Screen"); /* it is actually bScreen but for 2.5 the dna is patched! */ | RNA_def_struct_sdna(srna, "Screen"); /* it is actually bScreen but for 2.5 the dna is patched! */ | ||||
| RNA_def_struct_ui_text(srna, "Screen", "Screen data-block, defining the layout of areas in a window"); | RNA_def_struct_ui_text(srna, "Screen", "Screen data-block, defining the layout of areas in a window"); | ||||
| RNA_def_struct_ui_icon(srna, ICON_SPLITSCREEN); | RNA_def_struct_ui_icon(srna, ICON_SPLITSCREEN); | ||||
| /* pointers */ | |||||
| prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE); | |||||
| RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL); | |||||
| RNA_def_property_pointer_funcs(prop, NULL, "rna_Screen_scene_set", NULL, NULL); | |||||
| RNA_def_property_ui_text(prop, "Scene", "Active scene to be edited in the screen"); | |||||
| RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); | |||||
| RNA_def_property_update(prop, 0, "rna_Screen_scene_update"); | |||||
| /* collections */ | /* collections */ | ||||
| prop = RNA_def_property(srna, "areas", PROP_COLLECTION, PROP_NONE); | prop = RNA_def_property(srna, "areas", PROP_COLLECTION, PROP_NONE); | ||||
| RNA_def_property_collection_sdna(prop, NULL, "areabase", NULL); | RNA_def_property_collection_sdna(prop, NULL, "areabase", NULL); | ||||
| RNA_def_property_struct_type(prop, "Area"); | RNA_def_property_struct_type(prop, "Area"); | ||||
| RNA_def_property_ui_text(prop, "Areas", "Areas the screen is subdivided into"); | RNA_def_property_ui_text(prop, "Areas", "Areas the screen is subdivided into"); | ||||
| /* readonly status indicators */ | /* readonly status indicators */ | ||||
| prop = RNA_def_property(srna, "is_animation_playing", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "is_animation_playing", PROP_BOOLEAN, PROP_NONE); | ||||
| ▲ Show 20 Lines • Show All 66 Lines • Show Last 20 Lines | |||||