Merge pull request #65364 from akien-mga/3.x-cherrypicks

This commit is contained in:
Rémi Verschelde 2022-09-06 09:51:11 +02:00 committed by GitHub
commit feea3df0dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 75 additions and 20 deletions

View file

@ -395,9 +395,12 @@ if selected_platform in platform_list:
scons_ver = env._get_major_minor_revision(scons_raw_version)
if scons_ver >= (4, 0, 0):
env.Tool("compilation_db")
env.Alias("compiledb", env.CompilationDatabase())
if scons_ver < (4, 0, 0):
print("The `compiledb=yes` option requires SCons 4.0 or later, but your version is %s." % scons_raw_version)
Exit(255)
env.Tool("compilation_db")
env.Alias("compiledb", env.CompilationDatabase())
# 'dev' and 'production' are aliases to set default options if they haven't been set
# manually by the user.

View file

@ -395,6 +395,7 @@
<return type="void" />
<description>
Steal the focus from another control and become the focused control (see [member focus_mode]).
[b]Note[/b]: Using this method together with [method Object.call_deferred] makes it more reliable, especially when called inside [method Node._ready].
</description>
</method>
<method name="has_color" qualifiers="const">

View file

@ -169,7 +169,7 @@
<signal name="velocity_computed">
<argument index="0" name="safe_velocity" type="Vector3" />
<description>
Notifies when the collision avoidance velocity is calculated after a call to [method set_velocity].
Notifies when the collision avoidance velocity is calculated after a call to [method set_velocity]. Only emitted when [member avoidance_enabled] is true.
</description>
</signal>
</signals>

View file

@ -163,7 +163,7 @@
<signal name="velocity_computed">
<argument index="0" name="safe_velocity" type="Vector2" />
<description>
Notifies when the collision avoidance velocity is calculated after a call to [method set_velocity].
Notifies when the collision avoidance velocity is calculated after a call to [method set_velocity]. Only emitted when [member avoidance_enabled] is true.
</description>
</signal>
</signals>

View file

@ -15,6 +15,7 @@
<members>
<member name="motion_mirroring" type="Vector2" setter="set_mirroring" getter="get_mirroring" default="Vector2( 0, 0 )">
The ParallaxLayer's [Texture] mirroring. Useful for creating an infinite scrolling background. If an axis is set to [code]0[/code], the [Texture] will not be mirrored.
If the length of the viewport axis is bigger than twice the mirrored axis size, it will not repeat infinitely, as the parallax layer only draws 2 instances of the texture at any one time.
</member>
<member name="motion_offset" type="Vector2" setter="set_motion_offset" getter="get_motion_offset" default="Vector2( 0, 0 )">
The ParallaxLayer's offset relative to the parent ParallaxBackground's [member ParallaxBackground.scroll_offset].

View file

@ -235,6 +235,11 @@ Error EditorRun::run(const String &p_scene, const String &p_custom_args, const L
}
}
// Pass the debugger stop shortcut to the running instance(s).
String shortcut;
VariantWriter::write_to_string(ED_GET_SHORTCUT("editor/stop"), shortcut);
OS::get_singleton()->set_environment("__GODOT_EDITOR_STOP_SHORTCUT__", shortcut);
printf("Running: %ls", exec.c_str());
for (List<String>::Element *E = args.front(); E; E = E->next()) {
printf(" %ls", E->get().c_str());

View file

@ -42,7 +42,7 @@ String EditorSpinSlider::get_tooltip(const Point2 &p_pos) const {
#else
const int key = KEY_CONTROL;
#endif
return rtos(get_value()) + "\n\n" + vformat(TTR("Hold %s to round to integers. Hold Shift for more precise changes."), find_keycode_name(key));
return rtos(get_value()) + "\n\n" + vformat(TTR("Hold %s to round to integers.\nHold Shift for more precise changes."), find_keycode_name(key));
}
return rtos(get_value());
}

View file

