summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/classes/DisplayServer.xml2
-rw-r--r--doc/classes/Node.xml24
-rw-r--r--editor/debugger/editor_debugger_node.cpp11
-rw-r--r--editor/debugger/editor_debugger_node.h5
-rw-r--r--editor/editor_node.cpp12
-rw-r--r--main/main.cpp8
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs4
-rw-r--r--scene/debugger/scene_debugger.cpp2
-rw-r--r--scene/main/node.cpp44
-rw-r--r--scene/main/node.h7
-rw-r--r--scene/main/scene_tree.cpp2
-rw-r--r--scene/main/scene_tree.h5
12 files changed, 111 insertions, 15 deletions
diff --git a/doc/classes/DisplayServer.xml b/doc/classes/DisplayServer.xml
index abb715b34e..4f495eaec9 100644
--- a/doc/classes/DisplayServer.xml
+++ b/doc/classes/DisplayServer.xml
@@ -649,6 +649,8 @@
<argument index="0" name="min_size" type="Vector2i" />
<argument index="1" name="window_id" type="int" default="0" />
<description>
+ Sets the minimum size for the given window to [code]min_size[/code] (in pixels).
+ [b]Note:[/b] By default, the main window has a minimum size of [code]Vector2i(64, 64)[/code]. This prevents issues that can arise when the window is resized to a near-zero size.
</description>
</method>
<method name="window_set_mode">
diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml
index 096fbbf2c0..c35734b5df 100644
--- a/doc/classes/Node.xml
+++ b/doc/classes/Node.xml
@@ -322,18 +322,42 @@
Returns the relative [NodePath] from this node to the specified [code]node[/code]. Both nodes must be in the same scene or the function will fail.
</description>
</method>
+ <method name="get_physics_process_cumulative_time" qualifiers="const">
+ <return type="float" />
+ <description>
+ Returns the cumulative physics-bound frame time elapsed (in seconds) since this node has been active and running (i.e. not paused) in the current scene tree.
+ </description>
+ </method>
<method name="get_physics_process_delta_time" qualifiers="const">
<return type="float" />
<description>
Returns the time elapsed (in seconds) since the last physics-bound frame (see [method _physics_process]). This is always a constant value in physics processing unless the frames per second is changed via [member Engine.physics_ticks_per_second].
</description>
</method>
+ <method name="get_physics_process_total_time" qualifiers="const">
+ <return type="float" />
+ <description>
+ Returns the total time elapsed (in seconds) since this node has been part of the current scene tree regardless of the pause state.
+ </description>
+ </method>
+ <method name="get_process_cumulative_time" qualifiers="const">
+ <return type="float" />
+ <description>
+ Returns the cumulative time elapsed (in seconds) since this node has been active and running (i.e. not paused) in the current tree.
+ </description>
+ </method>
<method name="get_process_delta_time" qualifiers="const">
<return type="float" />
<description>
Returns the time elapsed (in seconds) since the last process callback. This value may vary from frame to frame.
</description>
</method>
+ <method name="get_process_total_time" qualifiers="const">
+ <return type="float" />
+ <description>
+ Returns the total time elapsed (in seconds) since this node has been part of the current scene tree regardless of the pause state.
+ </description>
+ </method>
<method name="get_scene_instance_load_placeholder" qualifiers="const">
<return type="bool" />
<description>
diff --git a/editor/debugger/editor_debugger_node.cpp b/editor/debugger/editor_debugger_node.cpp
index 5d654ca756..a9cb1a0131 100644
--- a/editor/debugger/editor_debugger_node.cpp
+++ b/editor/debugger/editor_debugger_node.cpp
@@ -655,6 +655,17 @@ void EditorDebuggerNode::live_debug_reparent_node(const NodePath &p_at, const No
});
}
+void EditorDebuggerNode::set_camera_override(CameraOverride p_override) {
+ _for_all(tabs, [&](ScriptEditorDebugger *dbg) {
+ dbg->set_camera_override(p_override);
+ });
+ camera_override = p_override;
+}
+
+EditorDebuggerNode::CameraOverride EditorDebuggerNode::get_camera_override() {
+ return camera_override;
+}
+
void EditorDebuggerNode::add_debugger_plugin(const Ref<Script> &p_script) {
ERR_FAIL_COND_MSG(debugger_plugins.has(p_script), "Debugger plugin already exists.");
ERR_FAIL_COND_MSG(p_script.is_null(), "Debugger plugin script is null");
diff --git a/editor/debugger/editor_debugger_node.h b/editor/debugger/editor_debugger_node.h
index 0849ecf1c9..39a95326be 100644
--- a/editor/debugger/editor_debugger_node.h
+++ b/editor/debugger/editor_debugger_node.h
@@ -185,9 +185,8 @@ public:
void live_debug_duplicate_node(const NodePath &p_at, const String &p_new_name);
void live_debug_reparent_node(const NodePath &p_at, const NodePath &p_new_place, const String &p_new_name, int p_at_pos);
- // Camera
- void set_camera_override(CameraOverride p_override) { camera_override = p_override; }
- CameraOverride get_camera_override() { return camera_override; }
+ void set_camera_override(CameraOverride p_override);
+ CameraOverride get_camera_override();
Error start(const String &p_protocol = "tcp://");
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 3adb7688b0..08585030de 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -388,14 +388,16 @@ void EditorNode::_version_control_menu_option(int p_idx) {
}
void EditorNode::_update_title() {
- String appname = ProjectSettings::get_singleton()->get("application/config/name");
- String title = appname.is_empty() ? String(VERSION_FULL_NAME) : String(VERSION_NAME + String(" - ") + appname);
- String edited = editor_data.get_edited_scene_root() ? editor_data.get_edited_scene_root()->get_filename() : String();
+ const String appname = ProjectSettings::get_singleton()->get("application/config/name");
+ String title = (appname.is_empty() ? "Unnamed Project" : appname) + String(" - ") + VERSION_NAME;
+ const String edited = editor_data.get_edited_scene_root() ? editor_data.get_edited_scene_root()->get_filename() : String();
if (!edited.is_empty()) {
- title += " - " + String(edited.get_file());
+ // Display the edited scene name before the program name so that it can be seen in the OS task bar.
+ title = vformat("%s - %s", edited.get_file(), title);
}
if (unsaved_cache) {
- title += " (*)";
+ // Display the "modified" mark before anything else so that it can always be seen in the OS task bar.
+ title = vformat("(*) %s", title);
}
DisplayServer::get_singleton()->window_set_title(title);
diff --git a/main/main.cpp b/main/main.cpp
index 6764332f16..5a2aaa8b8f 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -2203,7 +2203,7 @@ bool Main::start() {
//standard helpers that can be changed from main config
String stretch_mode = GLOBAL_DEF_BASIC("display/window/stretch/mode", "disabled");
- String stretch_aspect = GLOBAL_DEF_BASIC("display/window/stretch/aspect", "ignore");
+ String stretch_aspect = GLOBAL_DEF_BASIC("display/window/stretch/aspect", "keep");
Size2i stretch_size = Size2i(GLOBAL_DEF_BASIC("display/window/size/width", 0),
GLOBAL_DEF_BASIC("display/window/size/height", 0));
@@ -2242,6 +2242,10 @@ bool Main::start() {
DisplayServer::get_singleton()->window_set_title(appname);
#endif
+ // Define a very small minimum window size to prevent bugs such as GH-37242.
+ // It can still be overridden by the user in a script.
+ DisplayServer::get_singleton()->window_set_min_size(Size2i(64, 64));
+
bool snap_controls = GLOBAL_DEF("gui/common/snap_controls_to_pixels", true);
sml->get_root()->set_snap_controls_to_pixels(snap_controls);
@@ -2262,7 +2266,7 @@ bool Main::start() {
"display/window/stretch/mode",
PROPERTY_HINT_ENUM,
"disabled,canvas_items,viewport"));
- GLOBAL_DEF_BASIC("display/window/stretch/aspect", "ignore");
+ GLOBAL_DEF_BASIC("display/window/stretch/aspect", "keep");
ProjectSettings::get_singleton()->set_custom_property_info("display/window/stretch/aspect",
PropertyInfo(Variant::STRING,
"display/window/stretch/aspect",
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs
index d9665cbf2b..6ce148d51e 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs
@@ -64,7 +64,7 @@ namespace Godot
/// <summary>
/// If the string is a path to a file, return the path to the file without the extension.
/// </summary>
- public static string BaseName(this string instance)
+ public static string GetBaseName(this string instance)
{
int index = instance.LastIndexOf('.');
@@ -339,7 +339,7 @@ namespace Godot
/// <summary>
/// If the string is a path to a file, return the extension.
/// </summary>
- public static string Extension(this string instance)
+ public static string GetExtension(this string instance)
{
int pos = instance.FindLast(".");
diff --git a/scene/debugger/scene_debugger.cpp b/scene/debugger/scene_debugger.cpp
index df1aece80a..f4e477b613 100644
--- a/scene/debugger/scene_debugger.cpp
+++ b/scene/debugger/scene_debugger.cpp
@@ -88,7 +88,7 @@ Error SceneDebugger::parse_message(void *p_user, const String &p_msg, const Arra
} else if (p_msg == "override_camera_2D:transform") {
ERR_FAIL_COND_V(p_args.size() < 1, ERR_INVALID_DATA);
- Transform2D transform = p_args[1];
+ Transform2D transform = p_args[0];
scene_tree->get_root()->set_canvas_transform_override(transform);
#ifndef _3D_DISABLED
} else if (p_msg == "override_camera_3D:set") {
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 155af30a6d..d869b465ed 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -55,13 +55,17 @@ void Node::_notification(int p_notification) {
switch (p_notification) {
case NOTIFICATION_PROCESS: {
if (get_script_instance()) {
- Variant time = get_process_delta_time();
+ double d_time = get_process_delta_time();
+ data.process_cumulative_time += d_time;
+ Variant time = d_time;
get_script_instance()->call(SceneStringNames::get_singleton()->_process, time);
}
} break;
case NOTIFICATION_PHYSICS_PROCESS: {
if (get_script_instance()) {
- Variant time = get_physics_process_delta_time();
+ double d_time = get_physics_process_delta_time();
+ data.physics_process_cumulative_time += d_time;
+ Variant time = d_time;
get_script_instance()->call(SceneStringNames::get_singleton()->_physics_process, time);
}
@@ -720,6 +724,22 @@ double Node::get_physics_process_delta_time() const {
}
}
+double Node::get_physics_process_cumulative_time() const {
+ if (data.tree) {
+ return data.physics_process_cumulative_time;
+ } else {
+ return 0;
+ }
+}
+
+double Node::get_physics_process_total_time() const {
+ if (data.tree) {
+ return data.tree->get_physics_total_time();
+ } else {
+ return 0;
+ }
+}
+
double Node::get_process_delta_time() const {
if (data.tree) {
return data.tree->get_process_time();
@@ -746,6 +766,22 @@ bool Node::is_processing() const {
return data.process;
}
+double Node::get_process_cumulative_time() const {
+ if (data.tree) {
+ return data.process_cumulative_time;
+ } else {
+ return 0;
+ }
+}
+
+double Node::get_process_total_time() const {
+ if (data.tree) {
+ return data.tree->get_process_total_time();
+ } else {
+ return 0;
+ }
+}
+
void Node::set_process_internal(bool p_process_internal) {
if (data.process_internal == p_process_internal) {
return;
@@ -2591,8 +2627,12 @@ void Node::_bind_methods() {
ClassDB::bind_method(D_METHOD("propagate_call", "method", "args", "parent_first"), &Node::propagate_call, DEFVAL(Array()), DEFVAL(false));
ClassDB::bind_method(D_METHOD("set_physics_process", "enable"), &Node::set_physics_process);
ClassDB::bind_method(D_METHOD("get_physics_process_delta_time"), &Node::get_physics_process_delta_time);
+ ClassDB::bind_method(D_METHOD("get_physics_process_cumulative_time"), &Node::get_physics_process_cumulative_time);
+ ClassDB::bind_method(D_METHOD("get_physics_process_total_time"), &Node::get_physics_process_total_time);
ClassDB::bind_method(D_METHOD("is_physics_processing"), &Node::is_physics_processing);
ClassDB::bind_method(D_METHOD("get_process_delta_time"), &Node::get_process_delta_time);
+ ClassDB::bind_method(D_METHOD("get_process_cumulative_time"), &Node::get_process_cumulative_time);
+ ClassDB::bind_method(D_METHOD("get_process_total_time"), &Node::get_process_total_time);
ClassDB::bind_method(D_METHOD("set_process", "enable"), &Node::set_process);
ClassDB::bind_method(D_METHOD("set_process_priority", "priority"), &Node::set_process_priority);
ClassDB::bind_method(D_METHOD("get_process_priority"), &Node::get_process_priority);
diff --git a/scene/main/node.h b/scene/main/node.h
index 6616524866..b800d2401e 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -122,6 +122,9 @@ private:
int network_master = 1; // Server by default.
Vector<MultiplayerAPI::RPCConfig> rpc_methods;
+ double process_cumulative_time = 0.0;
+ double physics_process_cumulative_time = 0.0;
+
// Variables used to properly sort the node when processing, ignored otherwise.
// TODO: Should move all the stuff below to bits.
bool physics_process = false;
@@ -341,10 +344,14 @@ public:
/* PROCESSING */
void set_physics_process(bool p_process);
double get_physics_process_delta_time() const;
+ double get_physics_process_cumulative_time() const;
+ double get_physics_process_total_time() const;
bool is_physics_processing() const;
void set_process(bool p_process);
double get_process_delta_time() const;
+ double get_process_cumulative_time() const;
+ double get_process_total_time() const;
bool is_processing() const;
void set_physics_process_internal(bool p_process_internal);
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index 5b707498a7..606b9df3a3 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -412,6 +412,7 @@ bool SceneTree::physics_process(double p_time) {
MainLoop::physics_process(p_time);
physics_process_time = p_time;
+ physics_total_time += p_time;
emit_signal(SNAME("physics_frame"));
@@ -438,6 +439,7 @@ bool SceneTree::process(double p_time) {
MainLoop::process(p_time);
process_time = p_time;
+ process_total_time += p_time;
if (multiplayer_poll) {
multiplayer->poll();
diff --git a/scene/main/scene_tree.h b/scene/main/scene_tree.h
index cfb95bd6b5..ff6ca52a69 100644
--- a/scene/main/scene_tree.h
+++ b/scene/main/scene_tree.h
@@ -92,7 +92,10 @@ private:
uint64_t tree_version = 1;
double physics_process_time = 1.0;
+ double physics_total_time = 0.0;
+ double process_total_time = 0.0;
double process_time = 1.0;
+
bool accept_quit = true;
bool quit_on_go_back = true;
@@ -248,7 +251,9 @@ public:
void quit(int p_exit_code = EXIT_SUCCESS);
_FORCE_INLINE_ double get_physics_process_time() const { return physics_process_time; }
+ _FORCE_INLINE_ double get_physics_total_time() const { return physics_total_time; }
_FORCE_INLINE_ double get_process_time() const { return process_time; }
+ _FORCE_INLINE_ double get_process_total_time() const { return process_total_time; }
#ifdef TOOLS_ENABLED
bool is_node_being_edited(const Node *p_node) const;