Outliner: allow "Show Active" to center/scroll in Data API view
Unlike other Outliner views, this will not open up elements to find objects "underneath" (since Data API view lazy loads elements iirc), but given that you already have that object visible somewhere in the DataAPI view (so e.g. Objects expanded) we could actually do the centering/ scrolling by getting an ID from the `TreeElement` (in case of an `TSE_RNA_STRUCT`). This came up in #145904 Pull Request: https://projects.blender.org/blender/blender/pulls/145920
This commit is contained in:
committed by
Philipp Oeser
parent
e8bb5a6558
commit
be6b147d16
@@ -31,6 +31,7 @@
|
||||
|
||||
#include "outliner_intern.hh"
|
||||
#include "tree/tree_display.hh"
|
||||
#include "tree/tree_element_rna.hh"
|
||||
|
||||
namespace blender::ed::outliner {
|
||||
|
||||
@@ -195,6 +196,19 @@ TreeElement *outliner_find_id(SpaceOutliner *space_outliner, ListBase *lb, const
|
||||
return te;
|
||||
}
|
||||
}
|
||||
else if (tselem->type == TSE_RNA_STRUCT) {
|
||||
/* No ID, so check if entry is RNA-struct, and if that RNA-struct is an ID datablock we are
|
||||
* good. */
|
||||
const TreeElementRNAStruct *te_rna_struct = tree_element_cast<TreeElementRNAStruct>(te);
|
||||
if (te_rna_struct) {
|
||||
const PointerRNA &ptr = te_rna_struct->get_pointer_rna();
|
||||
if (RNA_struct_is_ID(ptr.type)) {
|
||||
if (static_cast<ID *>(ptr.data) == id) {
|
||||
return te;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TreeElement *tes = outliner_find_id(space_outliner, &te->subtree, id);
|
||||
if (tes) {
|
||||
|
||||
Reference in New Issue
Block a user