- Fix: enter/exit posemode used wrong pointer, could crash

- enter/exit posemode now updates outliner view too

- New: outliner option "Show same type". Shows only object types as
  current active one. Nice to browse all lamps, mballs, armatures, etc
This commit is contained in:
2004-10-06 21:48:29 +00:00
parent 25c52c19e9
commit b94b922d23
6 changed files with 64 additions and 44 deletions

View File

@@ -45,6 +45,10 @@ typedef struct TreeElement {
/* TreeElement->flag */ /* TreeElement->flag */
#define TE_ACTIVE 1 #define TE_ACTIVE 1
/* TreeStoreElem types */
#define TE_NLA 1
extern void draw_outliner(struct ScrArea *sa, struct SpaceOops *so); extern void draw_outliner(struct ScrArea *sa, struct SpaceOops *so);
extern void outliner_free_tree(struct ListBase *lb); extern void outliner_free_tree(struct ListBase *lb);
extern void outliner_mouse_event(struct ScrArea *sa, short event); extern void outliner_mouse_event(struct ScrArea *sa, short event);

View File

@@ -79,6 +79,7 @@ typedef struct OopsLink {
#define TSE_CLOSED 1 #define TSE_CLOSED 1
#define TSE_LASTCLICKED 2 #define TSE_LASTCLICKED 2
/* TreeStoreElem types in BIF_outliner.h */
#endif #endif

View File

@@ -474,6 +474,7 @@ typedef struct SpaceImaSel {
#define SO_VISIBLE 2 #define SO_VISIBLE 2
#define SO_SELECTED 3 #define SO_SELECTED 3
#define SO_ACTIVE 4 #define SO_ACTIVE 4
#define SO_SAME_TYPE 5
/* SpaceOops->storeflag */ /* SpaceOops->storeflag */
#define SO_TREESTORE_CLEANUP 1 #define SO_TREESTORE_CLEANUP 1

View File

@@ -366,7 +366,7 @@ void oops_buttons(void)
} }
} }
else { else {
uiDefButS(block, MENU, B_REDR, "Outliner Display%t|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Selected %x3|Active %x4", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, ""); uiDefButS(block, MENU, B_REDR, "Outliner Display%t|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Same Types %x5|Selected %x3|Active %x4", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, "");
} }
/* always do as last */ /* always do as last */

View File

