[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [21051] branches/blender2.5/blender: 2. 5 Buttons Window:

Thomas Dinges dingto at gmx.de
Sun Jun 21 12:26:39 CEST 2009


Revision: 21051
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21051
Author:   dingto
Date:     2009-06-21 12:26:39 +0200 (Sun, 21 Jun 2009)

Log Message:
-----------
2.5 Buttons Window:

* WIP Commit: Started wrapping the buttons header to python. Still disabled due to some display problems. 

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/space_buttons/space_buttons.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_space.c

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

Added: branches/blender2.5/blender/release/ui/space_buttons.py
===================================================================
--- branches/blender2.5/blender/release/ui/space_buttons.py	                        (rev 0)
+++ branches/blender2.5/blender/release/ui/space_buttons.py	2009-06-21 10:26:39 UTC (rev 21051)
@@ -0,0 +1,36 @@
+
+import bpy
+
+class Buttons_HT_header(bpy.types.Header):
+	__space_type__ = "BUTTONS_WINDOW"
+	__idname__ = "BUTTONS_HT_header"
+
+	def draw(self, context):
+		layout = self.layout
+		
+		so = context.space_data
+		scene = context.scene
+
+		layout.template_header(context)
+
+		if context.area.show_menus:
+			row = layout.row(align=True)
+			row.itemM(context, "Buttons_MT_view", text="View")
+			
+		row = layout.row()
+		row.itemR(so, "buttons_context", expand=True, text="")
+		row.itemR(scene, "current_frame")
+
+class Buttons_MT_view(bpy.types.Menu):
+	__space_type__ = "BUTTONS_WINDOW"
+	__label__ = "View"
+
+	def draw(self, context):
+		layout = self.layout
+		so = context.space_data
+
+		col = layout.column()
+		col.itemR(so, "panel_alignment", expand=True)
+
+bpy.types.register(Buttons_HT_header)
+bpy.types.register(Buttons_MT_view)
\ No newline at end of file

Modified: branches/blender2.5/blender/source/blender/editors/space_buttons/space_buttons.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_buttons/space_buttons.c	2009-06-21 10:16:52 UTC (rev 21050)
+++ branches/blender2.5/blender/source/blender/editors/space_buttons/space_buttons.c	2009-06-21 10:26:39 UTC (rev 21051)
@@ -220,14 +220,23 @@
 	
 }
 
+//#define PY_HEADER
 /* add handlers, stuff you only do once or on area/region changes */
 static void buttons_header_area_init(wmWindowManager *wm, ARegion *ar)
 {
+#ifdef PY_HEADER
+	ED_region_header_init(ar);
+#else
 	UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy);
+#endif
 }
 
 static void buttons_header_area_draw(const bContext *C, ARegion *ar)
 {
+#ifdef PY_HEADER
+	ED_region_header(C, ar);
+#else
+
 	float col[3];
 	
 	/* clear */
@@ -243,7 +252,8 @@
 	UI_view2d_view_ortho(C, &ar->v2d);
 	
 	buttons_header_buttons(C, ar);
-	
+#endif	
+
 	/* restore view matrix? */
 	UI_view2d_view_restore(C);
 }

Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_space.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_space.c	2009-06-21 10:16:52 UTC (rev 21050)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_space.c	2009-06-21 10:26:39 UTC (rev 21051)
@@ -575,18 +575,17 @@
 	PropertyRNA *prop;
 
 	static EnumPropertyItem buttons_context_items[] = {
-		{BCONTEXT_SCENE, "SCENE", 0, "Scene", ""},
-		{BCONTEXT_WORLD, "WORLD", 0, "World", ""},
-		{BCONTEXT_OBJECT, "OBJECT", 0, "Object", ""},
-		{BCONTEXT_DATA, "DATA", 0, "Data", ""},
-		{BCONTEXT_MATERIAL, "MATERIAL", 0, "Material", ""},
-		{BCONTEXT_TEXTURE, "TEXTURE", 0, "Texture", ""},
-		{BCONTEXT_PARTICLE, "PARTICLE", 0, "Particle", ""},
-		{BCONTEXT_PHYSICS, "PHYSICS", 0, "Physics", ""},
-		{BCONTEXT_GAME, "GAME", 0, "Game", ""},
-		{BCONTEXT_BONE, "BONE", 0, "Bone", ""},
-		{BCONTEXT_MODIFIER, "MODIFIER", 0, "Modifier", ""},
-		{BCONTEXT_CONSTRAINT, "CONSTRAINT", 0, "Constraint", ""},
+		{BCONTEXT_SCENE, "SCENE", ICON_SCENE, "Scene", "Scene"},
+		{BCONTEXT_WORLD, "WORLD", ICON_WORLD, "World", "World"},
+		{BCONTEXT_OBJECT, "OBJECT", ICON_OBJECT_DATA, "Object", "Object"},
+		{BCONTEXT_CONSTRAINT, "CONSTRAINT", ICON_CONSTRAINT, "Constraint", "Constraint"},
+		{BCONTEXT_MODIFIER, "MODIFIER", ICON_MODIFIER, "Modifier", "Modifier"},
+		{BCONTEXT_DATA, "DATA", 0, "Data", "Data"},
+		{BCONTEXT_BONE, "BONE", ICON_BONE_DATA, "Bone", "Bone"},
+		{BCONTEXT_MATERIAL, "MATERIAL", ICON_MATERIAL, "Material", "Material"},
+		{BCONTEXT_TEXTURE, "TEXTURE", ICON_TEXTURE, "Texture", "Texture"},
+		{BCONTEXT_PARTICLE, "PARTICLE", ICON_PARTICLES, "Particle", "Particle"},
+		{BCONTEXT_PHYSICS, "PHYSICS", ICON_PHYSICS, "Physics", "Physics"},
 		{0, NULL, 0, NULL, NULL}};
 		
 	static EnumPropertyItem panel_alignment_items[] = {
@@ -602,11 +601,13 @@
 	RNA_def_property_enum_sdna(prop, NULL, "mainb");
 	RNA_def_property_enum_items(prop, buttons_context_items);
 	RNA_def_property_ui_text(prop, "Buttons Context", "The type of active data to display and edit in the buttons window");
+	RNA_def_property_update(prop, NC_WINDOW, NULL);
 	
 	prop= RNA_def_property(srna, "panel_alignment", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "align");
 	RNA_def_property_enum_items(prop, panel_alignment_items);
 	RNA_def_property_ui_text(prop, "Panel Alignment", "Arrangement of the panels within the buttons window");
+	RNA_def_property_update(prop, NC_WINDOW, NULL);
 
 	/* pinned data */
 	prop= RNA_def_property(srna, "pin_id", PROP_POINTER, PROP_NONE);





More information about the Bf-blender-cvs mailing list