[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18011] branches/blender2.5/blender/source /blender/editors: 2.5:

Joshua Leung aligorith at gmail.com
Mon Dec 22 12:12:48 CET 2008


Revision: 18011
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18011
Author:   aligorith
Date:     2008-12-22 12:12:48 +0100 (Mon, 22 Dec 2008)

Log Message:
-----------
2.5:

Brought back basics for Action Editor header. The contents of the menus have yet to come, but at least now the Action Editor 'looks' functional.

Fixed mistake in previous commit for TimeLine header (button collision).

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/space_action/action_header.c
    branches/blender2.5/blender/source/blender/editors/space_time/time_header.c

Modified: branches/blender2.5/blender/source/blender/editors/space_action/action_header.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_action/action_header.c	2008-12-22 10:52:17 UTC (rev 18010)
+++ branches/blender2.5/blender/source/blender/editors/space_action/action_header.c	2008-12-22 11:12:48 UTC (rev 18011)
@@ -29,6 +29,7 @@
 #include <string.h>
 #include <stdio.h>
 
+#include "DNA_action_types.h"
 #include "DNA_space_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_screen_types.h"
@@ -41,6 +42,7 @@
 #include "BKE_context.h"
 #include "BKE_screen.h"
 
+#include "ED_anim_api.h"
 #include "ED_screen.h"
 #include "ED_types.h"
 #include "ED_util.h"
@@ -57,15 +59,224 @@
 
 #include "action_intern.h"
 
+/* ********************************************************* */
+/* Menu Defines... */
 
-/* ************************ header area region *********************** */
+// XXX button events
+enum {
+	B_REDR 	= 0,
+	B_ACTCOPYKEYS,
+	B_ACTPASTEKEYS,
+} eActHeader_ButEvents;
 
