Fix (unreported) crash in Outliner Overrides Properties view in invalid cases.
We cannot try to get RNA info when the rna path of an override property is invalid.
This commit is contained in:
parent
b9d02b9ced
commit
a3f9862262
|
@ -1808,6 +1808,25 @@ static void outliner_draw_overrides_rna_buts(uiBlock *block,
|
|||
TreeElementOverridesProperty &override_elem = *tree_element_cast<TreeElementOverridesProperty>(
|
||||
te);
|
||||
|
||||
if (!override_elem.is_rna_path_valid) {
|
||||
uiBut *but = uiDefBut(block,
|
||||
UI_BTYPE_LABEL,
|
||||
0,
|
||||
override_elem.rna_path.c_str(),
|
||||
x + pad_x,
|
||||
te->ys + pad_y,
|
||||
item_max_width,
|
||||
item_height,
|
||||
NULL,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
"");
|
||||
UI_but_flag_enable(but, UI_BUT_REDALERT);
|
||||
continue;
|
||||
}
|
||||
|
||||
PointerRNA *ptr = &override_elem.override_rna_ptr;
|
||||
PropertyRNA *prop = &override_elem.override_rna_prop;
|
||||
const PropertyType prop_type = RNA_property_type(prop);
|
||||
|
@ -1935,8 +1954,9 @@ static bool outliner_draw_overrides_warning_buts(uiBlock *block,
|
|||
break;
|
||||
}
|
||||
case TSE_LIBRARY_OVERRIDE: {
|
||||
const bool is_rna_path_valid = (bool)(POINTER_AS_UINT(te->directdata));
|
||||
if (!is_rna_path_valid) {
|
||||
TreeElementOverridesProperty &te_override_prop =
|
||||
*tree_element_cast<TreeElementOverridesProperty>(te);
|
||||
if (!te_override_prop.is_rna_path_valid) {
|
||||
item_has_warnings = true;
|
||||
if (do_draw) {
|
||||
tip = TIP_(
|
||||
|
|
|
@ -84,14 +84,13 @@ TreeElementOverridesProperty::TreeElementOverridesProperty(TreeElement &legacy_t
|
|||
TreeElementOverridesData &override_data)
|
||||
: AbstractTreeElement(legacy_te),
|
||||
override_rna_ptr(override_data.override_rna_ptr),
|
||||
override_rna_prop(override_data.override_rna_prop)
|
||||
override_rna_prop(override_data.override_rna_prop),
|
||||
rna_path(override_data.override_property.rna_path),
|
||||
is_rna_path_valid(override_data.is_rna_path_valid)
|
||||
{
|
||||
BLI_assert(legacy_te.store_elem->type == TSE_LIBRARY_OVERRIDE);
|
||||
|
||||
legacy_te.name = override_data.override_property.rna_path;
|
||||
/* Abusing this for now, better way to do it is also pending current refactor of the whole tree
|
||||
* code to use C++. */
|
||||
legacy_te.directdata = POINTER_FROM_UINT(override_data.is_rna_path_valid);
|
||||
}
|
||||
|
||||
} // namespace blender::ed::outliner
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
|
||||
#include "RNA_types.h"
|
||||
|
||||
#include "BLI_string_ref.hh"
|
||||
|
||||
#include "tree_element.hh"
|
||||
|
||||
struct ID;
|
||||
|
@ -39,6 +41,9 @@ class TreeElementOverridesProperty final : public AbstractTreeElement {
|
|||
PointerRNA override_rna_ptr;
|
||||
PropertyRNA &override_rna_prop;
|
||||
|
||||
StringRefNull rna_path;
|
||||
bool is_rna_path_valid;
|
||||
|
||||
public:
|
||||
TreeElementOverridesProperty(TreeElement &legacy_te, TreeElementOverridesData &override_data);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue