Fix clear_custom_color on invalid tree_item_inspected
This commit is contained in:
parent
25ff1306d6
commit
9eacbf6de7
|
@ -77,12 +77,12 @@ void SceneTreeDock::_quick_open() {
|
|||
|
||||
void SceneTreeDock::_inspect_hovered_node() {
|
||||
select_node_hovered_at_end_of_drag = true;
|
||||
if (tree_item_inspected != nullptr) {
|
||||
tree_item_inspected->clear_custom_color(0);
|
||||
}
|
||||
Tree *tree = scene_tree->get_scene_tree();
|
||||
TreeItem *item = tree->get_item_with_metadata(node_hovered_now->get_path());
|
||||
if (item) {
|
||||
if (tree_item_inspected) {
|
||||
tree_item_inspected->clear_custom_color(0);
|
||||
}
|
||||
tree_item_inspected = item;
|
||||
tree_item_inspected->set_custom_color(0, get_theme_color(SNAME("accent_color"), EditorStringName(Editor)));
|
||||
}
|
||||
|
@ -133,8 +133,9 @@ void SceneTreeDock::input(const Ref<InputEvent> &p_event) {
|
|||
}
|
||||
|
||||
if (mb->is_released()) {
|
||||
if (tree_item_inspected != nullptr) {
|
||||
if (tree_item_inspected) {
|
||||
tree_item_inspected->clear_custom_color(0);
|
||||
tree_item_inspected = nullptr;
|
||||
}
|
||||
_reset_hovering_timer();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue