[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20467] branches/blender2.5/blender: * Wrapped outliner space in RNA, and added a python ui file for the header .

Matt Ebb matt at mke3.net
Thu May 28 07:09:25 CEST 2009


Revision: 20467
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20467
Author:   broken
Date:     2009-05-28 07:09:25 +0200 (Thu, 28 May 2009)

Log Message:
-----------
* Wrapped outliner space in RNA, and added a python ui file for the header.

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.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/makesrna/RNA_access.h
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_space.c

Added Paths:
-----------
    branches/blender2.5/blender/release/ui/space_outliner.py

Added: branches/blender2.5/blender/release/ui/space_outliner.py
===================================================================
--- branches/blender2.5/blender/release/ui/space_outliner.py	                        (rev 0)
+++ branches/blender2.5/blender/release/ui/space_outliner.py	2009-05-28 05:09:25 UTC (rev 20467)
@@ -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)
+

Modified: branches/blender2.5/blender/source/blender/makesrna/RNA_access.h
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/RNA_access.h	2009-05-28 05:04:41 UTC (rev 20466)
+++ branches/blender2.5/blender/source/blender/makesrna/RNA_access.h	2009-05-28 05:09:25 UTC (rev 20467)
@@ -246,6 +246,7 @@
 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;

Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_space.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_space.c	2009-05-28 05:04:41 UTC (rev 20466)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_space.c	2009-05-28 05:09:25 UTC (rev 20467)
@@ -69,9 +69,10 @@
 			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 @@
 	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 @@
 	rna_def_space(brna);
 	rna_def_space_image(brna);
 	rna_def_space_text(brna);
+	rna_def_space_outliner(brna);
 }
 
 #endif





More information about the Bf-blender-cvs mailing list