Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_wm.c
| Show First 20 Lines • Show All 453 Lines • ▼ Show 20 Lines | EnumPropertyItem rna_enum_wm_report_items[] = { | ||||
| {RPT_ERROR_OUT_OF_MEMORY, "ERROR_OUT_OF_MEMORY", 0, "Out of Memory", ""}, | {RPT_ERROR_OUT_OF_MEMORY, "ERROR_OUT_OF_MEMORY", 0, "Out of Memory", ""}, | ||||
| {0, NULL, 0, NULL, NULL} | {0, NULL, 0, NULL, NULL} | ||||
| }; | }; | ||||
| #ifdef RNA_RUNTIME | #ifdef RNA_RUNTIME | ||||
| #include <assert.h> | #include <assert.h> | ||||
| #include "DNA_view3d_types.h" | |||||
| #include "ED_screen.h" | |||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| #include "UI_interface.h" | #include "UI_interface.h" | ||||
| #include "BKE_idprop.h" | #include "BKE_idprop.h" | ||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| ▲ Show 20 Lines • Show All 151 Lines • ▼ Show 20 Lines | static PointerRNA rna_PieMenu_layout_get(PointerRNA *ptr) | ||||
| return rptr; | return rptr; | ||||
| } | } | ||||
| static void rna_Window_screen_set(PointerRNA *ptr, PointerRNA value) | static void rna_Window_screen_set(PointerRNA *ptr, PointerRNA value) | ||||
| { | { | ||||
| wmWindow *win = (wmWindow *)ptr->data; | wmWindow *win = (wmWindow *)ptr->data; | ||||
| /* disallow ID-browsing away from temp screens */ | /* disallow ID-browsing away from temp screens */ | ||||
| if (win->screen->temp) { | if (win->screen->type == SCREEN_TYPE_TEMP) { | ||||
| return; | return; | ||||
| } | } | ||||
| if (value.data == NULL) | if (value.data == NULL) | ||||
| return; | return; | ||||
| /* exception: can't set screens inside of area/region handlers */ | /* exception: can't set screens inside of area/region handlers */ | ||||
| win->newscreen = value.data; | win->newscreen = value.data; | ||||
| } | } | ||||
| static int rna_Window_screen_assign_poll(PointerRNA *UNUSED(ptr), PointerRNA value) | static int rna_Window_screen_assign_poll(PointerRNA *UNUSED(ptr), PointerRNA value) | ||||
| { | { | ||||
| bScreen *screen = (bScreen *)value.id.data; | bScreen *screen = (bScreen *)value.id.data; | ||||
| return !screen->temp; | return screen->type == SCREEN_TYPE_NORMAL; | ||||
| } | } | ||||
| static void rna_Window_screen_update(bContext *C, PointerRNA *ptr) | static void rna_Window_screen_update(bContext *C, PointerRNA *ptr) | ||||
| { | { | ||||
| wmWindow *win = (wmWindow *)ptr->data; | wmWindow *win = (wmWindow *)ptr->data; | ||||
| /* exception: can't set screens inside of area/region handlers, | /* exception: can't set screens inside of area/region handlers, | ||||
| ▲ Show 20 Lines • Show All 280 Lines • ▼ Show 20 Lines | static int rna_wmClipboard_length(PointerRNA *UNUSED(ptr)) | ||||
| return pbuf_len; | return pbuf_len; | ||||
| } | } | ||||
| static void rna_wmClipboard_set(PointerRNA *UNUSED(ptr), const char *value) | static void rna_wmClipboard_set(PointerRNA *UNUSED(ptr), const char *value) | ||||
| { | { | ||||
| WM_clipboard_text_set((void *) value, false); | WM_clipboard_text_set((void *) value, false); | ||||
| } | } | ||||
| #ifdef WITH_INPUT_HMD | |||||
| static int rna_has_hmd_window_get(PointerRNA *ptr) | |||||
| { | |||||
| wmWindowManager *wm = ptr->data; | |||||
| return (wm->hmd_view.hmd_win != NULL); | |||||
| } | |||||
| static int rna_is_hmd_session_running_get(PointerRNA *ptr) | |||||
| { | |||||
| wmWindowManager *wm = ptr->data; | |||||
| return (wm->hmd_view.hmd_win && wm->hmd_view.hmd_win->screen->is_hmd_running == true); | |||||
| } | |||||
| static void rna_hmd_view_shade_set(PointerRNA *ptr, int value) | |||||
| { | |||||
| wmWindowManager *wm = ptr->data; | |||||
| wmWindow *win = wm->hmd_view.hmd_win; | |||||
| wm->hmd_view.view_shade = value; | |||||
| if (win) { | |||||
| for (ScrArea *sa = win->screen->areabase.first; sa; sa = sa->next) { | |||||
| if (sa->spacetype == SPACE_VIEW3D) { | |||||
| View3D *v3d = sa->spacedata.first; | |||||
| v3d->drawtype = value; | |||||
| ED_area_tag_redraw(sa); | |||||
| /* we assume one 3D view only */ | |||||
| break; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| static void rna_hmd_view_show_only_render_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) | |||||
| { | |||||
| wmWindowManager *wm = ptr->data; | |||||
| wmWindow *win = wm->hmd_view.hmd_win; | |||||
| if (win) { | |||||
| for (ScrArea *sa = win->screen->areabase.first; sa; sa = sa->next) { | |||||
| if (sa->spacetype == SPACE_VIEW3D) { | |||||
| View3D *v3d = sa->spacedata.first; | |||||
| if (wm->hmd_view.flag & HMD_VIEW_RENDER_OVERRIDE) { | |||||
| v3d->flag2 |= V3D_RENDER_OVERRIDE; | |||||
| } | |||||
| else { | |||||
| v3d->flag2 &= ~V3D_RENDER_OVERRIDE; | |||||
| } | |||||
| ED_area_tag_redraw(sa); | |||||
| /* we assume one 3D view only */ | |||||
| break; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| #endif /* WITH_INPUT_HMD */ | |||||
| #ifdef WITH_PYTHON | #ifdef WITH_PYTHON | ||||
| static void rna_Operator_unregister(struct Main *bmain, StructRNA *type) | static void rna_Operator_unregister(struct Main *bmain, StructRNA *type) | ||||
| { | { | ||||
| const char *idname; | const char *idname; | ||||
| wmOperatorType *ot = RNA_struct_blender_type_get(type); | wmOperatorType *ot = RNA_struct_blender_type_get(type); | ||||
| wmWindowManager *wm; | wmWindowManager *wm; | ||||
| if (!ot) | if (!ot) | ||||
| ▲ Show 20 Lines • Show All 1,061 Lines • ▼ Show 20 Lines | static void rna_def_windowmanager(BlenderRNA *brna) | ||||
| RNA_def_property_struct_type(prop, "KeyConfig"); | RNA_def_property_struct_type(prop, "KeyConfig"); | ||||
| RNA_def_property_ui_text(prop, "Key Configurations", "Registered key configurations"); | RNA_def_property_ui_text(prop, "Key Configurations", "Registered key configurations"); | ||||
| rna_def_wm_keyconfigs(brna, prop); | rna_def_wm_keyconfigs(brna, prop); | ||||
| prop = RNA_def_property(srna, "clipboard", PROP_STRING, PROP_NONE); | prop = RNA_def_property(srna, "clipboard", PROP_STRING, PROP_NONE); | ||||
| RNA_def_property_string_funcs(prop, "rna_wmClipboard_get", "rna_wmClipboard_length", "rna_wmClipboard_set"); | RNA_def_property_string_funcs(prop, "rna_wmClipboard_get", "rna_wmClipboard_length", "rna_wmClipboard_set"); | ||||
| RNA_def_property_ui_text(prop, "Text Clipboard", ""); | RNA_def_property_ui_text(prop, "Text Clipboard", ""); | ||||
| #ifdef WITH_INPUT_HMD | |||||
| prop = RNA_def_property(srna, "has_hmd_window", PROP_BOOLEAN, PROP_NONE); | |||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |||||
| RNA_def_property_boolean_funcs(prop, "rna_has_hmd_window_get", NULL); | |||||
| prop = RNA_def_property(srna, "is_hmd_session_running", PROP_BOOLEAN, PROP_NONE); | |||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |||||
| RNA_def_property_boolean_funcs(prop, "rna_is_hmd_session_running_get", NULL); | |||||
| prop = RNA_def_property(srna, "hmd_view_shade", PROP_ENUM, PROP_NONE); | |||||
| RNA_def_property_enum_sdna(prop, NULL, "hmd_view.view_shade"); | |||||
| RNA_def_property_enum_items(prop, rna_enum_viewport_shade_items); | |||||
| RNA_def_property_enum_funcs(prop, NULL, "rna_hmd_view_shade_set", NULL); | |||||
| RNA_def_property_ui_text(prop, "HMD View Shading", "Method to draw in the HMD view"); | |||||
| prop = RNA_def_property(srna, "hmd_view_show_only_render", PROP_BOOLEAN, PROP_NONE); | |||||
| RNA_def_property_boolean_sdna(prop, NULL, "hmd_view.flag", HMD_VIEW_RENDER_OVERRIDE); | |||||
| RNA_def_property_ui_text(prop, "Only Render", "Display only objects which will be rendered"); | |||||
| RNA_def_property_update(prop, 0, "rna_hmd_view_show_only_render_update"); | |||||
| #endif | |||||
| RNA_api_wm(srna); | RNA_api_wm(srna); | ||||
| } | } | ||||
| /* keyconfig.items */ | /* keyconfig.items */ | ||||
| static void rna_def_keymap_items(BlenderRNA *brna, PropertyRNA *cprop) | static void rna_def_keymap_items(BlenderRNA *brna, PropertyRNA *cprop) | ||||
| { | { | ||||
| StructRNA *srna; | StructRNA *srna; | ||||
| ▲ Show 20 Lines • Show All 258 Lines • Show Last 20 Lines | |||||