diff options
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_tree.c')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_tree.c | 67 |
1 files changed, 36 insertions, 31 deletions
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index bc272431e3a..e1d92c551c3 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -340,7 +340,7 @@ static void outliner_add_scene_contents(SpaceOutliner *soops, } } -// can be inlined if necessary +/* Can be inlined if necessary. */ static void outliner_add_object_contents(SpaceOutliner *soops, TreeElement *te, TreeStoreElem *tselem, @@ -351,7 +351,7 @@ static void outliner_add_object_contents(SpaceOutliner *soops, } outliner_add_element( - soops, &te->subtree, ob->poselib, te, 0, 0); // XXX FIXME.. add a special type for this + soops, &te->subtree, ob->poselib, te, 0, 0); /* XXX FIXME.. add a special type for this. */ if (ob->proxy && !ID_IS_LINKED(ob)) { outliner_add_element(soops, &te->subtree, ob->proxy, te, TSE_PROXY, 0); @@ -378,12 +378,12 @@ static void outliner_add_object_contents(SpaceOutliner *soops, pchan->temp = (void *)ten; if (pchan->constraints.first) { - // Object *target; + /* Object *target; */ bConstraint *con; TreeElement *ten1; TreeElement *tenla1 = outliner_add_element( soops, &ten->subtree, ob, ten, TSE_CONSTRAINT_BASE, 0); - // char *str; + /* char *str; */ tenla1->name = IFACE_("Constraints"); for (con = pchan->constraints.first; con; con = con->next, const_index++) { @@ -447,11 +447,11 @@ static void outliner_add_object_contents(SpaceOutliner *soops, } if (ob->constraints.first) { - // Object *target; + /* Object *target; */ bConstraint *con; TreeElement *ten; TreeElement *tenla = outliner_add_element(soops, &te->subtree, ob, te, TSE_CONSTRAINT_BASE, 0); - // char *str; + /* char *str; */ int a; tenla->name = IFACE_("Constraints"); @@ -535,7 +535,7 @@ static void outliner_add_object_contents(SpaceOutliner *soops, } } -// can be inlined if necessary +/* Can be inlined if necessary. */ static void outliner_add_id_contents(SpaceOutliner *soops, TreeElement *te, TreeStoreElem *tselem, @@ -677,8 +677,8 @@ static void outliner_add_id_contents(SpaceOutliner *soops, break; } case ID_AC: { - // XXX do we want to be exposing the F-Curves here? - // bAction *act = (bAction *)id; + /* XXX do we want to be exposing the F-Curves here? */ + /* bAction *act = (bAction *)id; */ break; } case ID_AR: { @@ -752,7 +752,7 @@ static void outliner_add_id_contents(SpaceOutliner *soops, outliner_add_element(soops, &te->subtree, gpd, te, TSE_ANIM_DATA, 0); } - // TODO: base element for layers? + /* TODO: base element for layers? */ for (gpl = gpd->layers.last; gpl; gpl = gpl->prev) { outliner_add_element(soops, &te->subtree, gpl, te, TSE_GP_LAYER, a); a++; @@ -769,20 +769,23 @@ static void outliner_add_id_contents(SpaceOutliner *soops, } case ID_HA: { Hair *hair = (Hair *)id; - if (outliner_animdata_test(hair->adt)) + if (outliner_animdata_test(hair->adt)) { outliner_add_element(soops, &te->subtree, hair, te, TSE_ANIM_DATA, 0); + } break; } case ID_PT: { PointCloud *pointcloud = (PointCloud *)id; - if (outliner_animdata_test(pointcloud->adt)) + if (outliner_animdata_test(pointcloud->adt)) { outliner_add_element(soops, &te->subtree, pointcloud, te, TSE_ANIM_DATA, 0); + } break; } case ID_VO: { Volume *volume = (Volume *)id; - if (outliner_animdata_test(volume->adt)) + if (outliner_animdata_test(volume->adt)) { outliner_add_element(soops, &te->subtree, volume, te, TSE_ANIM_DATA, 0); + } break; } case ID_SIM: { @@ -848,7 +851,7 @@ static TreeElement *outliner_add_element( } te->parent = parent; - te->index = index; // for data arrays + te->index = index; /* For data arrays. */ if (ELEM(type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP)) { /* pass */ } @@ -873,7 +876,7 @@ static TreeElement *outliner_add_element( te->name = ((Library *)id)->filepath; } else { - te->name = id->name + 2; // default, can be overridden by Library or non-ID data + te->name = id->name + 2; /* Default, can be overridden by Library or non-ID data. */ } te->idcode = GS(id->name); } @@ -914,7 +917,7 @@ static TreeElement *outliner_add_element( /* loop over all targets used here */ DRIVER_TARGETS_USED_LOOPER_BEGIN (dvar) { if (lastadded != dtar->id) { - // XXX this lastadded check is rather lame, and also fails quite badly... + /* XXX this lastadded check is rather lame, and also fails quite badly... */ outliner_add_element(soops, &ted->subtree, dtar->id, ted, TSE_LINKED_OB, 0); lastadded = dtar->id; } @@ -1526,7 +1529,7 @@ static void outliner_make_object_parent_hierarchy(ListBase *lb) TreeStoreElem *tselem; /* build hierarchy */ - // XXX also, set extents here... + /* XXX also, set extents here... */ te = lb->first; while (te) { ten = te->next; @@ -1666,10 +1669,10 @@ static int treesort_alpha_ob(const void *v1, const void *v2) if (comp == 1) { return 1; } - else if (comp == 2) { + if (comp == 2) { return -1; } - else if (comp == 3) { + if (comp == 3) { /* Among objects first come the ones in the collection, followed by the ones not on it. * This way we can have the dashed lines in a separate style connecting the former. */ if ((x1->te->flag & TE_CHILD_NOT_IN_COLLECTION) != @@ -1682,7 +1685,7 @@ static int treesort_alpha_ob(const void *v1, const void *v2) if (comp > 0) { return 1; } - else if (comp < 0) { + if (comp < 0) { return -1; } return 0; @@ -1714,7 +1717,7 @@ static int treesort_alpha(const void *v1, const void *v2) if (comp > 0) { return 1; } - else if (comp < 0) { + if (comp < 0) { return -1; } return 0; @@ -1790,10 +1793,10 @@ static void outliner_sort(ListBase *lb) tp->idcode = te->idcode; if (tselem->type && tselem->type != TSE_DEFGROUP) { - tp->idcode = 0; // don't sort this + tp->idcode = 0; /* Don't sort this. */ } if (tselem->type == TSE_ID_BASE) { - tp->idcode = 1; // do sort this + tp->idcode = 1; /* Do sort this. */ } tp->id = tselem->id; @@ -1981,9 +1984,7 @@ static TreeElement *outliner_find_first_desired_element_at_y(const SpaceOutliner if (te->ys + UI_UNIT_Y > view_co_limit) { return te_sub; } - else { - return NULL; - } + return NULL; } if (te->next) { @@ -2191,7 +2192,9 @@ static bool outliner_element_is_collection_or_object(TreeElement *te) if ((tselem->type == 0) && (te->idcode == ID_OB)) { return true; } - else if (outliner_is_collection_tree_element(te)) { + + /* Collection instance datablocks should not be extracted. */ + if (outliner_is_collection_tree_element(te) && !(te->parent && te->parent->idcode == ID_OB)) { return true; } @@ -2241,7 +2244,7 @@ static int outliner_filter_subtree(SpaceOutliner *soops, te_next = outliner_extract_children_from_subtree(te, lb); continue; } - else if ((exclude_filter & SO_FILTER_SEARCH) == 0) { + if ((exclude_filter & SO_FILTER_SEARCH) == 0) { /* Filter subtree too. */ outliner_filter_subtree(soops, view_layer, &te->subtree, search_string, exclude_filter); continue; @@ -2306,8 +2309,8 @@ static void outliner_filter_tree(SpaceOutliner *soops, ViewLayer *view_layer) /* ======================================================= */ /* Main Tree Building API */ -/* Main entry point for building the tree data-structure that the outliner represents */ -// TODO: split each mode into its own function? +/* Main entry point for building the tree data-structure that the outliner represents. */ +/* TODO: split each mode into its own function? */ void outliner_build_tree( Main *mainvar, Scene *scene, ViewLayer *view_layer, SpaceOutliner *soops, ARegion *region) { @@ -2458,7 +2461,9 @@ void outliner_build_tree( te_object->directdata = base; } - outliner_make_object_parent_hierarchy(&soops->tree); + if ((soops->filter & SO_FILTER_NO_CHILDREN) == 0) { + outliner_make_object_parent_hierarchy(&soops->tree); + } } else { /* Show collections in the view layer. */ |