From fc0dd5583c3132cde4208bc8944469a92a601c62 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Wed, 26 Jan 2022 16:24:59 +0100 Subject: Cleanup: Reduce `void *` reliance of new sequencer C++ Outliner elements Plan is to remove things like `TreeElement.directdata` and to instead expose specific queries in the new type specific tree-element classes. e.g. like here: `TreeElementSequence.getSequence()` For now uses `tree_element_cast<>()` to get the new type specific tree-element, later these should replace `TreeElement` all together. --- source/blender/editors/space_outliner/outliner_tools.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source/blender/editors/space_outliner/outliner_tools.cc') diff --git a/source/blender/editors/space_outliner/outliner_tools.cc b/source/blender/editors/space_outliner/outliner_tools.cc index 1c1a4f6f4c2..eae77d70ac2 100644 --- a/source/blender/editors/space_outliner/outliner_tools.cc +++ b/source/blender/editors/space_outliner/outliner_tools.cc @@ -96,9 +96,12 @@ #include "SEQ_sequencer.h" #include "outliner_intern.hh" +#include "tree/tree_element_seq.hh" static CLG_LogRef LOG = {"ed.outliner.tools"}; +using namespace blender::ed::outliner; + /* -------------------------------------------------------------------- */ /** \name ID/Library/Data Set/Un-link Utilities * \{ */ @@ -1285,7 +1288,8 @@ static void ebone_fn(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem), static void sequence_fn(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem), void *scene_ptr) { - Sequence *seq = (Sequence *)te->directdata; + TreeElementSequence *te_seq = tree_element_cast(te); + Sequence *seq = &te_seq->getSequence(); Scene *scene = (Scene *)scene_ptr; Editing *ed = SEQ_editing_get(scene); if (BLI_findindex(ed->seqbasep, seq) != -1) { -- cgit v1.2.3 From 7b615ca186cab53736fe656d894814c6f92de0e3 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Wed, 26 Jan 2022 19:11:34 +0100 Subject: Cleanup: Remove RNA data from TreeElement, get via type specific class The `TreeElement.rnaptr` was only needed for RNA tree-elements. Now it can be gotten through the new type specific classes, e.g. `TreeElementRNAProperty.getPointerRNA()`. --- source/blender/editors/space_outliner/outliner_tools.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'source/blender/editors/space_outliner/outliner_tools.cc') diff --git a/source/blender/editors/space_outliner/outliner_tools.cc b/source/blender/editors/space_outliner/outliner_tools.cc index eae77d70ac2..fa31025b550 100644 --- a/source/blender/editors/space_outliner/outliner_tools.cc +++ b/source/blender/editors/space_outliner/outliner_tools.cc @@ -96,6 +96,7 @@ #include "SEQ_sequencer.h" #include "outliner_intern.hh" +#include "tree/tree_element_rna.hh" #include "tree/tree_element_seq.hh" static CLG_LogRef LOG = {"ed.outliner.tools"}; @@ -1340,10 +1341,16 @@ static void data_select_linked_fn(int event, TreeStoreElem *UNUSED(tselem), void *C_v) { + const TreeElementRNAStruct *te_rna_struct = tree_element_cast(te); + if (!te_rna_struct) { + return; + } + if (event == OL_DOP_SELECT_LINKED) { - if (RNA_struct_is_ID(te->rnaptr.type)) { + const PointerRNA &ptr = te_rna_struct->getPointerRNA(); + if (RNA_struct_is_ID(ptr.type)) { bContext *C = (bContext *)C_v; - ID *id = reinterpret_cast(te->rnaptr.data); + ID *id = reinterpret_cast(ptr.data); ED_object_select_linked_by_id(C, id); } -- cgit v1.2.3