Our precious outliner is back! :)
Currently no operations are active there, nor notifiers to refresh
other windows. Be patient!

You can switch to RNA with the 'view' menu. 
Later we'll sort out how much of both get integrated in 1 system, or
have both options, or make designated 'data view' for rna? ALso the
old Oops... bring back?
This commit is contained in:
2008-12-22 19:31:23 +00:00
parent 9e38e6aeb0
commit 3b0c42136b
8 changed files with 4088 additions and 25 deletions

View File

@@ -384,6 +384,32 @@ void uiRoundRectFakeAA(float minx, float miny, float maxx, float maxy, float rad
glDisable( GL_BLEND );
}
/* (old, used in outliner) plain antialiased filled box */
void uiRoundBox(float minx, float miny, float maxx, float maxy, float rad)
{
float color[4];
if(roundboxtype & UI_RB_ALPHA) {
glGetFloatv(GL_CURRENT_COLOR, color);
color[3]= 0.5;
glColor4fv(color);
glEnable( GL_BLEND );
}
/* solid part */
gl_round_box(GL_POLYGON, minx, miny, maxx, maxy, rad);
/* set antialias line */
if (UI_GetThemeValue(TH_BUT_DRAWTYPE) != TH_MINIMAL) {
glEnable( GL_LINE_SMOOTH );
glEnable( GL_BLEND );
}
gl_round_box(GL_LINE_LOOP, minx, miny, maxx, maxy, rad);
glDisable( GL_BLEND );
glDisable( GL_LINE_SMOOTH );
}
void uiTriangleFakeAA(float x1, float y1, float x2, float y2, float x3, float y3)
{

File diff suppressed because it is too large Load Diff

View File

@@ -29,6 +29,7 @@
#include <string.h>
#include <stdio.h>
#include "DNA_ID.h"
#include "DNA_space_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
@@ -39,6 +40,8 @@
#include "BLI_blenlib.h"
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_screen.h"
#include "ED_screen.h"
@@ -62,20 +65,93 @@
static void do_viewmenu(bContext *C, void *arg, int event)
{
ScrArea *curarea= CTX_wm_area(C);
SpaceOops *soops= curarea->spacedata.first;
switch(event) {
case 0: /* Shuffle Selected Blocks */
//shuffle_oops();
break;
case 1: /* Shrink Selected Blocks */
//shrink_oops();
break;
case 2: /* View All */
//do_oops_buttons(B_OOPSHOME);
break;
case 3: /* View All */
//do_oops_buttons(B_OOPSVIEWSEL);
break;
case 4: /* Maximize Window */
/* using event B_FULL */
break;
case 5: /* show rna viewer */
soops->type= SO_RNA;
break;
case 14: /* show outliner viewer */
soops->type= SO_OUTLINER;
break;
case 6:
//outliner_toggle_visible(curarea);
break;
case 7:
//outliner_show_hierarchy(curarea);
break;
case 8:
//outliner_show_active(curarea);
break;
case 9:
//outliner_one_level(curarea, 1);
break;
case 10:
//outliner_one_level(curarea, -1);
break;
case 12:
if (soops->flag & SO_HIDE_RESTRICTCOLS) soops->flag &= ~SO_HIDE_RESTRICTCOLS;
else soops->flag |= SO_HIDE_RESTRICTCOLS;
break;
}
ED_area_tag_redraw(curarea);
}
static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
static uiBlock *outliner_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
SpaceOops *soops= curarea->spacedata.first;
uiBlock *block;
short yco= 0, menuwidth=120;
block= uiBeginBlock(C, handle->region, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
block= uiBeginBlock(C, handle->region, "outliner_viewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_viewmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
if(soops->type==SO_RNA) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Outliner", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 14, "");
}
if(soops->type==SO_OUTLINER) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show RNA Viewer", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
if (soops->flag & SO_HIDE_RESTRICTCOLS)
uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Show Restriction Columns", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
else
uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Show Restriction Columns", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Expand One Level|NumPad +", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Collapse One Level|NumPad -", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show/Hide All", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Hierarchy|Home", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Active|NumPad .", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, "");
}
// uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
// if(!curarea->full) uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Maximize Window|Ctrl UpArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
// else uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Tile Window|Ctrl DownArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
if(curarea->headertype==HEADERTOP) {
uiBlockSetDirection(block, UI_DOWN);
@@ -91,9 +167,15 @@ static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg
return block;
}
#define B_REDR 1
static void do_outliner_buttons(bContext *C, void *arg, int event)
{
ScrArea *sa= CTX_wm_area(C);
switch(event) {
case B_REDR:
ED_area_tag_redraw(sa);
break;
}
}
@@ -103,7 +185,7 @@ void outliner_header_buttons(const bContext *C, ARegion *ar)
ScrArea *sa= CTX_wm_area(C);
SpaceOops *soutliner= (SpaceOops*)CTX_wm_space_data(C);
uiBlock *block;
int xco, yco= 3;
int xco, yco= 3, xmax;
char *path;
block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS, UI_HELV);
@@ -112,27 +194,36 @@ void outliner_header_buttons(const bContext *C, ARegion *ar)
xco= ED_area_header_standardbuttons(C, block, yco);
if((sa->flag & HEADER_NO_PULLDOWN)==0) {
int xmax;
/* pull down menus */
uiBlockSetEmboss(block, UI_EMBOSSP);
xmax= GetButStringLength("View");
uiDefPulldownBut(block, dummy_viewmenu, CTX_wm_area(C),
uiDefPulldownBut(block, outliner_viewmenu, CTX_wm_area(C),
"View", xco, yco-2, xmax-3, 24, "");
xco += xmax;
/* header text */
xco += XIC*2;
uiBlockSetEmboss(block, UI_EMBOSS);
}
if(soutliner->type==SO_RNA) {
path= (soutliner->rnapath)? soutliner->rnapath: "Main";
xmax= GetButStringLength(path);
uiDefBut(block, LABEL, 0, path, xco, yco-2, xmax-3, 24, 0, 0, 0, 0, 0, "Current RNA Path");
xco += xmax;
uiBlockSetEmboss(block, UI_EMBOSS);
}
if(soutliner->type==SO_OUTLINER) {
if(G.main->library.first)
uiDefButS(block, MENU, B_REDR, "Outliner Display%t|Libraries %x7|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4|Sequence %x10", xco, yco, 100, 20, &soutliner->outlinevis, 0, 0, 0, 0, "");
else
uiDefButS(block, MENU, B_REDR, "Outliner Display%t|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4|Sequence %x10", xco, yco, 100, 20, &soutliner->outlinevis, 0, 0, 0, 0, "");
}
/* always as last */
UI_view2d_totRect_set(&ar->v2d, xco+XIC+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin);

View File

@@ -32,8 +32,11 @@
/* internal exports only */
struct wmWindowManager;
struct wmOperatorType;
struct TreeStoreElem;
struct bContext;
struct Scene;
struct ARegion;
typedef struct TreeElement {
struct TreeElement *next, *prev, *parent;
@@ -66,11 +69,7 @@ typedef struct TreeElement {
#define TSE_SCRIPT_BASE 12
#define TSE_POSE_BASE 13
#define TSE_POSE_CHANNEL 14
/*#ifdef WITH_VERSE*/
#define TSE_VERSE_SESSION 15
#define TSE_VERSE_OBJ_NODE 16
#define TSE_VERSE_GEOM_NODE 17
/*#endif*/
#define TSE_PROXY 18
#define TSE_R_LAYER_BASE 19
#define TSE_R_LAYER 20
@@ -80,9 +79,10 @@ typedef struct TreeElement {
#define TSE_LINKED_LAMP 23
#define TSE_POSEGRP_BASE 24
#define TSE_POSEGRP 25
#define TSE_SEQUENCE 26
#define TSE_SEQ_STRIP 27
#define TSE_SEQUENCE_DUP 28
#define TSE_SEQUENCE 26
#define TSE_SEQ_STRIP 27
#define TSE_SEQUENCE_DUP 28
#define TSE_LINKED_PSYS 29
/* outliner search flags */
#define OL_FIND 0
@@ -99,8 +99,31 @@ void outliner_operatortypes(void);
void outliner_keymap(struct wmWindowManager *wm);
/* outliner_header.c */
void outliner_header_buttons(const bContext *C, ARegion *ar);
void outliner_header_buttons(const struct bContext *C, struct ARegion *ar);
/* outliner.c */
void outliner_operation_menu(struct Scene *scene, struct ARegion *ar, struct SpaceOops *soops);
void outliner_select(struct ARegion *ar, struct SpaceOops *so);
void draw_outliner(const struct bContext *C);
void ED_OUTLINER_OT_activate_click(struct wmOperatorType *ot);
#if 0
extern void outliner_free_tree(struct ListBase *lb);
extern void outliner_mouse_event(Scene *scene, ARegion *ar, SpaceOops *soops, short event);
extern void outliner_toggle_visible(SpaceOops *soops);
extern void outliner_show_active(ARegion *ar, SpaceOops *soops);
extern void outliner_show_hierarchy(Scene *scene, SpaceOops *soops);
extern void outliner_one_level(SpaceOops *soops, int add);
extern void outliner_select(Scene *scene, SpaceOops *soops);
extern void outliner_toggle_selected(Scene *scene, SpaceOops *soops);
extern void outliner_toggle_visibility(Scene *scene, SpaceOops *soops);
extern void outliner_toggle_selectability(Scene *scene, SpaceOops *soops);
extern void outliner_toggle_renderability(Scene *scene, SpaceOops *soops);
extern void outliner_del(Scene *scene, SpaceOops *soops);
extern void outliner_page_up_down(Scene *scene, ARegion *ar, SpaceOops *soops, int up);
extern void outliner_find_panel(Scene *scene, ARegion *ar, SpaceOops *soops, int again, int flags);
#endif
#endif /* ED_OUTLINER_INTERN_H */

View File

@@ -28,15 +28,29 @@
#include <stdlib.h>
#include "DNA_space_types.h"
#include "DNA_windowmanager_types.h"
#include "WM_api.h"
#include "WM_types.h"
#include "ED_screen.h"
#include "outliner_intern.h"
/* ************************** registration **********************************/
void outliner_operatortypes(void)
{
WM_operatortype_append(ED_OUTLINER_OT_activate_click);
}
void outliner_keymap(wmWindowManager *wm)
{
ListBase *keymap= WM_keymap_listbase(wm, "Outliner", SPACE_OOPS, 0);
WM_keymap_verify_item(keymap, "ED_OUTLINER_OT_activate_click", LEFTMOUSE, KM_PRESS, 0, 0);
}

View File

@@ -395,10 +395,17 @@ static void rna_table_cell_func(void *userdata, int row, int col, rcti *rct, uiB
static void outliner_main_area_init(wmWindowManager *wm, ARegion *ar)
{
ListBase *keymap;
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
/* own keymap */
keymap= WM_keymap_listbase(wm, "Outliner", SPACE_OOPS, 0); /* XXX weak? */
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
static void outliner_main_area_draw(const bContext *C, ARegion *ar)
static void outliner_rna_draw(const bContext *C, ARegion *ar)
{
uiTable *table;
rcti rct;
@@ -496,6 +503,39 @@ static void outliner_main_area_draw(const bContext *C, ARegion *ar)
UI_view2d_scrollers_free(scrollers);
}
static void outliner_tree_draw(const bContext *C, ARegion *ar)
{
View2D *v2d= &ar->v2d;
View2DScrollers *scrollers;
float col[3];
/* clear */
UI_GetThemeColor3fv(TH_BACK, col);
glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT);
draw_outliner(C);
/* reset view matrix */
UI_view2d_view_restore(C);
/* scrollers */
scrollers= UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
UI_view2d_scrollers_draw(C, v2d, scrollers);
UI_view2d_scrollers_free(scrollers);
}
static void outliner_main_area_draw(const bContext *C, ARegion *ar)
{
SpaceOops *so= (SpaceOops *)CTX_wm_space_data(C);
if(so->type==SO_RNA)
outliner_rna_draw(C, ar);
else
outliner_tree_draw(C, ar);
}
static void outliner_main_area_free(ARegion *ar)
{
}
@@ -538,7 +578,8 @@ static SpaceLink *outliner_new(const bContext *C)
SpaceOops *soutliner;
soutliner= MEM_callocN(sizeof(SpaceOops), "initoutliner");
soutliner->spacetype= SPACE_OOPS;
/* header */
ar= MEM_callocN(sizeof(ARegion), "header for outliner");
@@ -589,7 +630,7 @@ static void outliner_free(SpaceLink *sl)
MEM_freeN(soutliner->rnapath);
soutliner->rnapath= NULL;
}
while( (oops= soutliner->oops.first) ) {
BLI_remlink(&soutliner->oops, oops);
free_oops(oops);

View File

@@ -437,7 +437,34 @@ typedef struct SpaceImaSel {
/* **************** SPACE DEFINES ********************* */
/* button defines in BIF_butspace.h */
/* button defines */
/* warning: the values of these defines are used in sbuts->tabs[7] */
/* buts->mainb new */
#define CONTEXT_SCENE 0
#define CONTEXT_OBJECT 1
#define CONTEXT_TYPES 2
#define CONTEXT_SHADING 3
#define CONTEXT_EDITING 4
#define CONTEXT_SCRIPT 5
#define CONTEXT_LOGIC 6
/* buts->tab new */
#define TAB_SHADING_MAT 0
#define TAB_SHADING_TEX 1
#define TAB_SHADING_RAD 2
#define TAB_SHADING_WORLD 3
#define TAB_SHADING_LAMP 4
#define TAB_OBJECT_OBJECT 0
#define TAB_OBJECT_PHYSICS 1
#define TAB_OBJECT_PARTICLE 2
#define TAB_SCENE_RENDER 0
#define TAB_SCENE_WORLD 1
#define TAB_SCENE_ANIM 2
#define TAB_SCENE_SOUND 3
#define TAB_SCENE_SEQUENCER 4
/* sbuts->flag */
#define SB_PRV_OSA 1
@@ -560,6 +587,7 @@ typedef struct SpaceImaSel {
#define SO_OOPS 0
#define SO_OUTLINER 1
#define SO_DEPSGRAPH 2
#define SO_RNA 3
/* SpaceOops->flag */
#define SO_TESTBLOCKS 1

View File

@@ -28,6 +28,9 @@
#ifndef WM_TYPES_H
#define WM_TYPES_H
struct bContext;
struct wmEvent;
/* exported types for WM */
#include "wm_cursors.h"
@@ -99,8 +102,8 @@ typedef struct wmEvent {
#define WM_UI_HANDLER_CONTINUE 0
#define WM_UI_HANDLER_BREAK 1
typedef int (*wmUIHandlerFunc)(bContext *C, struct wmEvent *event, void *userdata);
typedef void (*wmUIHandlerRemoveFunc)(bContext *C, void *userdata);
typedef int (*wmUIHandlerFunc)(struct bContext *C, struct wmEvent *event, void *userdata);
typedef void (*wmUIHandlerRemoveFunc)(struct bContext *C, void *userdata);
/* ************** Notifiers ****************** */