+// ---------------- menus 
+
+/* Key menu ---------------------------  */
+
+static void do_keymenu(bContext *C, void *arg, int event)
+{
+	
+}
+
+static uiBlock *action_keymenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+{
+	ScrArea *curarea= CTX_wm_area(C);
+	uiBlock *block;
+	short yco= 0, menuwidth=120;
+	
+	block= uiBeginBlock(C, handle->region, "dummy_keymenu", UI_EMBOSSP, UI_HELV);
+	uiBlockSetButmFunc(block, do_keymenu, NULL);
+	
+	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20, 
+					 menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
+	
+	if(curarea->headertype==HEADERTOP) {
+		uiBlockSetDirection(block, UI_DOWN);
+	}
+	else {
+		uiBlockSetDirection(block, UI_TOP);
+		uiBlockFlipOrder(block);
+	}
+	
+	uiTextBoundsBlock(block, 50);
+	uiEndBlock(C, block);
+	
+	return block;
+}
+
+/* Frame menu ---------------------------  */
+
+static void do_framemenu(bContext *C, void *arg, int event)
+{
+	
+}
+
+static uiBlock *action_framemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+{
+	ScrArea *curarea= CTX_wm_area(C);
+	uiBlock *block;
+	short yco= 0, menuwidth=120;
+	
+	block= uiBeginBlock(C, handle->region, "dummy_framemenu", UI_EMBOSSP, UI_HELV);
+	uiBlockSetButmFunc(block, do_framemenu, NULL);
+	
+	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20, 
+					 menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
+	
+	if(curarea->headertype==HEADERTOP) {
+		uiBlockSetDirection(block, UI_DOWN);
+	}
+	else {
+		uiBlockSetDirection(block, UI_TOP);
+		uiBlockFlipOrder(block);
+	}
+	
+	uiTextBoundsBlock(block, 50);
+	uiEndBlock(C, block);
+	
+	return block;
+}
+
+/* Marker menu ---------------------------  */
+
+static void do_markermenu(bContext *C, void *arg, int event)
+{
+	
+}
+
+static uiBlock *action_markermenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+{
+	ScrArea *curarea= CTX_wm_area(C);
+	uiBlock *block;
+	short yco= 0, menuwidth=120;
+	
+	block= uiBeginBlock(C, handle->region, "dummy_markermenu", UI_EMBOSSP, UI_HELV);
+	uiBlockSetButmFunc(block, do_markermenu, NULL);
+	
+	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20, 
+					 menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
+	
+	if(curarea->headertype==HEADERTOP) {
+		uiBlockSetDirection(block, UI_DOWN);
+	}
+	else {
+		uiBlockSetDirection(block, UI_TOP);
+		uiBlockFlipOrder(block);
+	}
+	
+	uiTextBoundsBlock(block, 50);
+	uiEndBlock(C, block);
+	
+	return block;
+}
+
+/* Grease Pencil ---------------------------  */
+
+static void do_gplayermenu(bContext *C, void *arg, int event)
+{
+	
+}
+
+static uiBlock *action_gplayermenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+{
+	ScrArea *curarea= CTX_wm_area(C);
+	uiBlock *block;
+	short yco= 0, menuwidth=120;
+	
+	block= uiBeginBlock(C, handle->region, "dummy_gplayermenu", UI_EMBOSSP, UI_HELV);
+	uiBlockSetButmFunc(block, do_gplayermenu, NULL);
+	
+	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20, 
+					 menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
+	
+	if(curarea->headertype==HEADERTOP) {
+		uiBlockSetDirection(block, UI_DOWN);
+	}
+	else {
+		uiBlockSetDirection(block, UI_TOP);
+		uiBlockFlipOrder(block);
+	}
+	
+	uiTextBoundsBlock(block, 50);
+	uiEndBlock(C, block);
+	
+	return block;
+}
+
+/* Channel menu ---------------------------  */
+
+static void do_channelmenu(bContext *C, void *arg, int event)
+{
+	
+}
+
+static uiBlock *action_channelmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+{
+	ScrArea *curarea= CTX_wm_area(C);
+	uiBlock *block;
+	short yco= 0, menuwidth=120;
+	
+	block= uiBeginBlock(C, handle->region, "dummy_channelmenu", UI_EMBOSSP, UI_HELV);
+	uiBlockSetButmFunc(block, do_channelmenu, NULL);
+	
+	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20, 
+					 menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
+	
+	if(curarea->headertype==HEADERTOP) {
+		uiBlockSetDirection(block, UI_DOWN);
+	}
+	else {
+		uiBlockSetDirection(block, UI_TOP);
+		uiBlockFlipOrder(block);
+	}
+	
+	uiTextBoundsBlock(block, 50);
+	uiEndBlock(C, block);
+	
+	return block;
+}
+
+/* Select menu ---------------------------  */
+
+static void do_selectmenu(bContext *C, void *arg, int event)
+{
+	
+}
+
+static uiBlock *action_selectmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+{
+	ScrArea *curarea= CTX_wm_area(C);
+	uiBlock *block;
+	short yco= 0, menuwidth=120;
+	
+	block= uiBeginBlock(C, handle->region, "dummy_selectmenu", UI_EMBOSSP, UI_HELV);
+	uiBlockSetButmFunc(block, do_selectmenu, NULL);
+	
+	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20, 
+					 menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
+	
+	if(curarea->headertype==HEADERTOP) {
+		uiBlockSetDirection(block, UI_DOWN);
+	}
+	else {
+		uiBlockSetDirection(block, UI_TOP);
+		uiBlockFlipOrder(block);
+	}
+	
+	uiTextBoundsBlock(block, 50);
+	uiEndBlock(C, block);
+	
+	return block;
+}
+
+/* View menu ---------------------------  */
+
 static void do_viewmenu(bContext *C, void *arg, int event)
 {
 	
 }
 
-static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *action_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
 {
 	ScrArea *curarea= CTX_wm_area(C);
 	uiBlock *block;
@@ -91,37 +302,174 @@
 	return block;
 }
 
+/* ************************ header area region *********************** */
+
 static void do_action_buttons(bContext *C, void *arg, int event)
 {
 	switch(event) {
+		case B_REDR:
+			WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
+			break;
 	}
 }
 
-
 void action_header_buttons(const bContext *C, ARegion *ar)
 {
 	ScrArea *sa= CTX_wm_area(C);
+	SpaceAction *saction= (SpaceAction *)CTX_wm_space_data(C);
+	bAnimContext ac;
 	uiBlock *block;
-	int xco, yco= 3;
+	int xco, yco= 3, xmax;
 	
 	block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS, UI_HELV);
 	uiBlockSetHandleFunc(block, do_action_buttons, NULL);
 	
 	xco= ED_area_header_standardbuttons(C, block, yco);
 	
