Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

Fix inverted node order in 2D Node List Tool

Black-dawgb5b6396a91cc
diff --git a/scene/debugger/debugger_helpers.cpp b/scene/debugger/debugger_helpers.cpp
index de073957270..46fe67768f9 100644
--- a/scene/debugger/debugger_helpers.cpp
+++ b/scene/debugger/debugger_helpers.cpp
@@ -33,6 +33,7 @@
#include "core/input/input.h"
#include "core/input/shortcut.h"
+#include "scene/main/node.h"
bool DebuggerHelpers::is_shortcut_pressed(const int p_idx, const HashMap<int, Ref<Shortcut>> &p_shortcuts, bool p_true_if_empty) {
ERR_FAIL_COND_V(!p_shortcuts.has(p_idx), p_true_if_empty);
@@ -50,6 +51,22 @@ bool DebuggerHelpers::is_shortcut_pressed(const int p_idx, const HashMap<int, Re
return false;
}
+bool DebuggerHelpers::SelectResult::operator<(const SelectResult &p_rr) const {
+ if (order != p_rr.order) {
+ return p_rr.order < order;
+ }
+
+ if (item && p_rr.item) {
+ return item->is_greater_than(p_rr.item);
+ }
+
+ if (item || p_rr.item) {
+ return item != nullptr;
+ }
+
+ return false;
+}
+
bool DebuggerHelpers::is_shortcut_empty(const int p_idx, const HashMap<int, Ref<Shortcut>> &p_shortcuts) {
ERR_FAIL_COND_V(!p_shortcuts.has(p_idx), true);
Ref<Shortcut> shortcut = p_shortcuts[p_idx];
diff --git a/scene/debugger/debugger_helpers.h b/scene/debugger/debugger_helpers.h
index 816c6463d06..655f88bb63a 100644
--- a/scene/debugger/debugger_helpers.h
+++ b/scene/debugger/debugger_helpers.h
@@ -39,8 +39,8 @@ class DebuggerHelpers {
public:
struct SelectResult {
Node *item = nullptr;
- real_t order = 0;
- _FORCE_INLINE_ bool operator<(const SelectResult &p_rr) const { return p_rr.order < order; }
+ int order = 0;
+ bool operator<(const SelectResult &p_rr) const;
};
static bool is_shortcut_pressed(const int p_idx, const HashMap<int, Ref<Shortcut>> &p_shortcuts, bool p_true_if_empty = false);