[Bf-blender-cvs] [783e3330386] temp-workspace-multi-window: Show the correct list of screens in the info editor
Julian Eisel
noreply at git.blender.org
Wed Mar 8 15:42:40 CET 2017
Commit: 783e333038684a510316fba03cf4cd9e63597192
Author: Julian Eisel
Date: Wed Mar 8 15:41:11 2017 +0100
Branches: temp-workspace-multi-window
https://developer.blender.org/rB783e333038684a510316fba03cf4cd9e63597192
Show the correct list of screens in the info editor
===================================================================
M release/scripts/startup/bl_ui/space_info.py
M source/blender/makesrna/intern/rna_wm.c
M source/blender/makesrna/intern/rna_workspace.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_info.py b/release/scripts/startup/bl_ui/space_info.py
index 1741e1dc3ae..1d330b1e019 100644
--- a/release/scripts/startup/bl_ui/space_info.py
+++ b/release/scripts/startup/bl_ui/space_info.py
@@ -45,7 +45,7 @@ class INFO_HT_header(Header):
layout.separator()
else:
layout.template_ID(window, "workspace", new="workspace.workspace_new", unlink="workspace.workspace_delete")
- layout.template_ID_preview(window, "screen", workspace, "screens", new="screen.new", unlink="screen.delete", rows=2, cols=6)
+ layout.template_ID_preview(window, "screen", window, "screens", new="screen.new", unlink="screen.delete", rows=2, cols=6)
if hasattr(workspace, 'object_mode'):
act_mode_item = bpy.types.Object.bl_rna.properties['mode'].enum_items[workspace.object_mode]
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index 4968b2f8f22..1539ada2b4d 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -748,6 +748,27 @@ static void rna_Window_screen_update(bContext *C, PointerRNA *ptr)
}
}
+void rna_Window_screens_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+{
+ wmWindow *win = ptr->data;
+ rna_iterator_listbase_begin(iter, BKE_workspace_hook_layouts_get(win->workspace_hook), NULL);
+}
+
+static void rna_Window_screens_next(CollectionPropertyIterator *iter)
+{
+ ListBaseIterator *internal = &iter->internal.listbase;
+ internal->link = (Link *)BKE_workspace_layout_next_get((WorkSpaceLayout *)internal->link);
+ iter->valid = internal->link != NULL;
+}
+
+static PointerRNA rna_Window_screens_item_get(CollectionPropertyIterator *iter)
+{
+ WorkSpaceLayout *layout = rna_iterator_listbase_get(iter);
+ bScreen *screen = BKE_workspace_layout_screen_get(layout);
+
+ return rna_pointer_inherit_refine(&iter->parent, &RNA_Screen, screen);
+}
+
static PointerRNA rna_KeyMapItem_properties_get(PointerRNA *ptr)
{
wmKeyMapItem *kmi = ptr->data;
@@ -2023,6 +2044,12 @@ 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_Window_screen_update");
+ prop = RNA_def_property(srna, "screens", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Screen");
+ RNA_def_property_collection_funcs(prop, "rna_Window_screens_begin", "rna_Window_screens_next", NULL,
+ "rna_Window_screens_item_get", NULL, NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Screens", "Screen layouts of a workspace");
+
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);
diff --git a/source/blender/makesrna/intern/rna_workspace.c b/source/blender/makesrna/intern/rna_workspace.c
index 7eabff04acf..a451e412adf 100644
--- a/source/blender/makesrna/intern/rna_workspace.c
+++ b/source/blender/makesrna/intern/rna_workspace.c
@@ -40,20 +40,6 @@
#include "DNA_screen_types.h"
-void rna_workspace_screens_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- WorkSpace *workspace = ptr->id.data;
- rna_iterator_listbase_begin(iter, BKE_workspace_layouts_get(workspace), NULL);
-}
-
-static PointerRNA rna_workspace_screens_item_get(CollectionPropertyIterator *iter)
-{
- WorkSpaceLayout *layout = rna_iterator_listbase_get(iter);
- bScreen *screen = BKE_workspace_layout_screen_get(layout);
-
- return rna_pointer_inherit_refine(&iter->parent, &RNA_Screen, screen);
-}
-
#ifdef USE_WORKSPACE_MODE
static int rna_workspace_object_mode_get(PointerRNA *ptr)
@@ -144,13 +130,6 @@ static void rna_def_workspace(BlenderRNA *brna)
RNA_def_struct_ui_text(srna, "Workspace", "Workspace data-block, defining the working environment for the user");
RNA_def_struct_ui_icon(srna, ICON_NONE);
- prop = RNA_def_property(srna, "screens", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "layouts", NULL);
- RNA_def_property_struct_type(prop, "Screen");
- RNA_def_property_collection_funcs(prop, "rna_workspace_screens_begin", NULL, NULL,
- "rna_workspace_screens_item_get", NULL, NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Screens", "Screen layouts of a workspace");
-
prop = RNA_def_property(srna, "layout_type", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "act_layout_type");
RNA_def_property_struct_type(prop, "WorkSpaceLayoutType");
More information about the Bf-blender-cvs
mailing list