[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30907] trunk/blender: Logic Editor:

Thomas Dinges dingto at gmx.de
Fri Jul 30 17:44:27 CEST 2010


Revision: 30907
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30907
Author:   dingto
Date:     2010-07-30 17:44:26 +0200 (Fri, 30 Jul 2010)

Log Message:
-----------
Logic Editor:
*Removed the old header menu code, replacing with Python menus.

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/space_logic.py
    trunk/blender/source/blender/editors/space_logic/logic_intern.h
    trunk/blender/source/blender/editors/space_logic/space_logic.c

Removed Paths:
-------------
    trunk/blender/source/blender/editors/space_logic/logic_header.c

Modified: trunk/blender/release/scripts/ui/space_logic.py
===================================================================
--- trunk/blender/release/scripts/ui/space_logic.py	2010-07-30 15:20:07 UTC (rev 30906)
+++ trunk/blender/release/scripts/ui/space_logic.py	2010-07-30 15:44:26 UTC (rev 30907)
@@ -57,9 +57,43 @@
         layout.operator_menu_enum("logic.sensor_add", "type", text="Sensor")
         layout.operator_menu_enum("logic.controller_add", "type", text="Controller")
         layout.operator_menu_enum("logic.actuator_add", "type", text="Actuator")
+        
 
+class LOGIC_HT_header(bpy.types.Header):
+    bl_space_type = 'LOGIC_EDITOR'
+
+    def draw(self, context):
+        layout = self.layout
+
+        st = context.space_data
+
+        row = layout.row(align=True)
+        row.template_header()
+
+        if context.area.show_menus:
+            sub = row.row(align=True)
+            sub.menu("LOGIC_MT_view")
+            #sub.menu("LOGIC_MT_select")
+            #sub.menu("LOGIC_MT_add")
+        
+
+class LOGIC_MT_view(bpy.types.Menu):
+    bl_label = "View"
+
+    def draw(self, context):
+        layout = self.layout
+
+        layout.column()
+        
+        layout.operator("logic.properties", icon='MENU_PANEL')
+
+
 classes = [
-    LOGIC_PT_properties, LOGIC_MT_logicbricks_add]
+    LOGIC_HT_header,
+    LOGIC_MT_view,
+    
+    LOGIC_PT_properties,
+    LOGIC_MT_logicbricks_add]
 
 
 def register():

Deleted: trunk/blender/source/blender/editors/space_logic/logic_header.c
===================================================================
--- trunk/blender/source/blender/editors/space_logic/logic_header.c	2010-07-30 15:20:07 UTC (rev 30906)
+++ trunk/blender/source/blender/editors/space_logic/logic_header.c	2010-07-30 15:44:26 UTC (rev 30907)
@@ -1,120 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. 
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2009 Blender Foundation.
- * All rights reserved.
- *
- * 
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#include <string.h>
-#include <stdio.h>
-
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
-
-#include "BKE_context.h"
-#include "BKE_screen.h"
-#include "BKE_main.h"
-
-#include "ED_screen.h"
-#include "ED_types.h"
-#include "ED_util.h"
-
-
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-
-#include "UI_interface.h"
-#include "UI_resources.h"
-#include "UI_view2d.h"
-
-#include "logic_intern.h"
-
-/* ************************ header area region *********************** */
-
-
-static void do_logic_buttons(bContext *C, void *arg, int event)
-{
-//	SpaceLogic *slogic= CTX_wm_space_logic(C);
-}
-
-static uiBlock *logic_addmenu(bContext *C, ARegion *ar, void *arg_unused)
-{
-//	SpaceLogic *slogic= CTX_wm_space_logic(C);
-	uiBlock *block;
-	short yco= 0, menuwidth=120;
-	
-	block= uiBeginBlock(C, ar, "logic_addmenu", UI_EMBOSSP);
-//	uiBlockSetButmFunc(block, do_logic_addmenu, NULL);
-	
-	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-	
-	uiTextBoundsBlock(block, 50);
-	uiBlockSetDirection(block, UI_TOP);
-	uiEndBlock(C, block);
-	
-	return block;
-}	
-
-void logic_header_buttons(const bContext *C, ARegion *ar)
-{
-	ScrArea *sa= CTX_wm_area(C);
-//	SpaceLogic *slogic= CTX_wm_space_logic(C);
-	uiBlock *block;
-	short xco, yco= 3;
-	
-	block= uiBeginBlock(C, ar, "header logic", UI_EMBOSS);
-	uiBlockSetHandleFunc(block, do_logic_buttons, NULL);
-	
-	xco= ED_area_header_standardbuttons(C, block, yco);
-	
-	if((sa->flag & HEADER_NO_PULLDOWN)==0) {
-		int xmax;
-	
-		xmax= GetButStringLength("View");
-		uiDefPulldownBut(block, logic_addmenu, NULL, 
-					  "View", xco, yco, xmax-3, 20, "");
-		xco+= xmax;
-		
-		xmax= GetButStringLength("Select");
-		uiDefPulldownBut(block, logic_addmenu, NULL, 
-						 "Select", xco, yco, xmax-3, 20, "");
-		xco+= xmax;
-		
-		xmax= GetButStringLength("Add");
-		uiDefPulldownBut(block, logic_addmenu, NULL, 
-						 "Add", xco, yco, xmax-3, 20, "");
-		xco+= xmax;
-	}
-	
-	uiBlockSetEmboss(block, UI_EMBOSS);
-	
-	UI_view2d_totRect_set(&ar->v2d, xco+XIC+100, (int)(ar->v2d.tot.ymax-ar->v2d.tot.ymin));
-	
-	uiEndBlock(C, block);
-	uiDrawBlock(C, block);
-}
-
-

Modified: trunk/blender/source/blender/editors/space_logic/logic_intern.h
===================================================================
--- trunk/blender/source/blender/editors/space_logic/logic_intern.h	2010-07-30 15:20:07 UTC (rev 30906)
+++ trunk/blender/source/blender/editors/space_logic/logic_intern.h	2010-07-30 15:44:26 UTC (rev 30907)
@@ -42,9 +42,6 @@
 /* space_logic.c */
 struct ARegion *logic_has_buttons_region(struct ScrArea *sa);
 
-/* logic_header.c */
-void logic_header_buttons(const struct bContext *C, struct ARegion *ar);
-
 /* logic_ops.c */
 
 /* logic_buttons.c */

Modified: trunk/blender/source/blender/editors/space_logic/space_logic.c
===================================================================
--- trunk/blender/source/blender/editors/space_logic/space_logic.c	2010-07-30 15:20:07 UTC (rev 30906)
+++ trunk/blender/source/blender/editors/space_logic/space_logic.c	2010-07-30 15:44:26 UTC (rev 30907)
@@ -296,17 +296,7 @@
 
 static void logic_header_area_draw(const bContext *C, ARegion *ar)
 {
-	/* clear */
-	UI_ThemeClearColor(ED_screen_area_active(C)?TH_HEADER:TH_HEADERDESEL);
-	glClear(GL_COLOR_BUFFER_BIT);
-	
-	/* set view2d view matrix for scrolling (without scrollers) */
-	UI_view2d_view_ortho(C, &ar->v2d);
-	
-	logic_header_buttons(C, ar);
-	
-	/* restore view matrix? */
-	UI_view2d_view_restore(C);
+	ED_region_header(C, ar);
 }
 
 /**************************** spacetype *****************************/





More information about the Bf-blender-cvs mailing list