diff options
author | Miika Hamalainen <blender@miikah.org> | 2011-09-20 21:51:04 +0400 |
---|---|---|
committer | Miika Hamalainen <blender@miikah.org> | 2011-09-20 21:51:04 +0400 |
commit | 15cb47bf91820aac3a3881e94378067472c07e1b (patch) | |
tree | f8db8dd34c6a0b660ad1816e002c9ef3af939b00 /source/blender/editors/space_outliner | |
parent | 9de082dbf4130b48d59e673ed276a046d97cc1e4 (diff) | |
parent | bc788a3607eda1889c7f0fe2201116826a9394ee (diff) |
Merge with trunk r40409
Diffstat (limited to 'source/blender/editors/space_outliner')
6 files changed, 113 insertions, 56 deletions
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 7df15fb5703..8f4b8e7c59b 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -97,7 +97,7 @@ static void outliner_height(SpaceOops *soops, ListBase *lb, int *h) TreeElement *te= lb->first; while(te) { TreeStoreElem *tselem= TREESTORE(te); - if((tselem->flag & TSE_CLOSED)==0) + if(TSELEM_OPEN(tselem,soops)) outliner_height(soops, &te->subtree, h); (*h) += UI_UNIT_Y; te= te->next; @@ -112,7 +112,7 @@ static void outliner_width(SpaceOops *soops, ListBase *lb, int *w) // TreeStoreElem *tselem= TREESTORE(te); // XXX fixme... te->xend is not set yet - if(tselem->flag & TSE_CLOSED) { + if(!TSELEM_OPEN(tselem,soops)) { if (te->xend > *w) *w = te->xend; } @@ -135,7 +135,7 @@ static void outliner_rna_width(SpaceOops *soops, ListBase *lb, int *w, int start if(startx+100 > *w) *w = startx+100; - if((tselem->flag & TSE_CLOSED)==0) + if(TSELEM_OPEN(tselem,soops)) outliner_rna_width(soops, &te->subtree, w, startx+UI_UNIT_X); te= te->next; } @@ -519,7 +519,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar } } - if((tselem->flag & TSE_CLOSED)==0) outliner_draw_restrictbuts(block, scene, ar, soops, &te->subtree); + if(TSELEM_OPEN(tselem,soops)) outliner_draw_restrictbuts(block, scene, ar, soops, &te->subtree); } } @@ -560,7 +560,7 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa ptr= &te->rnaptr; prop= te->directdata; - if(!(RNA_property_type(prop) == PROP_POINTER && (tselem->flag & TSE_CLOSED)==0)) + if(!(RNA_property_type(prop) == PROP_POINTER && (TSELEM_OPEN(tselem,soops))) ) uiDefAutoButR(block, ptr, prop, -1, "", ICON_NONE, sizex, (int)te->ys, OL_RNA_COL_SIZEX, UI_UNIT_Y-1); } else if(tselem->type == TSE_RNA_ARRAY_ELEM) { @@ -571,7 +571,7 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa } } - if((tselem->flag & TSE_CLOSED)==0) outliner_draw_rnabuts(block, scene, ar, soops, sizex, &te->subtree); + if(TSELEM_OPEN(tselem,soops)) outliner_draw_rnabuts(block, scene, ar, soops, sizex, &te->subtree); } } @@ -828,7 +828,7 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo } } - if((tselem->flag & TSE_CLOSED)==0) outliner_draw_keymapbuts(block, ar, soops, &te->subtree); + if(TSELEM_OPEN(tselem,soops)) outliner_draw_keymapbuts(block, ar, soops, &te->subtree); } } @@ -871,7 +871,7 @@ static void outliner_buttons(const bContext *C, uiBlock *block, ARegion *ar, Spa } } - if((tselem->flag & TSE_CLOSED)==0) outliner_buttons(C, block, ar, soops, &te->subtree); + if(TSELEM_OPEN(tselem,soops)) outliner_buttons(C, block, ar, soops, &te->subtree); } } @@ -1008,6 +1008,10 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto UI_icon_draw(x, y, ICON_MOD_SOLIDIFY); break; case eModifierType_Screw: UI_icon_draw(x, y, ICON_MOD_SCREW); break; + case eModifierType_WeightVGEdit: + case eModifierType_WeightVGMix: + case eModifierType_WeightVGProximity: + UI_icon_draw(x, y, ICON_MOD_VERTEX_WEIGHT); break; case eModifierType_DynamicPaint: UI_icon_draw(x, y, ICON_MOD_DYNAMICPAINT); break; default: @@ -1184,7 +1188,7 @@ static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, Spa if(active) { float ufac= UI_UNIT_X/20.0f; - uiSetRoundBox(15); + uiSetRoundBox(UI_CNR_ALL); glColor4ub(255, 255, 255, 100); uiRoundBox( (float)*offsx-0.5f*ufac, (float)ys-1.0f*ufac, (float)*offsx+UI_UNIT_Y-3.0f*ufac, (float)ys+UI_UNIT_Y-3.0f*ufac, UI_UNIT_Y/2.0f-2.0f*ufac); glEnable(GL_BLEND); /* roundbox disables */ @@ -1239,6 +1243,18 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene glEnable(GL_BLEND); + /* start by highlighting search matches + * we don't expand items when searching in the datablocks but we + * still want to highlight any filter matches. + */ + if ( (SEARCHING_OUTLINER(soops) || (soops->outlinevis==SO_DATABLOCKS && soops->search_string[0]!=0)) && + (tselem->flag & TSE_SEARCHMATCH)) + { + /* TODO - add search highlight colour to theme? */ + glColor4f(0.2f, 0.5f, 0.2f, 0.3f); + glRecti(startx, *starty+1, ar->v2d.cur.xmax, *starty+UI_UNIT_Y-1); + } + /* colors for active/selected data */ if(tselem->type==0) { if(te->idcode==ID_SCE) { @@ -1303,7 +1319,7 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene /* active circle */ if(active) { - uiSetRoundBox(15); + uiSetRoundBox(UI_CNR_ALL); uiRoundBox( (float)startx+UI_UNIT_Y-1.5f*ufac, (float)*starty+2.0f*ufac, (float)startx+2.0f*UI_UNIT_Y-4.0f*ufac, (float)*starty+UI_UNIT_Y-1.0f*ufac, UI_UNIT_Y/2.0f-2.0f*ufac); glEnable(GL_BLEND); /* roundbox disables it */ @@ -1319,10 +1335,10 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene icon_x = startx+5*ufac; // icons a bit higher - if(tselem->flag & TSE_CLOSED) - UI_icon_draw((float)icon_x, (float)*starty+2*ufac, ICON_DISCLOSURE_TRI_RIGHT); - else + if(TSELEM_OPEN(tselem,soops)) UI_icon_draw((float)icon_x, (float)*starty+2*ufac, ICON_DISCLOSURE_TRI_DOWN); + else + UI_icon_draw((float)icon_x, (float)*starty+2*ufac, ICON_DISCLOSURE_TRI_RIGHT); } offsx+= UI_UNIT_X; @@ -1358,7 +1374,7 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene offsx+= (int)(UI_UNIT_X + UI_GetStringWidth(te->name)); /* closed item, we draw the icons, not when it's a scene, or master-server list though */ - if(tselem->flag & TSE_CLOSED) { + if(!TSELEM_OPEN(tselem,soops)) { if(te->subtree.first) { if(tselem->type==0 && te->idcode==ID_SCE); else if(tselem->type!=TSE_R_LAYER) { /* this tree element always has same amount of branches, so dont draw */ @@ -1384,7 +1400,7 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene te->ys= (float)*starty; te->xend= startx+offsx; - if((tselem->flag & TSE_CLOSED)==0) { + if(TSELEM_OPEN(tselem,soops)) { *starty-= UI_UNIT_Y; for(ten= te->subtree.first; ten; ten= ten->next) @@ -1417,7 +1433,7 @@ static void outliner_draw_hierarchy(SpaceOops *soops, ListBase *lb, int startx, *starty-= UI_UNIT_Y; - if((tselem->flag & TSE_CLOSED)==0) + if(TSELEM_OPEN(tselem,soops)) outliner_draw_hierarchy(soops, &te->subtree, startx+UI_UNIT_X, starty); } @@ -1441,12 +1457,12 @@ static void outliner_draw_struct_marks(ARegion *ar, SpaceOops *soops, ListBase * tselem= TREESTORE(te); /* selection status */ - if((tselem->flag & TSE_CLOSED)==0) + if(TSELEM_OPEN(tselem,soops)) if(tselem->type == TSE_RNA_STRUCT) glRecti(0, *starty+1, (int)ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, *starty+UI_UNIT_Y-1); *starty-= UI_UNIT_Y; - if((tselem->flag & TSE_CLOSED)==0) { + if(TSELEM_OPEN(tselem,soops)) { outliner_draw_struct_marks(ar, soops, &te->subtree, starty); if(tselem->type == TSE_RNA_STRUCT) fdrawline(0, (float)*starty+UI_UNIT_Y, ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, (float)*starty+UI_UNIT_Y); @@ -1467,7 +1483,7 @@ static void outliner_draw_selection(ARegion *ar, SpaceOops *soops, ListBase *lb, glRecti(0, *starty+1, (int)ar->v2d.cur.xmax, *starty+UI_UNIT_Y-1); } *starty-= UI_UNIT_Y; - if((tselem->flag & TSE_CLOSED)==0) outliner_draw_selection(ar, soops, &te->subtree, starty); + if(TSELEM_OPEN(tselem,soops)) outliner_draw_selection(ar, soops, &te->subtree, starty); } } diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index 2b451a48748..6bfe370d105 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -213,12 +213,12 @@ void OUTLINER_OT_item_openclose(wmOperatorType *ot) ot->poll= ED_operator_outliner_active; - RNA_def_boolean(ot->srna, "all", 1, "All", "Close or open all items."); + RNA_def_boolean(ot->srna, "all", 1, "All", "Close or open all items"); } /* Rename --------------------------------------------------- */ -void do_item_rename(ARegion *ar, TreeElement *te, TreeStoreElem *tselem, ReportList *reports) +static void do_item_rename(ARegion *ar, TreeElement *te, TreeStoreElem *tselem, ReportList *reports) { /* can't rename rna datablocks entries */ if(ELEM3(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) @@ -669,7 +669,7 @@ void OUTLINER_OT_scroll_page(wmOperatorType *ot) ot->poll= ED_operator_outliner_active; /* properties */ - RNA_def_boolean(ot->srna, "up", 0, "Up", "Scroll up one page."); + RNA_def_boolean(ot->srna, "up", 0, "Up", "Scroll up one page"); } /* Search ------------------------------------------------------- */ @@ -687,7 +687,7 @@ static void outliner_set_coordinates_element(SpaceOops *soops, TreeElement *te, te->ys= (float)(*starty); *starty-= UI_UNIT_Y; - if((tselem->flag & TSE_CLOSED)==0) { + if(TSELEM_OPEN(tselem,soops)) { TreeElement *ten; for(ten= te->subtree.first; ten; ten= ten->next) { outliner_set_coordinates_element(soops, ten, startx+UI_UNIT_X, starty); @@ -765,7 +765,7 @@ static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *so } else { /* pop up panel - no previous, or user didn't want search after previous */ - strcpy(name, ""); + name[0]= '\0'; // XXX if (sbutton(name, 0, sizeof(name)-1, "Find: ") && name[0]) { // te= outliner_find_named(soops, &soops->tree, name, flags, NULL, &prevFound); // } @@ -869,7 +869,7 @@ void OUTLINER_OT_show_one_level(wmOperatorType *ot) /* no undo or registry, UI option */ /* properties */ - RNA_def_boolean(ot->srna, "open", 1, "Open", "Expand all entries one level deep."); + RNA_def_boolean(ot->srna, "open", 1, "Open", "Expand all entries one level deep"); } /* Show Hierarchy ----------------------------------------------- */ @@ -910,7 +910,7 @@ static void tree_element_show_hierarchy(Scene *scene, SpaceOops *soops, ListBase } else tselem->flag |= TSE_CLOSED; - if(tselem->flag & TSE_CLOSED); else tree_element_show_hierarchy(scene, soops, &te->subtree); + if(TSELEM_OPEN(tselem,soops)) tree_element_show_hierarchy(scene, soops, &te->subtree); } } @@ -969,7 +969,7 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle ListBase hierarchy = {NULL, NULL}; LinkData *ld; TreeElement *tem, *temnext, *temsub; - TreeStoreElem *tse, *tsenext; + TreeStoreElem *tse /* , *tsenext */ /* UNUSED */; PointerRNA *ptr, *nextptr; PropertyRNA *prop; char *newpath=NULL; @@ -1018,7 +1018,7 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle char buf[128], *name; temnext= (TreeElement*)(ld->next->data); - tsenext= TREESTORE(temnext); + /* tsenext= TREESTORE(temnext); */ /* UNUSED */ nextptr= &temnext->rnaptr; name= RNA_struct_name_get_alloc(nextptr, buf, sizeof(buf)); @@ -1175,7 +1175,7 @@ static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, ReportL } /* go over sub-tree */ - if ((tselem->flag & TSE_CLOSED)==0) + if (TSELEM_OPEN(tselem,soops)) do_outliner_drivers_editop(soops, &te->subtree, reports, mode); } } @@ -1343,7 +1343,7 @@ static void do_outliner_keyingset_editop(SpaceOops *soops, KeyingSet *ks, ListBa } /* go over sub-tree */ - if ((tselem->flag & TSE_CLOSED)==0) + if (TSELEM_OPEN(tselem,soops)) do_outliner_keyingset_editop(soops, ks, &te->subtree, mode); } } diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h index 61507d1ffe5..215ab508ab6 100644 --- a/source/blender/editors/space_outliner/outliner_intern.h +++ b/source/blender/editors/space_outliner/outliner_intern.h @@ -126,6 +126,27 @@ typedef struct TreeElement { #define OL_RNA_COL_SPACEX (UI_UNIT_X*2.5f) +/* Outliner Searching -- + + Are we looking for something in the outliner? + If so finding matches in child items makes it more useful + + - We want to flag parents to act as being open to filter child matches + - and also flag matches so we can highlight them + - Flags are stored in TreeStoreElem->flag + - Flag options defined in DNA_outliner_types.h + - SO_SEARCH_RECURSIVE defined in DNA_space_types.h + + - NOT in datablocks view - searching all datablocks takes way too long + to be useful + - not searching into RNA items helps but isn't the complete solution + */ + +#define SEARCHING_OUTLINER(sov) (sov->search_flags & SO_SEARCH_RECURSIVE) + +/* is the currrent element open? if so we also show children */ +#define TSELEM_OPEN(telm,sv) ( (telm->flag & TSE_CLOSED)==0 || (SEARCHING_OUTLINER(sv) && (telm->flag & TSE_CHILDSEARCH)) ) + /* outliner_tree.c ----------------------------------------------- */ void outliner_free_tree(ListBase *lb); diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c index 2c0a8c34747..42fe14cd59c 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -134,7 +134,7 @@ static int outliner_select(SpaceOops *soops, ListBase *lb, int *index, short *se change |= 1; } } - else if ((tselem->flag & TSE_CLOSED)==0) { + else if (TSELEM_OPEN(tselem,soops)) { /* Only try selecting sub-elements if we haven't hit the right element yet * * Hack warning: @@ -867,7 +867,7 @@ void OUTLINER_OT_item_activate(wmOperatorType *ot) ot->poll= ED_operator_outliner_active; - RNA_def_boolean(ot->srna, "extend", 1, "Extend", "Extend selection for activation."); + RNA_def_boolean(ot->srna, "extend", 1, "Extend", "Extend selection for activation"); } /* ****************************************************** */ diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index b3170f9cd1e..78907fbd1ed 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -145,7 +145,7 @@ static void set_operation_types(SpaceOops *soops, ListBase *lb, } } } - if((tselem->flag & TSE_CLOSED)==0) { + if(TSELEM_OPEN(tselem,soops)) { set_operation_types(soops, &te->subtree, scenelevel, objectlevel, idlevel, datalevel); } @@ -250,7 +250,7 @@ static void outliner_do_libdata_operation(bContext *C, Scene *scene, SpaceOops * operation_cb(C, scene, te, tsep, tselem); } } - if((tselem->flag & TSE_CLOSED)==0) { + if(TSELEM_OPEN(tselem,soops)) { outliner_do_libdata_operation(C, scene, soops, &te->subtree, operation_cb); } } @@ -342,7 +342,7 @@ static void singleuser_action_cb(bContext *C, Scene *UNUSED(scene), TreeElement if (id) { IdAdtTemplate *iat = (IdAdtTemplate *)tsep->id; - PointerRNA ptr = {{0}}; + PointerRNA ptr = {{NULL}}; PropertyRNA *prop; RNA_pointer_create(&iat->id, &RNA_AnimData, iat->adt, &ptr); @@ -397,7 +397,7 @@ void outliner_do_object_operation(bContext *C, Scene *scene_act, SpaceOops *soop operation_cb(C, scene_owner ? scene_owner : scene_act, te, NULL, tselem); } } - if((tselem->flag & TSE_CLOSED)==0) { + if(TSELEM_OPEN(tselem,soops)) { outliner_do_object_operation(C, scene_act, soops, &te->subtree, operation_cb); } } @@ -504,7 +504,7 @@ static void outliner_do_data_operation(SpaceOops *soops, int type, int event, Li operation_cb(event, te, tselem); } } - if((tselem->flag & TSE_CLOSED)==0) { + if(TSELEM_OPEN(tselem,soops)) { outliner_do_data_operation(soops, type, event, &te->subtree, operation_cb); } } @@ -857,7 +857,7 @@ static void outliner_do_id_set_operation(SpaceOops *soops, int type, ListBase *l operation_cb(te, tselem, tsep, newid); } } - if ((tselem->flag & TSE_CLOSED)==0) { + if (TSELEM_OPEN(tselem,soops)) { outliner_do_id_set_operation(soops, type, &te->subtree, newid, operation_cb); } } @@ -899,7 +899,7 @@ static int outliner_action_set_exec(bContext *C, wmOperator *op) act= BLI_findlink(&CTX_data_main(C)->action, RNA_enum_get(op->ptr, "action")); if (act == NULL) { - BKE_report(op->reports, RPT_ERROR, "No valid Action to add."); + BKE_report(op->reports, RPT_ERROR, "No valid Action to add"); return OPERATOR_CANCELLED; } else if (act->idroot == 0) { diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index 8904dcc360f..9fe0ed0543f 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -473,7 +473,7 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree ten= outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_POSE_CHANNEL, a); ten->name= pchan->name; ten->directdata= pchan; - pchan->prev= (bPoseChannel *)ten; + pchan->temp= (void *)ten; if(pchan->constraints.first) { //Object *target; @@ -506,19 +506,13 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree pchan= (bPoseChannel *)ten->directdata; if(pchan->parent) { BLI_remlink(&tenla->subtree, ten); - par= (TreeElement *)pchan->parent->prev; + par= (TreeElement *)pchan->parent->temp; BLI_addtail(&par->subtree, ten); ten->parent= par; } } ten= nten; } - /* restore prev pointers */ - pchan= ob->pose->chanbase.first; - if(pchan) pchan->prev= NULL; - for(; pchan; pchan= pchan->next) { - if(pchan->next) pchan->next->prev= pchan; - } } /* Pose Groups */ @@ -775,7 +769,7 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor ebone->temp= ten; } /* make hierarchy */ - ten= te->subtree.first; + ten= arm->edbo->first ? ((EditBone *)arm->edbo->first)->temp : NULL; while(ten) { TreeElement *nten= ten->next, *par; ebone= (EditBone *)ten->directdata; @@ -827,6 +821,10 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i check_persistant(soops, te, id, type, index); tselem= TREESTORE(te); + /* if we are searching for something expand to see child elements */ + if(SEARCHING_OUTLINER(soops)) + tselem->flag |= TSE_CHILDSEARCH; + te->parent= parent; te->index= index; // for data arays if(ELEM3(type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP)); @@ -981,6 +979,9 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i else te->name= (char*)RNA_struct_ui_name(ptr->type); + /* If searching don't expand RNA entries */ + if(SEARCHING_OUTLINER(soops) && BLI_strcasecmp("RNA",te->name)==0) tselem->flag &= ~TSE_CHILDSEARCH; + iterprop= RNA_struct_iterator_property(ptr->type); tot= RNA_property_collection_length(ptr, iterprop); @@ -989,7 +990,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i if(!tselem->used) tselem->flag &= ~TSE_CLOSED; - if(!(tselem->flag & TSE_CLOSED)) { + if(TSELEM_OPEN(tselem,soops)) { for(a=0; a<tot; a++) outliner_add_element(soops, &te->subtree, (void*)ptr, te, TSE_RNA_PROPERTY, a); } @@ -1010,11 +1011,14 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i te->directdata= prop; te->rnaptr= *ptr; + /* If searching don't expand RNA entries */ + if(SEARCHING_OUTLINER(soops) && BLI_strcasecmp("RNA",te->name)==0) tselem->flag &= ~TSE_CHILDSEARCH; + if(proptype == PROP_POINTER) { pptr= RNA_property_pointer_get(ptr, prop); if(pptr.data) { - if(!(tselem->flag & TSE_CLOSED)) + if(TSELEM_OPEN(tselem,soops)) outliner_add_element(soops, &te->subtree, (void*)&pptr, te, TSE_RNA_STRUCT, -1); else te->flag |= TE_LAZY_CLOSED; @@ -1023,7 +1027,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i else if(proptype == PROP_COLLECTION) { tot= RNA_property_collection_length(ptr, prop); - if(!(tselem->flag & TSE_CLOSED)) { + if(TSELEM_OPEN(tselem,soops)) { for(a=0; a<tot; a++) { RNA_property_collection_lookup_int(ptr, prop, a, &pptr); outliner_add_element(soops, &te->subtree, (void*)&pptr, te, TSE_RNA_STRUCT, a); @@ -1035,7 +1039,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i else if(ELEM3(proptype, PROP_BOOLEAN, PROP_INT, PROP_FLOAT)) { tot= RNA_property_array_length(ptr, prop); - if(!(tselem->flag & TSE_CLOSED)) { + if(TSELEM_OPEN(tselem,soops)) { for(a=0; a<tot; a++) outliner_add_element(soops, &te->subtree, (void*)ptr, te, TSE_RNA_ARRAY_ELEM, a); } @@ -1068,7 +1072,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i te->directdata= idv; te->name= km->idname; - if(!(tselem->flag & TSE_CLOSED)) { + if(TSELEM_OPEN(tselem,soops)) { a= 0; for (kmi= km->items.first; kmi; kmi= kmi->next, a++) { @@ -1147,7 +1151,7 @@ static int need_add_seq_dup(Sequence *seq) static void outliner_add_seq_dup(SpaceOops *soops, Sequence *seq, TreeElement *te, short index) { - TreeElement *ch; + /* TreeElement *ch; */ /* UNUSED */ Sequence *p; p= seq; @@ -1158,7 +1162,7 @@ static void outliner_add_seq_dup(SpaceOops *soops, Sequence *seq, TreeElement *t } if(!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name)) - ch= outliner_add_element(soops, &te->subtree, (void*)p, te, TSE_SEQUENCE, index); + /* ch= */ /* UNUSED */ outliner_add_element(soops, &te->subtree, (void*)p, te, TSE_SEQUENCE, index); p= p->next; } } @@ -1368,7 +1372,10 @@ static int outliner_filter_tree(SpaceOops *soops, ListBase *lb) */ tselem= TREESTORE(te); - if ((tselem->flag & TSE_CLOSED) || outliner_filter_tree(soops, &te->subtree)==0) { + /* flag as not a found item */ + tselem->flag &= ~TSE_SEARCHMATCH; + + if ((!TSELEM_OPEN(tselem,soops)) || outliner_filter_tree(soops, &te->subtree)==0) { outliner_free_tree(&te->subtree); BLI_remlink(lb, te); @@ -1377,6 +1384,11 @@ static int outliner_filter_tree(SpaceOops *soops, ListBase *lb) } } else { + tselem= TREESTORE(te); + + /* flag as a found item - we can then highlight it */ + tselem->flag |= TSE_SEARCHMATCH; + /* filter subtree too */ outliner_filter_tree(soops, &te->subtree); } @@ -1399,6 +1411,14 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops) TreeStoreElem *tselem; int show_opened= (soops->treestore==NULL); /* on first view, we open scenes */ + /* Are we looking for something - we want to tag parents to filter child matches + - NOT in datablocks view - searching all datablocks takes way too long to be useful + - this variable is only set once per tree build */ + if(soops->search_string[0]!=0 && soops->outlinevis!=SO_DATABLOCKS) + soops->search_flags |= SO_SEARCH_RECURSIVE; + else + soops->search_flags &= ~SO_SEARCH_RECURSIVE; + if(soops->tree.first && (soops->storeflag & SO_TREESTORE_REDRAW)) return; |