diff options
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_intern.h')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_intern.h | 158 |
1 files changed, 131 insertions, 27 deletions
diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h index ca7dbe4f73c..148af52050d 100644 --- a/source/blender/editors/space_outliner/outliner_intern.h +++ b/source/blender/editors/space_outliner/outliner_intern.h @@ -36,14 +36,56 @@ /* internal exports only */ +struct ARegion; +struct ListBase; struct wmOperatorType; +struct TreeElement; struct TreeStoreElem; +struct Main; struct bContext; struct Scene; +struct ViewLayer; struct ID; struct Object; struct bPoseChannel; struct EditBone; +struct wmEvent; +struct wmKeyConfig; +struct EvaluationContext; + +typedef enum TreeElementInsertType { + TE_INSERT_BEFORE, + TE_INSERT_AFTER, + TE_INSERT_INTO, +} TreeElementInsertType; + +typedef enum TreeTraversalAction { + /* Continue traversal regularly, don't skip children. */ + TRAVERSE_CONTINUE = 0, + /* Stop traversal */ + TRAVERSE_BREAK, + /* Continue traversal, but skip childs of traversed element */ + TRAVERSE_SKIP_CHILDS, +} TreeTraversalAction; + +/** + * Callback type for reinserting elements at a different position, used to allow user customizable element order. + */ +typedef void (*TreeElementReinsertFunc)(struct Main *bmain, + struct SpaceOops *soops, + struct TreeElement *insert_element, + struct TreeElement *insert_handle, + TreeElementInsertType action, + const struct wmEvent *event); +/** + * Executed on (almost) each mouse move while dragging. It's supposed to give info + * if reinserting insert_element before/after/into insert_handle would be allowed. + * It's allowed to change the reinsert info here for non const pointers. + */ +typedef bool (*TreeElementReinsertPollFunc)(const struct TreeElement *insert_element, + struct TreeElement **io_insert_handle, TreeElementInsertType *io_action); +typedef TreeTraversalAction (*TreeTraversalFunc)(struct TreeElement *te, void *customdata); + typedef struct TreeElement { struct TreeElement *next, *prev, *parent; @@ -57,18 +99,33 @@ typedef struct TreeElement { const char *name; void *directdata; // Armature Bones, Base, Sequence, Strip... PointerRNA rnaptr; // RNA Pointer -} TreeElement; + + /* callbacks - TODO should be moved into a type (like TreeElementType) */ + TreeElementReinsertFunc reinsert; + TreeElementReinsertPollFunc reinsert_poll; + + struct { + TreeElementInsertType insert_type; + /* the element before/after/into which we may insert the dragged one (NULL to insert at top) */ + struct TreeElement *insert_handle; + void *tooltip_draw_handle; + } *drag_data; +} TreeElement; #define TREESTORE_ID_TYPE(_id) \ (ELEM(GS((_id)->name), ID_SCE, ID_LI, ID_OB, ID_ME, ID_CU, ID_MB, ID_NT, ID_MA, ID_TE, ID_IM, ID_LT, ID_LA, ID_CA) || \ - ELEM(GS((_id)->name), ID_KE, ID_WO, ID_SPK, ID_GR, ID_AR, ID_AC, ID_BR, ID_PA, ID_GD, ID_LS) || \ - ELEM(GS((_id)->name), ID_SCR, ID_WM, ID_TXT, ID_VF, ID_SO, ID_CF, ID_PAL)) /* Only in 'blendfile' mode ... :/ */ + ELEM(GS((_id)->name), ID_KE, ID_WO, ID_SPK, ID_GR, ID_AR, ID_AC, ID_BR, ID_PA, ID_GD, ID_LS, ID_LP) || \ + ELEM(GS((_id)->name), ID_SCR, ID_WM, ID_TXT, ID_VF, ID_SO, ID_CF, ID_PAL, ID_WS)) /* Only in 'blendfile' mode ... :/ */ /* TreeElement->flag */ -#define TE_ACTIVE 1 -#define TE_ICONROW 2 -#define TE_LAZY_CLOSED 4 -#define TE_FREE_NAME 8 +enum { + TE_ACTIVE = (1 << 0), + /* Closed items display their children as icon within the row. TE_ICONROW is for + * these child-items that are visible but only within the row of the closed parent. */ + TE_ICONROW = (1 << 1), + TE_LAZY_CLOSED = (1 << 2), + TE_FREE_NAME = (1 << 3), +}; /* button events */ #define OL_NAMEBUTTON 1 @@ -103,6 +160,9 @@ typedef enum { #define OL_RNA_COL_SIZEX (UI_UNIT_X * 7.5f) #define OL_RNA_COL_SPACEX (UI_UNIT_X * 2.5f) +/* The outliner display modes that support the filter system. + * Note: keep it synced with space_outliner.py */ +#define SUPPORT_FILTER_OUTLINER(soops_) ELEM((soops_)->outlinevis, SO_VIEW_LAYER, SO_COLLECTIONS) /* Outliner Searching -- * @@ -120,24 +180,28 @@ typedef enum { * - not searching into RNA items helps but isn't the complete solution */ -#define SEARCHING_OUTLINER(sov) (sov->search_flags & SO_SEARCH_RECURSIVE) +#define SEARCHING_OUTLINER(sov) ((sov->search_flags & SO_SEARCH_RECURSIVE) && (sov->filter & SO_FILTER_SEARCH)) /* 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); +void outliner_free_tree(ListBase *tree); void outliner_cleanup_tree(struct SpaceOops *soops); +void outliner_free_tree_element(TreeElement *element, ListBase *parent_subtree); +void outliner_remove_treestore_element(struct SpaceOops *soops, TreeStoreElem *tselem); -TreeElement *outliner_find_tse(struct SpaceOops *soops, const TreeStoreElem *tse); -TreeElement *outliner_find_tree_element(ListBase *lb, const TreeStoreElem *store_elem); -TreeElement *outliner_find_id(struct SpaceOops *soops, ListBase *lb, const struct ID *id); -TreeElement *outliner_find_posechannel(ListBase *lb, const struct bPoseChannel *pchan); -TreeElement *outliner_find_editbone(ListBase *lb, const struct EditBone *ebone); -struct ID *outliner_search_back(SpaceOops *soops, TreeElement *te, short idcode); +void outliner_build_tree( + struct Main *mainvar, const struct EvaluationContext *eval_ctx, + struct Scene *scene, struct ViewLayer *view_layer, + struct SpaceOops *soops, struct ARegion *ar); + +typedef struct ObjectsSelectedData { + struct ListBase objects_selected_array; +} ObjectsSelectedData; -void outliner_build_tree(struct Main *mainvar, struct Scene *scene, struct SpaceOops *soops); +TreeTraversalAction outliner_find_selected_objects(struct TreeElement *te, void *customdata); /* outliner_draw.c ---------------------------------------------- */ @@ -146,9 +210,9 @@ void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag); /* outliner_select.c -------------------------------------------- */ eOLDrawState tree_element_type_active( - struct bContext *C, struct Scene *scene, struct SpaceOops *soops, + struct bContext *C, struct Scene *scene, struct ViewLayer *view_layer, struct SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem, const eOLSetState set, bool recursive); -eOLDrawState tree_element_active(struct bContext *C, struct Scene *scene, SpaceOops *soops, +eOLDrawState tree_element_active(struct bContext *C, struct Scene *scene, struct ViewLayer *view_layer, SpaceOops *soops, TreeElement *te, const eOLSetState set, const bool handle_all_types); void outliner_item_do_activate_from_tree_element( @@ -158,22 +222,26 @@ int outliner_item_do_activate_from_cursor( struct bContext *C, const int mval[2], bool extend, bool recursive); +void outliner_item_select( + struct SpaceOops *soops, const struct TreeElement *te, + const bool extend, const bool toggle); + /* outliner_edit.c ---------------------------------------------- */ typedef void (*outliner_operation_cb)( struct bContext *C, struct ReportList *, struct Scene *scene, struct TreeElement *, struct TreeStoreElem *, TreeStoreElem *, void *); void outliner_do_object_operation_ex( - struct bContext *C, ReportList *reports, struct Scene *scene, struct SpaceOops *soops, struct ListBase *lb, - outliner_operation_cb operation_cb, bool recurse_selected); + struct bContext *C, struct ReportList *reports, struct Scene *scene, struct SpaceOops *soops, + struct ListBase *lb, outliner_operation_cb operation_cb, bool recurse_selected); void outliner_do_object_operation( - struct bContext *C, ReportList *reports, struct Scene *scene, struct SpaceOops *soops, struct ListBase *lb, - outliner_operation_cb operation_cb); + struct bContext *C, struct ReportList *reports, struct Scene *scene, struct SpaceOops *soops, + struct ListBase *lb, outliner_operation_cb operation_cb); int common_restrict_check(struct bContext *C, struct Object *ob); int outliner_has_one_flag(ListBase *lb, short flag, const int curlevel); -void outliner_set_flag(ListBase *lb, short flag, short set); +bool outliner_set_flag(ListBase *lb, short flag, short set); void object_toggle_visibility_cb( struct bContext *C, struct ReportList *reports, struct Scene *scene, @@ -214,8 +282,13 @@ void id_remap_cb( struct TreeStoreElem *tsep, struct TreeStoreElem *tselem, void *user_data); TreeElement *outliner_dropzone_find(const struct SpaceOops *soops, const float fmval[2], const bool children); + +void outliner_set_coordinates(struct ARegion *ar, struct SpaceOops *soops); + /* ...................................................... */ +void OUTLINER_OT_highlight_update(struct wmOperatorType *ot); + void OUTLINER_OT_item_activate(struct wmOperatorType *ot); void OUTLINER_OT_item_openclose(struct wmOperatorType *ot); void OUTLINER_OT_item_rename(struct wmOperatorType *ot); @@ -235,10 +308,6 @@ void OUTLINER_OT_expanded_toggle(struct wmOperatorType *ot); void OUTLINER_OT_scroll_page(struct wmOperatorType *ot); -void OUTLINER_OT_renderability_toggle(struct wmOperatorType *ot); -void OUTLINER_OT_selectability_toggle(struct wmOperatorType *ot); -void OUTLINER_OT_visibility_toggle(struct wmOperatorType *ot); - void OUTLINER_OT_keyingset_add_selected(struct wmOperatorType *ot); void OUTLINER_OT_keyingset_remove_selected(struct wmOperatorType *ot); @@ -267,10 +336,45 @@ void OUTLINER_OT_animdata_operation(struct wmOperatorType *ot); void OUTLINER_OT_action_set(struct wmOperatorType *ot); void OUTLINER_OT_constraint_operation(struct wmOperatorType *ot); void OUTLINER_OT_modifier_operation(struct wmOperatorType *ot); +void OUTLINER_OT_collection_operation(struct wmOperatorType *ot); /* ---------------------------------------------------------------- */ /* outliner_ops.c */ void outliner_operatortypes(void); void outliner_keymap(struct wmKeyConfig *keyconf); +/* outliner_collections.c */ + +struct SceneCollection *outliner_scene_collection_from_tree_element(TreeElement *te); + +void OUTLINER_OT_collections_delete(struct wmOperatorType *ot); +void OUTLINER_OT_collection_select(struct wmOperatorType *ot); +void OUTLINER_OT_collection_toggle(struct wmOperatorType *ot); +void OUTLINER_OT_collection_link(struct wmOperatorType *ot); +void OUTLINER_OT_collection_unlink(struct wmOperatorType *ot); +void OUTLINER_OT_collection_new(struct wmOperatorType *ot); +void OUTLINER_OT_collection_duplicate(struct wmOperatorType *ot); +void OUTLINER_OT_collection_objects_remove(struct wmOperatorType *ot); +void OUTLINER_OT_collection_objects_select(struct wmOperatorType *ot); +void OUTLINER_OT_object_add_to_new_collection(struct wmOperatorType *ot); +void OUTLINER_OT_object_remove_from_collection(struct wmOperatorType *ot); + +void OUTLINER_OT_collection_objects_add(struct wmOperatorType *ot); +void OUTLINER_OT_collection_nested_new(struct wmOperatorType *ot); +void OUTLINER_OT_collection_delete_selected(struct wmOperatorType *ot); + +/* outliner_utils.c ---------------------------------------------- */ + +TreeElement *outliner_find_item_at_y(const SpaceOops *soops, const ListBase *tree, float view_co_y); +TreeElement *outliner_find_item_at_x_in_row(const SpaceOops *soops, const TreeElement *parent_te, float view_co_x); +TreeElement *outliner_find_tse(struct SpaceOops *soops, const TreeStoreElem *tse); +TreeElement *outliner_find_tree_element(ListBase *lb, const TreeStoreElem *store_elem); +TreeElement *outliner_find_id(struct SpaceOops *soops, ListBase *lb, const struct ID *id); +TreeElement *outliner_find_posechannel(ListBase *lb, const struct bPoseChannel *pchan); +TreeElement *outliner_find_editbone(ListBase *lb, const struct EditBone *ebone); +struct ID *outliner_search_back(SpaceOops *soops, TreeElement *te, short idcode); +bool outliner_tree_traverse(const SpaceOops *soops, ListBase *tree, int filter_te_flag, int filter_tselem_flag, + TreeTraversalFunc func, void *customdata); + + #endif /* __OUTLINER_INTERN_H__ */ |