@@ -103,9 +103,6 @@
#define TREESTORE(a) soops->treestore->data+(a)->store_index #define TREESTORE(a) soops->treestore->data+(a)->store_index
/* fake ID to get NLA inside diagram */
static ID nlaid= {NULL, NULL, NULL, NULL, "NLNLA", 0, 0, 0};
/* ******************** PERSISTANT DATA ***************** */ /* ******************** PERSISTANT DATA ***************** */
/* for now only called after reading file or undo step */ /* for now only called after reading file or undo step */
@@ -186,7 +183,8 @@ static void check_persistant(SpaceOops *soops, TreeElement *te, ID *id, short ty
tselem= ts->data+ts->usedelem; tselem= ts->data+ts->usedelem;
tselem->type= type; tselem->type= type;
tselem->nr= nr; if(tselem->type) tselem->nr= nr; // we're picky! :)
else tselem->nr= 0;
tselem->id= id; tselem->id= id;
tselem->flag= TSE_CLOSED; tselem->flag= TSE_CLOSED;
te->store_index= ts->usedelem; te->store_index= ts->usedelem;
@@ -220,7 +218,8 @@ static void outliner_height(SpaceOops *soops, ListBase *lb, int *h)
} }
} }
static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *idv, TreeElement *parent, short index) static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *idv,
TreeElement *parent, short type, short index)
{ {
TreeElement *te; TreeElement *te;
TreeStoreElem *tselem; TreeStoreElem *tselem;
@@ -232,13 +231,13 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
/* add to the visual tree */ /* add to the visual tree */
BLI_addtail(lb, te); BLI_addtail(lb, te);
/* add to the storage */ /* add to the storage */
check_persistant(soops, te, idv, 0, 0); check_persistant(soops, te, idv, type, index);
tselem= TREESTORE(te); tselem= TREESTORE(te);
te->parent= parent; te->parent= parent;
te->index= index; // for (ID *) arays te->index= index; // for (ID *) arays
if(idv) { if(idv && type==0) {
ID *id= idv; ID *id= idv;
/* tuck pointer back in object, to construct hierarchy */ /* tuck pointer back in object, to construct hierarchy */
@@ -249,86 +248,87 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
case ID_SCE: case ID_SCE:
{ {
Scene *sce= (Scene *)id; Scene *sce= (Scene *)id;
outliner_add_element(soops, &te->subtree, sce->world, te, 0); outliner_add_element(soops, &te->subtree, sce->world, te, 0, 0);
} }
break; break;
case ID_OB: case ID_OB:
{ {
Object *ob= (Object *)id; Object *ob= (Object *)id;
outliner_add_element(soops, &te->subtree, ob->data, te, 0); outliner_add_element(soops, &te->subtree, ob->data, te, 0, 0);
outliner_add_element(soops, &te->subtree, ob->ipo, te, 0); outliner_add_element(soops, &te->subtree, ob->ipo, te, 0, 0);
outliner_add_element(soops, &te->subtree, ob->action, te, 0); outliner_add_element(soops, &te->subtree, ob->action, te, 0, 0);
if(ob->nlastrips.first) { if(0 && ob->nlastrips.first) {
//bActionStrip *strip; bActionStrip *strip;
//TreeElement *tenla= outliner_add_element(soops, &te->subtree, &nlaid, te, 0); TreeElement *tenla= outliner_add_element(soops, &te->subtree, ob, te, TE_NLA, 0);
//for (strip=ob->nlastrips.first; strip; strip=strip->next) { int a= 0;
// outliner_add_element(soops, &tenla->subtree, strip->act, tenla, 0); for (strip=ob->nlastrips.first; strip; strip=strip->next, a++) {
//} outliner_add_element(soops, &tenla->subtree, strip->act, tenla, 0, a);
}
} }
for(a=0; a<ob->totcol; a++) for(a=0; a<ob->totcol; a++)
outliner_add_element(soops, &te->subtree, ob->mat[a], te, a); outliner_add_element(soops, &te->subtree, ob->mat[a], te, 0, a);
} }
break; break;
case ID_ME: case ID_ME:
{ {
Mesh *me= (Mesh *)id; Mesh *me= (Mesh *)id;
outliner_add_element(soops, &te->subtree, me->ipo, te, 0); outliner_add_element(soops, &te->subtree, me->ipo, te, 0, 0);
outliner_add_element(soops, &te->subtree, me->key, te, 0); outliner_add_element(soops, &te->subtree, me->key, te, 0, 0);
for(a=0; a<me->totcol; a++) for(a=0; a<me->totcol; a++)
outliner_add_element(soops, &te->subtree, me->mat[a], te, a); outliner_add_element(soops, &te->subtree, me->mat[a], te, 0, a);
} }
break; break;
case ID_CU: case ID_CU:
{ {
Curve *cu= (Curve *)id; Curve *cu= (Curve *)id;
for(a=0; a<cu->totcol; a++) for(a=0; a<cu->totcol; a++)
outliner_add_element(soops, &te->subtree, cu->mat[a], te, a); outliner_add_element(soops, &te->subtree, cu->mat[a], te, 0, a);
} }
break; break;
case ID_MB: case ID_MB:
{ {
MetaBall *mb= (MetaBall *)id; MetaBall *mb= (MetaBall *)id;
for(a=0; a<mb->totcol; a++) for(a=0; a<mb->totcol; a++)
outliner_add_element(soops, &te->subtree, mb->mat[a], te, a); outliner_add_element(soops, &te->subtree, mb->mat[a], te, 0, a);
} }
break; break;
case ID_MA: case ID_MA:
{ {
Material *ma= (Material *)id; Material *ma= (Material *)id;
outliner_add_element(soops, &te->subtree, ma->ipo, te, 0); outliner_add_element(soops, &te->subtree, ma->ipo, te, 0, 0);
for(a=0; a<8; a++) { for(a=0; a<8; a++) {
if(ma->mtex[a]) outliner_add_element(soops, &te->subtree, ma->mtex[a]->tex, te, a); if(ma->mtex[a]) outliner_add_element(soops, &te->subtree, ma->mtex[a]->tex, te, 0, a);
} }
} }
break; break;
case ID_CA: case ID_CA:
{ {
Camera *ca= (Camera *)id; Camera *ca= (Camera *)id;
outliner_add_element(soops, &te->subtree, ca->ipo, te, 0); outliner_add_element(soops, &te->subtree, ca->ipo, te, 0, 0);
} }
break; break;
case ID_LA: case ID_LA:
{ {
Lamp *la= (Lamp *)id; Lamp *la= (Lamp *)id;
outliner_add_element(soops, &te->subtree, la->ipo, te, 0); outliner_add_element(soops, &te->subtree, la->ipo, te, 0, 0);
for(a=0; a<6; a++) { for(a=0; a<6; a++) {
if(la->mtex[a]) outliner_add_element(soops, &te->subtree, la->mtex[a]->tex, te, a); if(la->mtex[a]) outliner_add_element(soops, &te->subtree, la->mtex[a]->tex, te, 0, a);
} }
} }
break; break;
case ID_WO: case ID_WO:
{ {
World *wrld= (World *)id; World *wrld= (World *)id;
outliner_add_element(soops, &te->subtree, wrld->ipo, te, 0); outliner_add_element(soops, &te->subtree, wrld->ipo, te, 0, 0);
for(a=0; a<6; a++) { for(a=0; a<6; a++) {
if(wrld->mtex[a]) outliner_add_element(soops, &te->subtree, wrld->mtex[a]->tex, te, a); if(wrld->mtex[a]) outliner_add_element(soops, &te->subtree, wrld->mtex[a]->tex, te, 0, a);
} }
} }
case ID_KE: case ID_KE:
{ {
Key *key= (Key *)id; Key *key= (Key *)id;
outliner_add_element(soops, &te->subtree, key->ipo, te, 0); outliner_add_element(soops, &te->subtree, key->ipo, te, 0, 0);
} }
break; break;
case ID_AC: case ID_AC:
@@ -340,7 +340,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
tselem= TREESTORE(parent); tselem= TREESTORE(parent);
if(GS(tselem->id->name)!=ID_NLA) { // dont expand NLA if(GS(tselem->id->name)!=ID_NLA) { // dont expand NLA
for (chan=act->chanbase.first; chan; chan=chan->next, a++) { for (chan=act->chanbase.first; chan; chan=chan->next, a++) {
outliner_add_element(soops, &te->subtree, chan->ipo, te, a); outliner_add_element(soops, &te->subtree, chan->ipo, te, 0, a);
} }
} }
} }
@@ -390,43 +390,54 @@ static void outliner_build_tree(SpaceOops *soops)
/* option 1: all scenes */ /* option 1: all scenes */
if(soops->outlinevis == SO_ALL_SCENES) { if(soops->outlinevis == SO_ALL_SCENES) {
for(sce= G.main->scene.first; sce; sce= sce->id.next) { for(sce= G.main->scene.first; sce; sce= sce->id.next) {
te= outliner_add_element(soops, &soops->tree, sce, NULL, 0); te= outliner_add_element(soops, &soops->tree, sce, NULL, 0, 0);
tselem= TREESTORE(te); tselem= TREESTORE(te);
if((tselem->flag & TSE_CLOSED)==0) { if((tselem->flag & TSE_CLOSED)==0) {
for(base= sce->base.first; base; base= base->next) { for(base= sce->base.first; base; base= base->next) {
outliner_add_element(soops, &te->subtree, base->object, te, 0); outliner_add_element(soops, &te->subtree, base->object, te, 0, 0);
} }
outliner_make_hierarchy(soops, &te->subtree); outliner_make_hierarchy(soops, &te->subtree);
} }
} }
} }
else if(soops->outlinevis == SO_CUR_SCENE) { else if(soops->outlinevis == SO_CUR_SCENE) {
outliner_add_element(soops, &soops->tree, G.scene->world, NULL, 0); outliner_add_element(soops, &soops->tree, G.scene->world, NULL, 0, 0);
for(base= G.scene->base.first; base; base= base->next) { for(base= G.scene->base.first; base; base= base->next) {
outliner_add_element(soops, &soops->tree, base->object, NULL, 0); outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0);
} }
outliner_make_hierarchy(soops, &soops->tree); outliner_make_hierarchy(soops, &soops->tree);
} }
else if(soops->outlinevis == SO_VISIBLE) { else if(soops->outlinevis == SO_VISIBLE) {
for(base= G.scene->base.first; base; base= base->next) { for(base= G.scene->base.first; base; base= base->next) {
if(base->lay & G.scene->lay) if(base->lay & G.scene->lay)
outliner_add_element(soops, &soops->tree, base->object, NULL, 0); outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0);
} }
outliner_make_hierarchy(soops, &soops->tree); outliner_make_hierarchy(soops, &soops->tree);
} }
else if(soops->outlinevis == SO_SAME_TYPE) {
Object *ob= OBACT;
if(ob) {
for(base= G.scene->base.first; base; base= base->next) {
if(base->object->type==ob->type) {
outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0);
}
}
outliner_make_hierarchy(soops, &soops->tree);
}
}
else if(soops->outlinevis == SO_SELECTED) { else if(soops->outlinevis == SO_SELECTED) {
for(base= G.scene->base.first; base; base= base->next) { for(base= G.scene->base.first; base; base= base->next) {
if(base->lay & G.scene->lay) { if(base->lay & G.scene->lay) {
if(base==BASACT || (base->flag & SELECT)) if(base==BASACT || (base->flag & SELECT))
outliner_add_element(soops, &soops->tree, base->object, NULL, 0); outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0);
} }
} }
outliner_make_hierarchy(soops, &soops->tree); outliner_make_hierarchy(soops, &soops->tree);
} }
else { else {
outliner_add_element(soops, &soops->tree, OBACT, NULL, 0); outliner_add_element(soops, &soops->tree, OBACT, NULL, 0, 0);
} }
} }
@@ -939,7 +950,7 @@ static void outliner_draw_iconrow(SpaceOops *soops, TreeElement *parent, ListBas
/* active blocks get white circle */ /* active blocks get white circle */
active= 0; active= 0;
if(GS(tselem->id->name)==ID_OB) active= (OBACT==(Object *)tselem->id); if(GS(tselem->id->name)==ID_OB) active= (OBACT==(Object *)tselem->id);
else if(G.obpose && G.obedit->data==tselem->id) active= 1; else if(G.obpose && G.obpose->data==tselem->id) active= 1;
else if(G.obedit && G.obedit->data==tselem->id) active= 1; else if(G.obedit && G.obedit->data==tselem->id) active= 1;
else active= tree_element_active(soops, te, 0); else active= tree_element_active(soops, te, 0);
@@ -997,19 +1008,20 @@ static void outliner_draw_tree_element(SpaceOops *soops, TreeElement *te, int st
else BIF_GetThemeColorType4ubv(TH_SELECT, SPACE_VIEW3D, col); else BIF_GetThemeColorType4ubv(TH_SELECT, SPACE_VIEW3D, col);
col[3]= 100; col[3]= 100;
glColor4ubv(col); glColor4ubv(col);
//glRecti(0, *starty, soops->v2d.cur.xmax, *starty+OL_H);
} }
} }
else if(G.obpose && G.obpose->data==tselem->id) {
glColor4ub(255, 255, 255, 100);
active= 2;
}
else if(G.obedit && G.obedit->data==tselem->id) { else if(G.obedit && G.obedit->data==tselem->id) {
glColor4ub(255, 255, 255, 100); glColor4ub(255, 255, 255, 100);
active= 2; active= 2;
//glRecti(0, *starty, soops->v2d.cur.xmax, *starty+OL_H);
} }
else { else {
if(tree_element_active(soops, te, 0)) { if(tree_element_active(soops, te, 0)) {
glColor4ub(220, 220, 255, 100); glColor4ub(220, 220, 255, 100);
active= 2; active= 2;
//glRecti(0, *starty, soops->v2d.cur.xmax, *starty+OL_H);
} }
} }

View File

@@ -125,6 +125,7 @@ void enter_posemode(void)
/* make_poseMesh(); */ /* make_poseMesh(); */
allqueue(REDRAWHEADERS, 0); allqueue(REDRAWHEADERS, 0);
allqueue(REDRAWBUTSALL, 0); allqueue(REDRAWBUTSALL, 0);
allqueue(REDRAWOOPS, 0);
allqueue(REDRAWVIEW3D, 0); allqueue(REDRAWVIEW3D, 0);
break; break;
default: default:
@@ -219,6 +220,7 @@ void exit_posemode (int freedata)
countall(); countall();
allqueue(REDRAWVIEW3D, 0); allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWOOPS, 0);
allqueue(REDRAWHEADERS, 0); allqueue(REDRAWHEADERS, 0);
allqueue(REDRAWBUTSALL, 0); allqueue(REDRAWBUTSALL, 0);
} }