-	if((sa->flag & HEADER_NO_PULLDOWN)==0) {
-		int xmax;
+	uiBlockSetEmboss(block, UI_EMBOSS);
+	
+	/* get context... (also syncs data) */
+	if ((ANIM_animdata_get_context(C, &ac)) && (ac.data)) { 
+		if ((sa->flag & HEADER_NO_PULLDOWN)==0) {
+			/* pull down menus */
+			uiBlockSetEmboss(block, UI_EMBOSSP);
+			
+			xmax= GetButStringLength("View");
+			uiDefPulldownBut(block, action_viewmenu, CTX_wm_area(C), 
+						  "View", xco, yco, xmax-3, 24, "");
+			xco+= xmax;
+			
+			xmax= GetButStringLength("Select");
+			uiDefPulldownBut(block, action_selectmenu, CTX_wm_area(C), 
+						  "Select", xco, yco, xmax-3, 24, "");
+			xco+= xmax;
+			
+			if ( (saction->mode == SACTCONT_DOPESHEET) ||
+				 ((saction->action) && (saction->mode==SACTCONT_ACTION)) ) 
+			{
+				xmax= GetButStringLength("Channel");
+				uiDefPulldownBut(block, action_channelmenu, CTX_wm_area(C), 
+							  "Channel", xco, yco, xmax-3, 24, "");
+				xco+= xmax;
+			}
+			else if (saction->mode==SACTCONT_GPENCIL) {
+				xmax= GetButStringLength("Channel");
+				uiDefPulldownBut(block, action_gplayermenu, CTX_wm_area(C), 
+							  "Channel", xco, yco, xmax-3, 24, "");
+				xco+= xmax;
+			}
+			
+			xmax= GetButStringLength("Marker");
+			uiDefPulldownBut(block, action_markermenu, CTX_wm_area(C), 
+						  "Marker", xco, yco, xmax-3, 24, "");
+			xco+= xmax;
+			
+			if (saction->mode == SACTCONT_GPENCIL) {
+				xmax= GetButStringLength("Frame");
+				uiDefPulldownBut(block, action_framemenu, CTX_wm_area(C), 
+							  "Frame", xco, yco, xmax-3, 24, "");
+				xco+= xmax;
+			}
+			else {
+				xmax= GetButStringLength("Key");
+				uiDefPulldownBut(block, action_keymenu, CTX_wm_area(C), 
+							  "Key", xco, yco, xmax-3, 24, "");
+				xco+= xmax;
+			}
+		}
+
+		uiBlockSetEmboss(block, UI_EMBOSS);
 		
-		/* pull down menus */
-		uiBlockSetEmboss(block, UI_EMBOSSP);
+		/* MODE SELECTOR */
+		uiDefButC(block, MENU, B_REDR, 
+				"Editor Mode %t|DopeSheet %x3|Action Editor %x0|ShapeKey Editor %x1|Grease Pencil %x2", 
+				xco,yco,90,YIC, &saction->mode, 0, 1, 0, 0, 
+				"Editing modes for this editor");
+
 		
-		xmax= GetButStringLength("View");
-		uiDefPulldownBut(block, dummy_viewmenu, CTX_wm_area(C), 
-						 "View", xco, yco-2, xmax-3, 24, "");
-		xco+=XIC+xmax;
+		xco += (90 + 8);
+		
+		/* MODE-DEPENDENT DRAWING */
+		if (saction->mode == SACTCONT_DOPESHEET) {
+			/* FILTERING OPTIONS */
+			xco -= 10;
+			
+			//uiBlockBeginAlign(block);
+				uiDefIconButBitI(block, TOG, ADS_FILTER_ONLYSEL, B_REDR, ICON_RESTRICT_SELECT_OFF,	(short)(xco+=XIC),yco,XIC,YIC, &(saction->ads.filterflag), 0, 0, 0, 0, "Only display selected Objects");
+			//uiBlockEndAlign(block);
+			xco += 5;
+			
+			uiBlockBeginAlign(block);
+				uiDefIconButBitI(block, TOGN, ADS_FILTER_NOOBJ, B_REDR, ICON_OBJECT,	(short)(xco+=XIC),yco,XIC,YIC, &(saction->ads.filterflag), 0, 0, 0, 0, "Display Non-Armature Objects");
+				uiDefIconButBitI(block, TOGN, ADS_FILTER_NOARM, B_REDR, ICON_ARMATURE,	(short)(xco+=XIC),yco,XIC,YIC, &(saction->ads.filterflag), 0, 0, 0, 0, "Display Armature Objects");
+				uiDefIconButBitI(block, TOGN, ADS_FILTER_NOSHAPEKEYS, B_REDR, ICON_EDIT,	(short)(xco+=XIC),yco,XIC,YIC, &(saction->ads.filterflag), 0, 0, 0, 0, "Display ShapeKeys");
+				uiDefIconButBitI(block, TOGN, ADS_FILTER_NOMAT, B_REDR, ICON_MATERIAL,	(short)(xco+=XIC),yco,XIC,YIC, &(saction->ads.filterflag), 0, 0, 0, 0, "Display Materials");

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list