diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_wm.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_wm.c | 61 |
1 files changed, 60 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 7d821ee407b..36f07db727b 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -36,6 +36,8 @@ #include "BLT_translation.h" +#include "BKE_workspace.h" + #include "RNA_access.h" #include "RNA_define.h" #include "RNA_enum_types.h" @@ -467,6 +469,7 @@ const EnumPropertyItem rna_enum_wm_report_items[] = { #include "WM_api.h" +#include "DNA_object_types.h" #include "DNA_workspace_types.h" #include "ED_screen.h" @@ -475,7 +478,6 @@ const EnumPropertyItem rna_enum_wm_report_items[] = { #include "BKE_global.h" #include "BKE_idprop.h" -#include "BKE_workspace.h" #include "MEM_guardedalloc.h" @@ -755,6 +757,49 @@ static void rna_workspace_screen_update(bContext *C, PointerRNA *ptr) } } +static PointerRNA rna_Window_view_layer_get(PointerRNA *ptr) +{ + wmWindow *win = ptr->data; + Scene *scene = WM_window_get_active_scene(win); + WorkSpace *workspace = WM_window_get_active_workspace(win); + ViewLayer *view_layer = BKE_workspace_view_layer_get(workspace, scene); + PointerRNA scene_ptr; + + RNA_id_pointer_create(&scene->id, &scene_ptr); + return rna_pointer_inherit_refine(&scene_ptr, &RNA_ViewLayer, view_layer); +} + +static void rna_Window_view_layer_set(PointerRNA *ptr, PointerRNA value) +{ + wmWindow *win = ptr->data; + Scene *scene = WM_window_get_active_scene(win); + WorkSpace *workspace = WM_window_get_active_workspace(win); + + BKE_workspace_view_layer_set(workspace, value.data, scene); +} + +#ifdef USE_WORKSPACE_MODE + +static int rna_Window_object_mode_get(PointerRNA *ptr) +{ + wmWindow *win = ptr->data; + Scene *scene = WM_window_get_active_scene(win); + WorkSpace *workspace = WM_window_get_active_workspace(win); + + return (int)BKE_workspace_object_mode_get(workspace, scene); +} + +static void rna_Window_object_mode_set(PointerRNA *ptr, int value) +{ + wmWindow *win = ptr->data; + Scene *scene = WM_window_get_active_scene(win); + WorkSpace *workspace = WM_window_get_active_workspace(win); + + BKE_workspace_object_mode_set(workspace, scene, value); +} + +#endif /* USE_WORKSPACE_MODE */ + static PointerRNA rna_KeyMapItem_properties_get(PointerRNA *ptr) { wmKeyMapItem *kmi = ptr->data; @@ -2024,6 +2069,20 @@ static void rna_def_window(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_NEVER_NULL | PROP_EDITABLE | PROP_CONTEXT_UPDATE); RNA_def_property_update(prop, 0, "rna_workspace_screen_update"); + prop = RNA_def_property(srna, "view_layer", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "ViewLayer"); + RNA_def_property_pointer_funcs(prop, "rna_Window_view_layer_get", "rna_Window_view_layer_set", NULL, NULL); + RNA_def_property_ui_text(prop, "Active View Layer", "The active workspace view layer showing in the window"); + RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL); + RNA_def_property_update(prop, NC_SCREEN | ND_LAYER, NULL); + +#ifdef USE_WORKSPACE_MODE + prop = RNA_def_property(srna, "object_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, rna_enum_object_mode_items); + RNA_def_property_enum_funcs(prop, "rna_Window_object_mode_get", "rna_Window_object_mode_set", NULL); + RNA_def_property_ui_text(prop, "Mode", "Object interaction mode used in this window"); +#endif + prop = RNA_def_property(srna, "x", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "posx"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); |