@ -343,10 +343,18 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent, bool p_scroll
Ref<Script> script = p_node->get_script();
if (!script.is_null()) {
item->add_button(0, get_icon("Script", "EditorIcons"), BUTTON_SCRIPT, false, TTR("Open Script:") + " " + script->get_path());
String additional_notes;
// Can't set tooltip after adding button, need to do it before.
if (script->is_tool()) {
additional_notes += "\n" + TTR("This script is currently running in the editor.");
}
item->add_button(0, get_icon("Script", "EditorIcons"), BUTTON_SCRIPT, false, TTR("Open Script:") + " " + script->get_path() + additional_notes);
if (EditorNode::get_singleton()->get_object_custom_type_base(p_node) == script) {
item->set_button_color(0, item->get_button_count(0) - 1, Color(1, 1, 1, 0.5));
}
if (script->is_tool()) {
item->set_button_color(0, item->get_button_count(0) - 1, get_color("accent_color", "Editor"));
}
}
if (p_node->is_class("CanvasItem")) {

View file

@ -65,10 +65,17 @@ Ref<PropertyTweener> SceneTreeTween::tween_property(Object *p_target, NodePath p
ERR_FAIL_COND_V_MSG(!valid, nullptr, "SceneTreeTween invalid. Either finished or created outside scene tree.");
ERR_FAIL_COND_V_MSG(started, nullptr, "Can't append to a SceneTreeTween that has started. Use stop() first.");
#ifdef DEBUG_ENABLED
Variant::Type property_type = p_target->get_indexed(p_property.get_as_property_path().get_subnames()).get_type();
ERR_FAIL_COND_V_MSG(property_type != p_to.get_type(), Ref<PropertyTweener>(), "Type mismatch between property and final value: " + Variant::get_type_name(property_type) + " and " + Variant::get_type_name(p_to.get_type()));
#endif
if (property_type != p_to.get_type()) {
// Cast p_to between floats and ints to avoid minor annoyances.
if (property_type == Variant::REAL && p_to.get_type() == Variant::INT) {
p_to = float(p_to);
} else if (property_type == Variant::INT && p_to.get_type() == Variant::REAL) {
p_to = int(p_to);
} else {
ERR_FAIL_V_MSG(Ref<PropertyTweener>(), "Type mismatch between property and final value: " + Variant::get_type_name(property_type) + " and " + Variant::get_type_name(p_to.get_type()));
}
}
Ref<PropertyTweener> tweener = memnew(PropertyTweener(p_target, p_property, p_to, p_duration));
append(tweener);

View file

@ -38,10 +38,12 @@
#include "core/os/os.h"
#include "core/print_string.h"
#include "core/project_settings.h"
#include "core/variant_parser.h"
#include "main/input_default.h"
#include "node.h"
#include "scene/animation/scene_tree_tween.h"
#include "scene/debugger/script_debugger_remote.h"
#include "scene/gui/shortcut.h"
#include "scene/resources/dynamic_font.h"
#include "scene/resources/material.h"
#include "scene/resources/mesh.h"
@ -463,9 +465,35 @@ void SceneTree::input_event(const Ref<InputEvent> &p_event) {
call_group_flags(GROUP_CALL_REALTIME, "_viewports", "_vp_input", ev); //special one for GUI, as controls use their own process check
if (ScriptDebugger::get_singleton() && ScriptDebugger::get_singleton()->is_remote()) {
//quit from game window using F8
// Quit from game window using the stop shortcut (F8 by default).
// The custom shortcut is provided via environment variable when running from the editor.
if (debugger_stop_shortcut.is_null()) {
String shortcut_str = OS::get_singleton()->get_environment("__GODOT_EDITOR_STOP_SHORTCUT__");
if (!shortcut_str.empty()) {
Variant shortcut_var;
VariantParser::StreamString ss;
ss.s = shortcut_str;
String errs;
int line;
VariantParser::parse(&ss, shortcut_var, errs, line);
debugger_stop_shortcut = shortcut_var;
}
if (debugger_stop_shortcut.is_null()) {
// Define a default shortcut if it wasn't provided or is invalid.
Ref<InputEventKey> ie;
ie.instance();
ie->set_scancode(KEY_F8);
ie->set_unicode(KEY_F8);
debugger_stop_shortcut.instance();
debugger_stop_shortcut->set_shortcut(ie);
}
}
Ref<InputEventKey> k = ev;
if (k.is_valid() && k->is_pressed() && !k->is_echo() && k->get_scancode() == KEY_F8) {
if (k.is_valid() && k->is_pressed() && !k->is_echo() && debugger_stop_shortcut->is_shortcut(k)) {
ScriptDebugger::get_singleton()->request_quit();
}
}

View file

@ -42,6 +42,7 @@
class PackedScene;
class Node;
class SceneTreeTween;
class ShortCut;
class Spatial;
class Viewport;
class Material;
@ -230,6 +231,9 @@ private:
SelfList<Node>::List xform_change_list;
friend class ScriptDebuggerRemote;
Ref<ShortCut> debugger_stop_shortcut;
#ifdef DEBUG_ENABLED
Map<int, NodePath> live_edit_node_path_cache;

View file

@ -730,6 +730,10 @@ void Viewport::set_size(const Size2 &p_size) {
_update_stretch_transform();
update_configuration_warning();
for (Set<ViewportTexture *>::Element *E = viewport_textures.front(); E; E = E->next()) {
E->get()->emit_changed();
}
emit_signal("size_changed");
}

View file

@ -104,10 +104,7 @@ void CameraServer::add_feed(const Ref<CameraFeed> &p_feed) {
// add our feed
feeds.push_back(p_feed);
// record for debugging
#ifdef DEBUG_ENABLED
print_line("Registered camera " + p_feed->get_name() + " with id " + itos(p_feed->get_id()) + " position " + itos(p_feed->get_position()) + " at index " + itos(feeds.size() - 1));
#endif
print_verbose("CameraServer: Registered camera " + p_feed->get_name() + " with ID " + itos(p_feed->get_id()) + " and position " + itos(p_feed->get_position()) + " at index " + itos(feeds.size() - 1));
// let whomever is interested know
emit_signal("camera_feed_added", p_feed->get_id());
@ -118,10 +115,7 @@ void CameraServer::remove_feed(const Ref<CameraFeed> &p_feed) {
if (feeds[i] == p_feed) {
int feed_id = p_feed->get_id();
// record for debugging
#ifdef DEBUG_ENABLED
print_line("Removed camera " + p_feed->get_name() + " with id " + itos(feed_id) + " position " + itos(p_feed->get_position()));
#endif
print_verbose("CameraServer: Removed camera " + p_feed->get_name() + " with ID " + itos(feed_id) + " and position " + itos(p_feed->get_position()));
// remove it from our array, if this results in our feed being unreferenced it will be destroyed
feeds.remove(i);