diff options
Diffstat (limited to 'source/blender/editors/space_outliner')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_collections.c | 105 |
1 files changed, 78 insertions, 27 deletions
diff --git a/source/blender/editors/space_outliner/outliner_collections.c b/source/blender/editors/space_outliner/outliner_collections.c index 8da085f436d..8563b7d8c24 100644 --- a/source/blender/editors/space_outliner/outliner_collections.c +++ b/source/blender/editors/space_outliner/outliner_collections.c @@ -53,6 +53,8 @@ #include "outliner_intern.h" /* own include */ /* -------------------------------------------------------------------- */ +/** \name Utility API + * \{ */ bool outliner_is_collection_tree_element(const TreeElement *te) { @@ -133,8 +135,30 @@ TreeTraversalAction outliner_find_selected_objects(TreeElement *te, void *custom return TRAVERSE_CONTINUE; } +/** + * Populates the \param objects: ListBase with all the outliner selected objects + * We store it as (Object *)LinkData->data + * \param objects: expected to be empty + */ +void ED_outliner_selected_objects_get(const bContext *C, ListBase *objects) +{ + SpaceOutliner *soops = CTX_wm_space_outliner(C); + struct IDsSelectedData data = {{NULL}}; + outliner_tree_traverse( + soops, &soops->tree, 0, TSE_SELECTED, outliner_find_selected_objects, &data); + LISTBASE_FOREACH (LinkData *, link, &data.selected_array) { + TreeElement *ten_selected = (TreeElement *)link->data; + Object *ob = (Object *)TREESTORE(ten_selected)->id; + BLI_addtail(objects, BLI_genericNodeN(ob)); + } + BLI_freelistN(&data.selected_array); +} + +/** \} */ + /* -------------------------------------------------------------------- */ -/* Poll functions. */ +/** \name Poll Functions + * \{ */ bool ED_outliner_collections_editor_poll(bContext *C) { @@ -148,7 +172,11 @@ static bool outliner_view_layer_collections_editor_poll(bContext *C) return (so != NULL) && (so->outlinevis == SO_VIEW_LAYER); } -/********************************* New Collection ****************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name New Collection + * \{ */ struct CollectionNewData { bool error; @@ -237,7 +265,11 @@ void OUTLINER_OT_collection_new(wmOperatorType *ot) RNA_def_property_flag(prop, PROP_SKIP_SAVE); } -/**************************** Delete Collection ******************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Delete Collection + * \{ */ struct CollectionEditData { Scene *scene; @@ -369,7 +401,11 @@ void OUTLINER_OT_collection_delete(wmOperatorType *ot) RNA_def_property_flag(prop, PROP_SKIP_SAVE); } -/****************************** Select Objects *******************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Select/Deselect Collection Objects + * \{ */ struct CollectionObjectsSelectData { bool error; @@ -457,7 +493,11 @@ void OUTLINER_OT_collection_objects_deselect(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } -/************************** Duplicate Collection *****************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Duplicate Collection + * \{ */ struct CollectionDuplicateData { TreeElement *te; @@ -578,7 +618,11 @@ void OUTLINER_OT_collection_duplicate(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } -/**************************** Link Collection ******************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Link Collection + * \{ */ static int collection_link_exec(bContext *C, wmOperator *op) { @@ -636,7 +680,11 @@ void OUTLINER_OT_collection_link(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } -/************************** Instance Collection ******************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Instance Collection + * \{ */ static int collection_instance_exec(bContext *C, wmOperator *UNUSED(op)) { @@ -703,7 +751,11 @@ void OUTLINER_OT_collection_instance(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } -/************************** Exclude Collection ******************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Exclude Collection + * \{ */ static TreeTraversalAction layer_collection_find_data_to_edit(TreeElement *te, void *customdata) { @@ -945,7 +997,11 @@ void OUTLINER_OT_collection_indirect_only_clear(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } -/************************** Visibility Operators ******************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Visibility for Collection Operators + * \{ */ static int collection_isolate_exec(bContext *C, wmOperator *op) { @@ -1129,6 +1185,12 @@ void OUTLINER_OT_collection_hide_inside(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Enable/Disable Collection Operators + * \{ */ + static bool collection_flag_poll(bContext *C, bool clear, int flag) { if (!ED_outliner_collections_editor_poll(C)) { @@ -1310,6 +1372,12 @@ struct OutlinerHideEditData { GSet *bases_to_edit; }; +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Visibility for Collection & Object Operators + * \{ */ + static TreeTraversalAction outliner_hide_find_data_to_edit(TreeElement *te, void *customdata) { struct OutlinerHideEditData *data = customdata; @@ -1433,21 +1501,4 @@ void OUTLINER_OT_unhide_all(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } -/** - * Populates the \param objects: ListBase with all the outliner selected objects - * We store it as (Object *)LinkData->data - * \param objects: expected to be empty - */ -void ED_outliner_selected_objects_get(const bContext *C, ListBase *objects) -{ - SpaceOutliner *soops = CTX_wm_space_outliner(C); - struct IDsSelectedData data = {{NULL}}; - outliner_tree_traverse( - soops, &soops->tree, 0, TSE_SELECTED, outliner_find_selected_objects, &data); - LISTBASE_FOREACH (LinkData *, link, &data.selected_array) { - TreeElement *ten_selected = (TreeElement *)link->data; - Object *ob = (Object *)TREESTORE(ten_selected)->id; - BLI_addtail(objects, BLI_genericNodeN(ob)); - } - BLI_freelistN(&data.selected_array); -} +/** \} */ |