* Wrapped outliner space in RNA, and added a python ui file for the header.
authorMatt Ebb <matt@mke3.net>
Thu, 28 May 2009 05:09:25 +0000 (05:09 +0000)
committerMatt Ebb <matt@mke3.net>
Thu, 28 May 2009 05:09:25 +0000 (05:09 +0000)
Brecht, would you be able to have a look at this if you have time - I can't
figure out how to trigger the python file to register the header instead of
what's in outliner_header.c.

release/ui/space_outliner.py [new file with mode: 0644]
source/blender/makesrna/RNA_access.h
source/blender/makesrna/intern/rna_space.c

diff --git a/release/ui/space_outliner.py b/release/ui/space_outliner.py
new file mode 100644 (file)
index 0000000..12690ff
--- /dev/null
@@ -0,0 +1,37 @@
+
+import bpy
+
+class OUTLINER_HT_header(bpy.types.Header):
+       __space_type__ = "OUTLINER"
+       __idname__ = "OUTLINER_HT_header"
+
+       def draw(self, context):
+               so = context.space_data
+               layout = self.layout
+
+               layout.template_header(context)
+
+               if context.area.show_menus:
+                       row = layout.row(align=True)
+                       row.itemM(context, "OUTLINER_MT_view")
+                       
+               row = layout.row(align=True)
+               row.itemR(so, "display_mode")
+
+
+class OUTLINER_MT_view(bpy.types.Menu):
+       __space_type__ = "OUTLINER"
+       __label__ = "View"
+
+       def draw(self, context):
+               layout = self.layout
+               so = context.space_data
+
+               layout.column()
+               row.itemR(so, "show_restriction_columns")
+               #layout.itemO("TEXT_OT_new")
+               
+
+bpy.types.register(OUTLINER_HT_header)
+bpy.types.register(OUTLINER_MT_view)
+
index 36026cbf28cf58fd73d9c7c06b3eb1b3dbc07728..d083063975bb269931eb578f45d2caf4c96e6498 100644 (file)
@@ -246,6 +246,7 @@ extern StructRNA RNA_Space;
 extern StructRNA RNA_SpaceImageEditor;
 extern StructRNA RNA_SpaceUVEditor;
 extern StructRNA RNA_SpaceTextEditor;
+extern StructRNA RNA_SpaceOutliner;
 extern StructRNA RNA_SpeedControlSequence;
 extern StructRNA RNA_SpotLamp;
 extern StructRNA RNA_StringProperty;
index 2b5c3a621b4c9936e4c4ea2ca97ff06adc9c95e0..5393352ce93db94109858f365d8a4fdbdd8d13d6 100644 (file)
@@ -69,9 +69,10 @@ static StructRNA* rna_Space_refine(struct PointerRNA *ptr)
                        return &RNA_SpaceView3D;
                case SPACE_IPO:
                        return &RNA_SpaceGraphEditor;
+               */
                case SPACE_OUTLINER:
                        return &RNA_SpaceOutliner;
-               case SPACE_BUTS:
+               /* case SPACE_BUTS:
                        return &RNA_SpaceButtonsWindow;
                case SPACE_FILE:
                        return &RNA_SpaceFileBrowser;*/
@@ -250,6 +251,40 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Live Unwrap", "Continuously unwrap the selected UV island while transforming pinned vertices.");
 }
 
+static void rna_def_space_outliner(BlenderRNA *brna)
+{
+       StructRNA *srna;
+       PropertyRNA *prop;
+
+       static EnumPropertyItem display_mode_items[] = {
+               {0, "ALL_SCENES", "All Scenes", ""},
+               {1, "CURRENT_SCENE", "Current Scene", ""},
+               {2, "VISIBLE_LAYERS", "Visible Layers", ""},
+               {3, "SELECTED", "Selected", ""},
+               {4, "ACTIVE", "Active", ""},
+               {5, "SAME_TYPES", "Same Types", ""},
+               {6, "GROUPS", "Groups", ""},
+               {7, "LIBRARIES", "Libraries", ""},
+               {10, "SEQUENCE", "Sequence", ""},
+               {11, "DATABLOCKS", "Datablocks", ""},
+               {12, "USER_PREFERENCES", "User Preferences", ""},
+               {0, NULL, NULL, NULL}};
+
+       srna= RNA_def_struct(brna, "SpaceOutliner", "Space");
+       RNA_def_struct_sdna(srna, "SpaceOops");
+       RNA_def_struct_ui_text(srna, "Space Outliner", "Outliner space data.");
+       
+       prop= RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "outlinevis");
+       RNA_def_property_enum_items(prop, display_mode_items);
+       RNA_def_property_ui_text(prop, "Display Mode", "Type of information to display");
+
+       prop= RNA_def_property(srna, "show_restriction_columns", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SO_HIDE_RESTRICTCOLS);
+       RNA_def_property_ui_text(prop, "Show Restriction Columns", "Show colum");
+
+}
+
 static void rna_def_space_image(BlenderRNA *brna)
 {
        StructRNA *srna;
@@ -400,6 +435,7 @@ void RNA_def_space(BlenderRNA *brna)
        rna_def_space(brna);
        rna_def_space_image(brna);
        rna_def_space_text(brna);
+       rna_def_space_outliner(brna);
 }
 
 #endif