Index: source/blender/makesdna/DNA_space_types.h =================================================================== --- source/blender/makesdna/DNA_space_types.h (revision 15192) +++ source/blender/makesdna/DNA_space_types.h (working copy) @@ -211,7 +211,10 @@ short type, outlinevis, storeflag; short deps_flags; - + + /* filter options. */ + char outliner_filter[32]; + } SpaceOops; typedef struct SpaceImage { Index: source/blender/src/header_oops.c =================================================================== --- source/blender/src/header_oops.c (revision 15192) +++ source/blender/src/header_oops.c (working copy) @@ -60,6 +60,7 @@ #include "BSE_headerbuttons.h" #include "blendef.h" +#include "mydevice.h" #include "BKE_depsgraph.h" @@ -419,6 +420,11 @@ return block; } +void oops_custom_cb(void *v_soops, void *unused) +{ + allqueue(REDRAWOOPS, 0); +} + void oops_buttons(void) { SpaceOops *soops; @@ -426,6 +432,7 @@ uiBlock *block; short xco, xmax; char naam[256]; + uiBut *bt; soops= curarea->spacedata.first; @@ -568,6 +575,12 @@ #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", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, ""); #endif /* WITH_VERSE */ + + xco+= 100; + bt= uiDefBut(block, TEX, B_NOP, "Filter:", xco, 0, 100, 20, + soops->outliner_filter, 0.0, 31.0, 0, 0, + "Apply a filter to the Outliner tree (nothing == disable it)"); + uiButSetFunc(bt, oops_custom_cb, soops, NULL); } /* always do as last */ Index: source/blender/src/outliner.c =================================================================== --- source/blender/src/outliner.c (revision 15192) +++ source/blender/src/outliner.c (working copy) @@ -58,6 +58,7 @@ #include "DNA_world_types.h" #include "BLI_blenlib.h" +#include "BLI_fnmatch.h" #include "BKE_constraint.h" #include "BKE_deform.h" @@ -414,8 +415,10 @@ } /* Prototype, see functions below */ -static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *idv, - TreeElement *parent, short type, short index); +static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, + void *idv, TreeElement *parent, + short type, short index, + char *filter); static void outliner_add_passes(SpaceOops *soops, TreeElement *tenla, ID *id, SceneRenderLayer *srl) @@ -423,7 +426,7 @@ TreeStoreElem *tselem= TREESTORE(tenla); TreeElement *te; - te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_COMBINED); + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_COMBINED, NULL); te->name= "Combined"; te->directdata= &srl->passflag; @@ -431,59 +434,59 @@ if(tselem->flag & TSE_CLOSED) return; - te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_Z); + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_Z, NULL); te->name= "Z"; te->directdata= &srl->passflag; - te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_VECTOR); + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_VECTOR, NULL); te->name= "Vector"; te->directdata= &srl->passflag; - te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_NORMAL); + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_NORMAL, NULL); te->name= "Normal"; te->directdata= &srl->passflag; - te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_UV); + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_UV, NULL); te->name= "UV"; te->directdata= &srl->passflag; - te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_MIST); + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_MIST, NULL); te->name= "Mist"; te->directdata= &srl->passflag; - te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_INDEXOB); + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_INDEXOB, NULL); te->name= "Index Object"; te->directdata= &srl->passflag; - te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_RGBA); + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_RGBA, NULL); te->name= "Color"; te->directdata= &srl->passflag; - te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_DIFFUSE); + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_DIFFUSE, NULL); te->name= "Diffuse"; te->directdata= &srl->passflag; - te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_SPEC); + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_SPEC, NULL); te->name= "Specular"; te->directdata= &srl->passflag; - te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_SHADOW); + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_SHADOW, NULL); te->name= "Shadow"; te->directdata= &srl->passflag; - te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_AO); + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_AO, NULL); te->name= "AO"; te->directdata= &srl->passflag; - te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_REFLECT); + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_REFLECT, NULL); te->name= "Reflection"; te->directdata= &srl->passflag; - te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_REFRACT); + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_REFRACT, NULL); te->name= "Refraction"; te->directdata= &srl->passflag; - te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_RADIO); + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_RADIO, NULL); te->name= "Radiosity"; te->directdata= &srl->passflag; @@ -494,7 +497,7 @@ static void outliner_add_bone(SpaceOops *soops, ListBase *lb, ID *id, Bone *curBone, TreeElement *parent, int *a) { - TreeElement *te= outliner_add_element(soops, lb, id, parent, TSE_BONE, *a); + TreeElement *te= outliner_add_element(soops, lb, id, parent, TSE_BONE, *a, NULL); (*a)++; te->name= curBone->name; @@ -508,39 +511,65 @@ static void outliner_add_scene_contents(SpaceOops *soops, ListBase *lb, Scene *sce, TreeElement *te) { SceneRenderLayer *srl; - TreeElement *tenla= outliner_add_element(soops, lb, sce, te, TSE_R_LAYER_BASE, 0); + TreeElement *tenla= outliner_add_element(soops, lb, sce, te, TSE_R_LAYER_BASE, 0, NULL); int a; tenla->name= "RenderLayers"; for(a=0, srl= sce->r.layers.first; srl; srl= srl->next, a++) { - TreeElement *tenlay= outliner_add_element(soops, &tenla->subtree, sce, te, TSE_R_LAYER, a); + TreeElement *tenlay= outliner_add_element(soops, &tenla->subtree, sce, te, TSE_R_LAYER, a, NULL); tenlay->name= srl->name; tenlay->directdata= &srl->passflag; if(srl->light_override) - outliner_add_element(soops, &tenlay->subtree, srl->light_override, tenlay, TSE_LINKED_LAMP, 0); + outliner_add_element(soops, &tenlay->subtree, srl->light_override, tenlay, TSE_LINKED_LAMP, 0, NULL); if(srl->mat_override) - outliner_add_element(soops, &tenlay->subtree, srl->mat_override, tenlay, TSE_LINKED_MAT, 0); + outliner_add_element(soops, &tenlay->subtree, srl->mat_override, tenlay, TSE_LINKED_MAT, 0, NULL); outliner_add_passes(soops, tenlay, &sce->id, srl); } - outliner_add_element(soops, lb, sce->world, te, 0, 0); + outliner_add_element(soops, lb, sce->world, te, 0, 0, NULL); if(sce->scriptlink.scripts) { int a= 0; - tenla= outliner_add_element(soops, lb, sce, te, TSE_SCRIPT_BASE, 0); + tenla= outliner_add_element(soops, lb, sce, te, TSE_SCRIPT_BASE, 0, NULL); tenla->name= "Scripts"; for (a=0; ascriptlink.totscript; a++) { - outliner_add_element(soops, &tenla->subtree, sce->scriptlink.scripts[a], tenla, 0, 0); + outliner_add_element(soops, &tenla->subtree, sce->scriptlink.scripts[a], tenla, 0, 0, NULL); } } } -static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *idv, - TreeElement *parent, short type, short index) +int oo_fnmatch(const char *pattern, const char *string, int flag) { + /* + * We have some special case here: + * + * 1) pattern is equal to "", the filter are disable + * and always return true. + */ + if (pattern[0] == '\0') + return(0); + + /* + * 2) The pattern don't have any *, in this case we make + * the same search like for *PATTERN* + */ + if (!strchr(pattern, '*')) { + if (strstr(string, pattern)) + return(0); + return(FNM_NOMATCH); + } + + /* for any other case, just call fnmatch. */ + return(fnmatch(pattern, string, flag)); +} + +static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, + void *idv, TreeElement *parent, short type, + short index, char *filter) +{ TreeElement *te; TreeStoreElem *tselem; ID *id= idv; @@ -578,22 +607,28 @@ Object *ob= (Object *)id; if(ob->proxy && ob->id.lib==NULL) - outliner_add_element(soops, &te->subtree, ob->proxy, te, TSE_PROXY, 0); + outliner_add_element(soops, &te->subtree, ob->proxy, te, TSE_PROXY, 0, NULL); + + if(G.obedit) + outliner_add_element(soops, &te->subtree, ob->data, te, 0, 0, filter); + else + outliner_add_element(soops, &te->subtree, ob->data, te, 0, 0, NULL); - outliner_add_element(soops, &te->subtree, ob->data, te, 0, 0); - if(ob->pose) { bPoseChannel *pchan; TreeElement *ten; - TreeElement *tenla= outliner_add_element(soops, &te->subtree, ob, te, TSE_POSE_BASE, 0); + TreeElement *tenla= outliner_add_element(soops, &te->subtree, ob, te, TSE_POSE_BASE, 0, NULL); tenla->name= "Pose"; if(ob!=G.obedit && (ob->flag & OB_POSEMODE)) { // channels undefined in editmode, but we want the 'tenla' pose icon itself int a= 0, const_index= 1000; /* ensure unique id for bone constraints */ - for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next, a++) { - ten= outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_POSE_CHANNEL, a); + for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { + if((filter) && (oo_fnmatch (filter, pchan->name, 0))) + continue; + + ten= outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_POSE_CHANNEL, a, NULL); ten->name= pchan->name; ten->directdata= pchan; pchan->prev= (bPoseChannel *)ten; @@ -602,14 +637,27 @@ //Object *target; bConstraint *con; TreeElement *ten1; - TreeElement *tenla1= outliner_add_element(soops, &ten->subtree, ob, ten, TSE_CONSTRAINT_BASE, 0); + TreeElement *tenla1= outliner_add_element(soops, &ten->subtree, ob, ten, TSE_CONSTRAINT_BASE, 0, NULL); //char *str; tenla1->name= "Constraints"; for(con= pchan->constraints.first; con; con= con->next, const_index++) { - ten1= outliner_add_element(soops, &tenla1->subtree, ob, tenla1, TSE_CONSTRAINT, const_index); +#if 0 /* disable because constraints recoded */ + target= get_constraint_target(con, &str); + if (filter) { + if (str && oo_fnmatch(filter, str, 0)) + continue; + else if (target && oo_fnmatch(filter, target->id.name+2, 0)) + continue; + else if (oo_fnmatch(filter, con->name, 0)) + continue; + } +#endif + if (filter && oo_fnmatch(filter, con->name, 0)) + continue; + + ten1= outliner_add_element(soops, &tenla1->subtree, ob, tenla1, TSE_CONSTRAINT, const_index, NULL); #if 0 /* disabled as it needs to be reworked for recoded constraints system */ - target= get_constraint_target(con, &str); if(str && str[0]) ten1->name= str; else if(target) ten1->name= target->id.name+2; else ten1->name= con->name; @@ -619,22 +667,26 @@ /* possible add all other types links? */ } } + a++; } - /* make hierarchy */ - ten= tenla->subtree.first; - while(ten) { - TreeElement *nten= ten->next, *par; - tselem= TREESTORE(ten); - if(tselem->type==TSE_POSE_CHANNEL) { - pchan= (bPoseChannel *)ten->directdata; - if(pchan->parent) { - BLI_remlink(&tenla->subtree, ten); - par= (TreeElement *)pchan->parent->prev; - BLI_addtail(&par->subtree, ten); - ten->parent= par; + /* Only build the hierarchy if we don't have filter */ + if(!filter) { + /* make hierarchy */ + ten= tenla->subtree.first; + while(ten) { + TreeElement *nten= ten->next, *par; + tselem= TREESTORE(ten); + if(tselem->type==TSE_POSE_CHANNEL) { + pchan= (bPoseChannel *)ten->directdata; + if(pchan->parent) { + BLI_remlink(&tenla->subtree, ten); + par= (TreeElement *)pchan->parent->prev; + BLI_addtail(&par->subtree, ten); + ten->parent= par; + } } + ten= nten; } - ten= nten; } /* restore prev pointers */ pchan= ob->pose->chanbase.first; @@ -648,35 +700,51 @@ if(ob->pose->agroups.first) { bActionGroup *agrp; TreeElement *ten; - TreeElement *tenla= outliner_add_element(soops, &te->subtree, ob, te, TSE_POSEGRP_BASE, 0); + TreeElement *tenla= outliner_add_element(soops, &te->subtree, ob, te, TSE_POSEGRP_BASE, 0, NULL); int a= 0; tenla->name= "Bone Groups"; for (agrp=ob->pose->agroups.first; agrp; agrp=agrp->next, a++) { - ten= outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_POSEGRP, a); + if (filter && oo_fnmatch(filter, agrp->name, 0)) + continue; + ten= outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_POSEGRP, a, NULL); ten->name= agrp->name; ten->directdata= agrp; } } } - outliner_add_element(soops, &te->subtree, ob->ipo, te, 0, 0); - outliner_add_element(soops, &te->subtree, ob->action, te, 0, 0); + outliner_add_element(soops, &te->subtree, ob->ipo, te, 0, 0, filter); + outliner_add_element(soops, &te->subtree, ob->action, te, 0, 0, filter); for(a=0; atotcol; a++) - outliner_add_element(soops, &te->subtree, ob->mat[a], te, 0, a); + outliner_add_element(soops, &te->subtree, ob->mat[a], te, 0, a, filter); if(ob->constraints.first) { //Object *target; bConstraint *con; TreeElement *ten; - TreeElement *tenla= outliner_add_element(soops, &te->subtree, ob, te, TSE_CONSTRAINT_BASE, 0); + TreeElement *tenla= outliner_add_element(soops, &te->subtree, ob, te, TSE_CONSTRAINT_BASE, 0, NULL); int a= 0; //char *str; tenla->name= "Constraints"; for(con= ob->constraints.first; con; con= con->next, a++) { - ten= outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_CONSTRAINT, a); +#if 0 /* disable because the constraints recode. */ + target= get_constraint_target(con, &str); + if (filter) { + if (str && oo_fnmatch(filter, str, 0)) + continue; + else if (target && oo_fnmatch(filter, target->id.name+2, 0)) + continue; + else if (oo_fnmatch(filter, con->name, 0)) + continue; + } +#endif + if (filter && oo_fnmatch(filter, con->name, 0)) + continue; + + ten= outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_CONSTRAINT, a, NULL); #if 0 /* disabled due to constraints system targets recode... code here needs review */ target= get_constraint_target(con, &str); if(str && str[0]) ten->name= str; @@ -691,60 +759,65 @@ if(ob->modifiers.first) { ModifierData *md; - TreeElement *temod = outliner_add_element(soops, &te->subtree, ob, te, TSE_MODIFIER_BASE, 0); + TreeElement *temod = outliner_add_element(soops, &te->subtree, ob, te, TSE_MODIFIER_BASE, 0, NULL); int index; temod->name = "Modifiers"; - for (index=0,md=ob->modifiers.first; md; index++,md=md->next) { - TreeElement *te = outliner_add_element(soops, &temod->subtree, ob, temod, TSE_MODIFIER, index); + for (index=0,md=ob->modifiers.first; md; md=md->next) { + if((filter) && (oo_fnmatch (filter, md->name, 0))) + continue; + TreeElement *te = outliner_add_element(soops, &temod->subtree, ob, temod, TSE_MODIFIER, index, NULL); te->name= md->name; if (md->type==eModifierType_Lattice) { - outliner_add_element(soops, &te->subtree, ((LatticeModifierData*) md)->object, te, TSE_LINKED_OB, 0); + outliner_add_element(soops, &te->subtree, ((LatticeModifierData*) md)->object, te, TSE_LINKED_OB, 0, NULL); } else if (md->type==eModifierType_Curve) { - outliner_add_element(soops, &te->subtree, ((CurveModifierData*) md)->object, te, TSE_LINKED_OB, 0); + outliner_add_element(soops, &te->subtree, ((CurveModifierData*) md)->object, te, TSE_LINKED_OB, 0, NULL); } else if (md->type==eModifierType_Armature) { - outliner_add_element(soops, &te->subtree, ((ArmatureModifierData*) md)->object, te, TSE_LINKED_OB, 0); + outliner_add_element(soops, &te->subtree, ((ArmatureModifierData*) md)->object, te, TSE_LINKED_OB, 0, NULL); } else if (md->type==eModifierType_Hook) { - outliner_add_element(soops, &te->subtree, ((HookModifierData*) md)->object, te, TSE_LINKED_OB, 0); + outliner_add_element(soops, &te->subtree, ((HookModifierData*) md)->object, te, TSE_LINKED_OB, 0, NULL); } + index++; } } if(ob->defbase.first) { bDeformGroup *defgroup; TreeElement *ten; - TreeElement *tenla= outliner_add_element(soops, &te->subtree, ob, te, TSE_DEFGROUP_BASE, 0); + TreeElement *tenla= outliner_add_element(soops, &te->subtree, ob, te, TSE_DEFGROUP_BASE, 0, NULL); int a= 0; tenla->name= "Vertex Groups"; for (defgroup=ob->defbase.first; defgroup; defgroup=defgroup->next, a++) { - ten= outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_DEFGROUP, a); + if(filter && oo_fnmatch(filter, defgroup->name, 0)) + continue; + ten= outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_DEFGROUP, a, NULL); ten->name= defgroup->name; ten->directdata= defgroup; } } if(ob->scriptlink.scripts) { - TreeElement *tenla= outliner_add_element(soops, &te->subtree, ob, te, TSE_SCRIPT_BASE, 0); + TreeElement *tenla= outliner_add_element(soops, &te->subtree, ob, te, TSE_SCRIPT_BASE, 0, NULL); int a= 0; tenla->name= "Scripts"; for (a=0; ascriptlink.totscript; a++) { /* ** */ - outliner_add_element(soops, &tenla->subtree, ob->scriptlink.scripts[a], te, 0, 0); + outliner_add_element(soops, &tenla->subtree, ob->scriptlink.scripts[a], te, 0, 0, NULL); } } if(ob->dup_group) - outliner_add_element(soops, &te->subtree, ob->dup_group, te, 0, 0); + outliner_add_element(soops, &te->subtree, ob->dup_group, te, 0, 0, NULL); if(ob->nlastrips.first) { bActionStrip *strip; TreeElement *ten; - TreeElement *tenla= outliner_add_element(soops, &te->subtree, ob, te, TSE_NLA, 0); + TreeElement *tenla= outliner_add_element(soops, &te->subtree, ob, te, TSE_NLA, 0, NULL); int a= 0; tenla->name= "NLA strips"; for (strip=ob->nlastrips.first; strip; strip=strip->next, a++) { - ten= outliner_add_element(soops, &tenla->subtree, strip->act, tenla, TSE_NLA_ACTION, a); + ten= outliner_add_element(soops, &tenla->subtree, strip->act, tenla, TSE_NLA_ACTION, a, NULL); if(ten) ten->directdata= strip; } } @@ -754,10 +827,10 @@ case ID_ME: { Mesh *me= (Mesh *)id; - outliner_add_element(soops, &te->subtree, me->ipo, te, 0, 0); - outliner_add_element(soops, &te->subtree, me->key, te, 0, 0); + outliner_add_element(soops, &te->subtree, me->ipo, te, 0, 0, NULL); + outliner_add_element(soops, &te->subtree, me->key, te, 0, 0, NULL); for(a=0; atotcol; a++) - outliner_add_element(soops, &te->subtree, me->mat[a], te, 0, a); + outliner_add_element(soops, &te->subtree, me->mat[a], te, 0, a, NULL); /* could do tfaces with image links, but the images are not grouped nicely. would require going over all tfaces, sort images in use. etc... */ } @@ -766,23 +839,23 @@ { Curve *cu= (Curve *)id; for(a=0; atotcol; a++) - outliner_add_element(soops, &te->subtree, cu->mat[a], te, 0, a); + outliner_add_element(soops, &te->subtree, cu->mat[a], te, 0, a, NULL); } break; case ID_MB: { MetaBall *mb= (MetaBall *)id; for(a=0; atotcol; a++) - outliner_add_element(soops, &te->subtree, mb->mat[a], te, 0, a); + outliner_add_element(soops, &te->subtree, mb->mat[a], te, 0, a, NULL); } break; case ID_MA: { Material *ma= (Material *)id; - outliner_add_element(soops, &te->subtree, ma->ipo, te, 0, 0); + outliner_add_element(soops, &te->subtree, ma->ipo, te, 0, 0, NULL); for(a=0; amtex[a]) outliner_add_element(soops, &te->subtree, ma->mtex[a]->tex, te, 0, a); + if(ma->mtex[a]) outliner_add_element(soops, &te->subtree, ma->mtex[a]->tex, te, 0, a, NULL); } } break; @@ -790,38 +863,38 @@ { Tex *tex= (Tex *)id; - outliner_add_element(soops, &te->subtree, tex->ipo, te, 0, 0); - outliner_add_element(soops, &te->subtree, tex->ima, te, 0, 0); + outliner_add_element(soops, &te->subtree, tex->ipo, te, 0, 0, NULL); + outliner_add_element(soops, &te->subtree, tex->ima, te, 0, 0, NULL); } break; case ID_CA: { Camera *ca= (Camera *)id; - outliner_add_element(soops, &te->subtree, ca->ipo, te, 0, 0); + outliner_add_element(soops, &te->subtree, ca->ipo, te, 0, 0, NULL); } break; case ID_LA: { Lamp *la= (Lamp *)id; - outliner_add_element(soops, &te->subtree, la->ipo, te, 0, 0); + outliner_add_element(soops, &te->subtree, la->ipo, te, 0, 0, NULL); for(a=0; amtex[a]) outliner_add_element(soops, &te->subtree, la->mtex[a]->tex, te, 0, a); + if(la->mtex[a]) outliner_add_element(soops, &te->subtree, la->mtex[a]->tex, te, 0, a, NULL); } } break; case ID_WO: { World *wrld= (World *)id; - outliner_add_element(soops, &te->subtree, wrld->ipo, te, 0, 0); + outliner_add_element(soops, &te->subtree, wrld->ipo, te, 0, 0, NULL); for(a=0; amtex[a]) outliner_add_element(soops, &te->subtree, wrld->mtex[a]->tex, te, 0, a); + if(wrld->mtex[a]) outliner_add_element(soops, &te->subtree, wrld->mtex[a]->tex, te, 0, a, NULL); } } break; case ID_KE: { Key *key= (Key *)id; - outliner_add_element(soops, &te->subtree, key->ipo, te, 0, 0); + outliner_add_element(soops, &te->subtree, key->ipo, te, 0, 0, NULL); } break; case ID_IP: @@ -833,7 +906,7 @@ for (icu= ipo->curve.first; icu; icu= icu->next) { if (icu->driver && icu->driver->ob) { if (lastadded != icu->driver->ob) { - outliner_add_element(soops, &te->subtree, icu->driver->ob, te, TSE_LINKED_OB, 0); + outliner_add_element(soops, &te->subtree, icu->driver->ob, te, TSE_LINKED_OB, 0, NULL); lastadded= icu->driver->ob; } } @@ -848,7 +921,7 @@ tselem= TREESTORE(parent); for (chan=act->chanbase.first; chan; chan=chan->next, a++) { - outliner_add_element(soops, &te->subtree, chan->ipo, te, 0, a); + outliner_add_element(soops, &te->subtree, chan->ipo, te, 0, a, NULL); } } break; @@ -861,24 +934,29 @@ EditBone *ebone; TreeElement *ten; - for (ebone = G.edbo.first; ebone; ebone=ebone->next, a++) { - ten= outliner_add_element(soops, &te->subtree, id, te, TSE_EBONE, a); + for (ebone = G.edbo.first; ebone; ebone=ebone->next) { + if(filter && oo_fnmatch(filter, ebone->name, 0)) + continue; + ten= outliner_add_element(soops, &te->subtree, id, te, TSE_EBONE, a, NULL); ten->directdata= ebone; ten->name= ebone->name; ebone->temp= ten; + a++; } - /* make hierarchy */ - ten= te->subtree.first; - while(ten) { - TreeElement *nten= ten->next, *par; - ebone= (EditBone *)ten->directdata; - if(ebone->parent) { - BLI_remlink(&te->subtree, ten); - par= ebone->parent->temp; - BLI_addtail(&par->subtree, ten); - ten->parent= par; + if(!filter) { + /* make hierarchy */ + ten= te->subtree.first; + while(ten) { + TreeElement *nten= ten->next, *par; + ebone= (EditBone *)ten->directdata; + if(ebone->parent) { + BLI_remlink(&te->subtree, ten); + par= ebone->parent->temp; + BLI_addtail(&par->subtree, ten); + ten->parent= par; + } + ten= nten; } - ten= nten; } } else { @@ -926,7 +1004,7 @@ while(vlink) { child_node = vlink->target; if(child_node && child_node->type==V_NT_GEOMETRY) { - ten = outliner_add_element(soops, &te->subtree, child_node, te, ID_VN, 0); + ten = outliner_add_element(soops, &te->subtree, child_node, te, ID_VN, 0, NULL); ten->directdata = child_node; } vlink = vlink->next; @@ -962,11 +1040,14 @@ } } +/* prototype see the function below. */ +static TreeElement *outliner_find_id(SpaceOops *soops, ListBase *lb, ID *id); + static void outliner_build_tree(SpaceOops *soops) { Base *base; Object *ob; - TreeElement *te, *ten; + TreeElement *te = NULL, *ten; TreeStoreElem *tselem; int show_opened= soops->treestore==NULL; /* on first view, we open scenes */ #ifdef WITH_VERSE @@ -984,11 +1065,22 @@ /* options */ if(soops->outlinevis == SO_LIBRARIES) { - Library *lib; + Library *lib, *plib; for(lib= G.main->library.first; lib; lib= lib->id.next) { - ten= outliner_add_element(soops, &soops->tree, lib, NULL, 0, 0); - lib->id.newid= (ID *)ten; + if(!oo_fnmatch(soops->outliner_filter, lib->name, 0)) { + /* need all parent library for hierachy. */ + plib= lib->parent; + while(plib) { + if(!outliner_find_id(soops, &soops->tree, (ID*)plib)) { + ten= outliner_add_element(soops, &soops->tree, plib, NULL, 0, 0, NULL); + plib->id.newid= (ID*)ten; + } + plib= plib->parent; + } + ten= outliner_add_element(soops, &soops->tree, lib, NULL, 0, 0, NULL); + lib->id.newid= (ID*)ten; + } } /* make hierarchy */ ten= soops->tree.first; @@ -1012,13 +1104,16 @@ else if(soops->outlinevis == SO_ALL_SCENES) { Scene *sce; for(sce= G.main->scene.first; sce; sce= sce->id.next) { - te= outliner_add_element(soops, &soops->tree, sce, NULL, 0, 0); + te= outliner_add_element(soops, &soops->tree, sce, NULL, 0, 0, NULL); tselem= TREESTORE(te); if(sce==G.scene && show_opened) tselem->flag &= ~TSE_CLOSED; for(base= sce->base.first; base; base= base->next) { - ten= outliner_add_element(soops, &te->subtree, base->object, te, 0, 0); + if(oo_fnmatch(soops->outliner_filter, base->object->id.name+2, 0)) + continue; + + ten= outliner_add_element(soops, &te->subtree, base->object, te, 0, 0, NULL); ten->directdata= base; } outliner_make_hierarchy(soops, &te->subtree); @@ -1031,32 +1126,47 @@ outliner_add_scene_contents(soops, &soops->tree, G.scene, NULL); for(base= G.scene->base.first; base; base= base->next) { - ten= outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0); + if(oo_fnmatch(soops->outliner_filter, base->object->id.name+2, 0)) + continue; + + ten= outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0, NULL); ten->directdata= base; } outliner_make_hierarchy(soops, &soops->tree); } else if(soops->outlinevis == SO_VISIBLE) { for(base= G.scene->base.first; base; base= base->next) { + if(oo_fnmatch(soops->outliner_filter, base->object->id.name+2, 0)) + continue; + if(base->lay & G.scene->lay) - outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0); + outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0, NULL); } outliner_make_hierarchy(soops, &soops->tree); } else if(soops->outlinevis == SO_GROUPS) { Group *group; GroupObject *go; + int found; for(group= G.main->group.first; group; group= group->id.next) { + found= 0; if(group->id.us) { - te= outliner_add_element(soops, &soops->tree, group, NULL, 0, 0); - tselem= TREESTORE(te); - for(go= group->gobject.first; go; go= go->next) { - ten= outliner_add_element(soops, &te->subtree, go->ob, te, 0, 0); + if(oo_fnmatch(soops->outliner_filter, go->ob->id.name+2, 0)) + continue; + + if(!found) { + te= outliner_add_element(soops, &soops->tree, group, NULL, 0, 0, NULL); + tselem= TREESTORE(te); + found= 1; + } + + ten= outliner_add_element(soops, &te->subtree, go->ob, te, 0, 0, NULL); ten->directdata= NULL; /* eh, why? */ } - outliner_make_hierarchy(soops, &te->subtree); + if(te) + outliner_make_hierarchy(soops, &te->subtree); /* clear id.newid, to prevent objects be inserted in wrong scenes (parent in other scene) */ for(go= group->gobject.first; go; go= go->next) go->ob->id.newid= NULL; } @@ -1066,8 +1176,11 @@ Object *ob= OBACT; if(ob) { for(base= G.scene->base.first; base; base= base->next) { + if(oo_fnmatch(soops->outliner_filter, base->object->id.name+2, 0)) + continue; + if(base->object->type==ob->type) { - ten= outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0); + ten= outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0, NULL); ten->directdata= base; } } @@ -1078,7 +1191,7 @@ for(base= G.scene->base.first; base; base= base->next) { if(base->lay & G.scene->lay) { if(base==BASACT || (base->flag & SELECT)) { - ten= outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0); + ten= outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0, soops->outliner_filter); ten->directdata= base; } } @@ -1091,15 +1204,15 @@ for(session=session_list.first; session; session = session->next) { struct VNode *vnode; if(session->flag & VERSE_CONNECTED) { - te= outliner_add_element(soops, &soops->tree, session, NULL, ID_VS, 0); + te= outliner_add_element(soops, &soops->tree, session, NULL, ID_VS, 0, NULL); /* add all object nodes as childreen of session */ for(vnode=session->nodes.lb.first; vnode; vnode=vnode->next) { if(vnode->type==V_NT_OBJECT) { - ten= outliner_add_element(soops, &te->subtree, vnode, te, ID_VN, 0); + ten= outliner_add_element(soops, &te->subtree, vnode, te, ID_VN, 0, NULL); ten->directdata= vnode; } else if(vnode->type==V_NT_BITMAP) { - ten= outliner_add_element(soops, &te->subtree, vnode, te, ID_VN, 0); + ten= outliner_add_element(soops, &te->subtree, vnode, te, ID_VN, 0, NULL); ten->directdata= vnode; } } @@ -1107,19 +1220,19 @@ } } else if(soops->outlinevis == SO_VERSE_MS) { - te= outliner_add_element(soops, &soops->tree, "MS", NULL, ID_MS, 0); + te= outliner_add_element(soops, &soops->tree, "MS", NULL, ID_MS, 0, NULL); if(server_list.first!=NULL) { struct VerseServer *server; /* add one main entry to root of hierarchy */ for(server=server_list.first; server; server=server->next) { - ten= outliner_add_element(soops, &te->subtree, server, te, ID_SS, 0); + ten= outliner_add_element(soops, &te->subtree, server, te, ID_SS, 0, NULL); ten->directdata= server; } } } #endif else { - ten= outliner_add_element(soops, &soops->tree, OBACT, NULL, 0, 0); + ten= outliner_add_element(soops, &soops->tree, OBACT, NULL, 0, 0, soops->outliner_filter); if(ten) ten->directdata= BASACT; }