Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2022-01-26 21:11:34 +0300
committerJulian Eisel <julian@blender.org>2022-01-26 21:15:57 +0300
commit7b615ca186cab53736fe656d894814c6f92de0e3 (patch)
tree3c3285206c9ce039cd530f27dccfe2e099163c47 /source/blender/editors/space_outliner/tree/tree_element_rna.cc
parent9dc0379dc0023fe45f185dc594dbd4a2fd9fedd3 (diff)
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()`.
Diffstat (limited to 'source/blender/editors/space_outliner/tree/tree_element_rna.cc')
-rw-r--r--source/blender/editors/space_outliner/tree/tree_element_rna.cc33
1 files changed, 14 insertions, 19 deletions
diff --git a/source/blender/editors/space_outliner/tree/tree_element_rna.cc b/source/blender/editors/space_outliner/tree/tree_element_rna.cc
index d33cd7005d7..7a9f1b6f0fa 100644
--- a/source/blender/editors/space_outliner/tree/tree_element_rna.cc
+++ b/source/blender/editors/space_outliner/tree/tree_element_rna.cc
@@ -54,8 +54,6 @@ TreeElementRNACommon::TreeElementRNACommon(TreeElement &legacy_te, PointerRNA &r
legacy_te_.name = IFACE_("(empty)");
return;
}
-
- legacy_te_.rnaptr = rna_ptr;
}
bool TreeElementRNACommon::isExpandValid() const
@@ -73,6 +71,11 @@ bool TreeElementRNACommon::expandPoll(const SpaceOutliner &) const
return isRNAValid();
}
+const PointerRNA &TreeElementRNACommon::getPointerRNA() const
+{
+ return rna_ptr_;
+}
+
PropertyRNA *TreeElementRNACommon::getPropertyRNA() const
{
return nullptr;
@@ -102,15 +105,15 @@ TreeElementRNAStruct::TreeElementRNAStruct(TreeElement &legacy_te, PointerRNA &r
void TreeElementRNAStruct::expand(SpaceOutliner &space_outliner) const
{
TreeStoreElem &tselem = *TREESTORE(&legacy_te_);
- PointerRNA *ptr = &legacy_te_.rnaptr;
+ PointerRNA ptr = rna_ptr_;
/* If searching don't expand RNA entries */
if (SEARCHING_OUTLINER(&space_outliner) && BLI_strcasecmp("RNA", legacy_te_.name) == 0) {
tselem.flag &= ~TSE_CHILDSEARCH;
}
- PropertyRNA *iterprop = RNA_struct_iterator_property(ptr->type);
- int tot = RNA_property_collection_length(ptr, iterprop);
+ PropertyRNA *iterprop = RNA_struct_iterator_property(ptr.type);
+ int tot = RNA_property_collection_length(&ptr, iterprop);
CLAMP_MAX(tot, max_index);
TreeElementRNAProperty *parent_prop_te = legacy_te_.parent ?
@@ -127,14 +130,10 @@ void TreeElementRNAStruct::expand(SpaceOutliner &space_outliner) const
if (TSELEM_OPEN(&tselem, &space_outliner)) {
for (int index = 0; index < tot; index++) {
PointerRNA propptr;
- RNA_property_collection_lookup_int(ptr, iterprop, index, &propptr);
+ RNA_property_collection_lookup_int(&ptr, iterprop, index, &propptr);
if (!(RNA_property_flag(reinterpret_cast<PropertyRNA *>(propptr.data)) & PROP_HIDDEN)) {
- outliner_add_element(&space_outliner,
- &legacy_te_.subtree,
- (void *)ptr,
- &legacy_te_,
- TSE_RNA_PROPERTY,
- index);
+ outliner_add_element(
+ &space_outliner, &legacy_te_.subtree, &ptr, &legacy_te_, TSE_RNA_PROPERTY, index);
}
}
}
@@ -184,7 +183,7 @@ void TreeElementRNAProperty::expand(SpaceOutliner &space_outliner) const
if (pptr.data) {
if (TSELEM_OPEN(&tselem, &space_outliner)) {
outliner_add_element(
- &space_outliner, &legacy_te_.subtree, (void *)&pptr, &legacy_te_, TSE_RNA_STRUCT, -1);
+ &space_outliner, &legacy_te_.subtree, &pptr, &legacy_te_, TSE_RNA_STRUCT, -1);
}
else {
legacy_te_.flag |= TE_LAZY_CLOSED;
@@ -199,12 +198,8 @@ void TreeElementRNAProperty::expand(SpaceOutliner &space_outliner) const
for (int index = 0; index < tot; index++) {
PointerRNA pptr;
RNA_property_collection_lookup_int(&rna_ptr, rna_prop_, index, &pptr);
- outliner_add_element(&space_outliner,
- &legacy_te_.subtree,
- (void *)&pptr,
- &legacy_te_,
- TSE_RNA_STRUCT,
- index);
+ outliner_add_element(
+ &space_outliner, &legacy_te_.subtree, &pptr, &legacy_te_, TSE_RNA_STRUCT, index);
}
}
else if (tot) {