Revert "Fix #111713: Nodes crash when overriding due to item.parent nullptr"

This reverts commit 2a94a99605.

This commit caused test `bl_node_group_interface` to fail.
This commit is contained in:
Campbell Barton
2023-09-01 11:10:12 +10:00
parent 8032ee9df2
commit 68440742ce
2 changed files with 3 additions and 15 deletions

View File

@@ -246,10 +246,7 @@ typedef struct bNodeTreeInterface {
/* const_cast to avoid a const version of #find_parent_recursive. */
const bNodeTreeInterfacePanel *parent =
const_cast<bNodeTreeInterfacePanel &>(root_panel).find_parent_recursive(item);
if (parent == nullptr || parent == &root_panel) {
/* Panel is the root panel. */
return 0;
}
BLI_assert(parent != nullptr);
return parent->item_position(item);
}
/**
@@ -277,19 +274,11 @@ typedef struct bNodeTreeInterface {
}
/**
* Find the panel containing the item.
* \param include_root: Allow #root_panel as a return value,
* otherwise return nullptr for root items.
* \return Parent panel containing the item.
*/
bNodeTreeInterfacePanel *find_item_parent(const bNodeTreeInterfaceItem &item,
bool include_root = false)
bNodeTreeInterfacePanel *find_item_parent(const bNodeTreeInterfaceItem &item)
{
bNodeTreeInterfacePanel *parent = root_panel.find_parent_recursive(item);
/* Return nullptr instead the root panel. */
if (!include_root && parent == &root_panel) {
return nullptr;
}
return parent;
return root_panel.find_parent_recursive(item);
}
/**

View File

@@ -850,7 +850,6 @@ static void rna_def_node_interface_item(BlenderRNA *brna)
RNA_def_property_pointer_funcs(
prop, "rna_NodeTreeInterfaceItem_parent_get", nullptr, nullptr, nullptr);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON);
RNA_def_property_ui_text(prop, "Parent", "Panel that contains the item");
prop = RNA_def_property(srna, "position", PROP_INT, PROP_NONE);