Fix: Missing UI context members after recent refactor

Caused by 7d7e90ca68.

When accessing context members from the windowmanager context
(`C->wm.store` which is mainly used for UI related stuff) the above
commit broke behavior in `CTX_store_ptr_lookup` in that it changed and
would **always** return NULL if no type is passed in. The call to
`CTX_store_ptr_lookup` from `ctx_data_get` **always** passes in NULL
though.

Accessing other context members survived since they take a different
code path in `ctx_data_get` and dont use `CTX_store_ptr_lookup`.

Now also return the entry if a NULL type was passed as it was before.

Fixes T103370, T103405, T103417

Differential Revision: https://developer.blender.org/D16840
This commit is contained in:
Philipp Oeser 2022-12-22 16:14:15 -05:00 committed by Hans Goudey
parent d9510f02c8
commit 15c433d7d5
Notes: blender-bot 2023-02-14 07:31:34 +01:00
Referenced by commit 2838d9324d, Cleanup: clang format
Referenced by issue #103417, Regression: Submenus in toolbar are empty
Referenced by issue #103405, Regression: Some modifiers not working
Referenced by issue #103370, Button Context Menu has no attribute 'button_prop'
1 changed files with 1 additions and 1 deletions

View File

@ -190,7 +190,7 @@ const PointerRNA *CTX_store_ptr_lookup(const bContextStore *store,
{
for (auto entry = store->entries.rbegin(); entry != store->entries.rend(); ++entry) {
if (entry->name == name) {
if (type && RNA_struct_is_a(entry->ptr.type, type)) {
if (!type ||(type && RNA_struct_is_a(entry->ptr.type, type))) {
return &entry->ptr;
}
}