diff options
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_tree.c')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_tree.c | 54 |
1 files changed, 37 insertions, 17 deletions
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; |