Compare commits

...

22 commits

Author SHA1 Message Date
Thaddeus Crews
d61cd9149a
Merge pull request #111327 from Ivorforce/gdvirtual-shorten-get-method-info
Simplify `gdvirtual.gen.inc` `_get_method_info` arguments with a helper function.
2025-10-07 17:15:12 -05:00
Thaddeus Crews
f457855148
Merge pull request #111227 from clayjohn/RD-scene-shader-crash
Fix scene shader crash due to rename of view matrix and inverse view matrix
2025-10-07 17:15:11 -05:00
Thaddeus Crews
194d76e571
Merge pull request #111284 from arkology/sprite-frames-editor-translation
Improve auto-translation of `SpriteFramesEditor`
2025-10-07 17:15:10 -05:00
Thaddeus Crews
ef853bbc06
Merge pull request #111347 from Ivorforce/no-algorithm
Add `max()` to `Span`, replacing `<algorithm>` include from `rendering_device_commons.h`
2025-10-07 17:15:09 -05:00
Thaddeus Crews
0f7bf2913f
Merge pull request #111249 from HolonProduction/owner-node
Store `ThemeOwner` owner directly as `Node*`
2025-10-07 17:15:08 -05:00
Thaddeus Crews
5626f0bf0b
Merge pull request #93296 from rune-scape/editor-node-inheritance
EditorPlugin: Allow instance base type inheriting EditorPlugin
2025-10-07 17:15:07 -05:00
Thaddeus Crews
8276e512d6
Merge pull request #110767 from Ryan-000/Fix-AnimationPlayer-to-use-StringName
Fix AnimationPlayer to use StringName instead of String in the exposed API.
2025-10-07 17:15:06 -05:00
Thaddeus Crews
72cf639020
Merge pull request #111178 from PhairZ/anim-is-paused
Expose `is_valid()` from `AnimationPlayer` to make detecting paused animations possible.
2025-10-07 17:15:04 -05:00
Thaddeus Crews
91ad968557
Merge pull request #111242 from WhalesState/2d-link
Fix 2D debug templates linking
2025-10-07 17:15:03 -05:00
Thaddeus Crews
e878d5a2fb
Merge pull request #111304 from HolonProduction/rm-last-vp-rect
Remove unused members from `Viewport`
2025-10-07 17:15:02 -05:00
Thaddeus Crews
6ef2c7b34b
Merge pull request #110823 from Calinou/ui-builtin-actions-all-devices
Allow all gamepad devices for built-in `ui_*` input actions
2025-10-07 17:15:00 -05:00
clayjohn
c7276273d8 Fix scene shader crash due to rename of view matrix and inverse view matrix 2025-10-07 13:36:23 -07:00
Lukas Tenbrink
1fa332cad4 Add max() to Span.
Remove `<algorithm>` include from `rendering_device_commons.h`, using `Span` instead.
2025-10-07 22:26:32 +02:00
Lukas Tenbrink
5df5c2212a Simplify gdvirtual.gen.inc _get_method_info arguments with a helper function.
# Conflicts:
#	core/object/make_virtuals.py
2025-10-07 22:23:43 +02:00
Ryan
35999a16dd Fix AnimationPlayer to use StringName instead of String
Co-Authored-By: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
2025-10-06 16:29:40 -04:00
arkology
cb321840a1 Improve auto-translation of SpriteFramesEditor 2025-10-06 11:02:35 +00:00
HolonProduction
7f77565b66 Remove unused members from Viewport 2025-10-05 22:41:16 +02:00
HolonProduction
db9a0d82d9 Store ThemeOwner owner directly as Node* 2025-10-05 13:41:17 +02:00
Mounir Tohami
af404ff584 Fix 2D debug templates linking 2025-10-05 04:22:49 +03:00
rune-scape
d779c98ee1 allow inheriting EditorPlugin 2025-10-03 22:54:13 -07:00
Seif El-Din Ahmed
2cb1c51038 Expose is_valid() 2025-10-03 18:37:00 +03:00
Hugo Locurcio
0dcf28104d
Allow all gamepad devices for built-in ui_* input actions
This allows all controllers to navigate the UI, which enhances
compatibility with PC handhelds when external controllers are connected.

Previously, only the first device was allowed to use `ui_*` actions
out of the box, which means that on a PC handheld, external controllers
couldn't navigate the UI (since the first ID is always the built-in controller).
2025-09-23 17:12:56 +02:00
29 changed files with 294 additions and 179 deletions

View file

@ -1188,11 +1188,12 @@ String InputEventJoypadMotion::to_string() {
return vformat("InputEventJoypadMotion: axis=%d, axis_value=%.2f", axis, axis_value);
}
Ref<InputEventJoypadMotion> InputEventJoypadMotion::create_reference(JoyAxis p_axis, float p_value) {
Ref<InputEventJoypadMotion> InputEventJoypadMotion::create_reference(JoyAxis p_axis, float p_value, int p_device) {
Ref<InputEventJoypadMotion> ie;
ie.instantiate();
ie->set_axis(p_axis);
ie->set_axis_value(p_value);
ie->set_device(p_device);
return ie;
}
@ -1307,10 +1308,11 @@ String InputEventJoypadButton::to_string() {
return vformat("InputEventJoypadButton: button_index=%d, pressed=%s, pressure=%.2f", button_index, p, pressure);
}
Ref<InputEventJoypadButton> InputEventJoypadButton::create_reference(JoyButton p_btn_index) {
Ref<InputEventJoypadButton> InputEventJoypadButton::create_reference(JoyButton p_btn_index, int p_device) {
Ref<InputEventJoypadButton> ie;
ie.instantiate();
ie->set_button_index(p_btn_index);
ie->set_device(p_device);
return ie;
}

View file

@ -339,7 +339,8 @@ public:
virtual String as_text() const override;
virtual String to_string() override;
static Ref<InputEventJoypadMotion> create_reference(JoyAxis p_axis, float p_value);
// The default device ID is `InputMap::ALL_DEVICES`.
static Ref<InputEventJoypadMotion> create_reference(JoyAxis p_axis, float p_value, int p_device = -1);
InputEventType get_type() const final override { return InputEventType::JOY_MOTION; }
@ -371,7 +372,8 @@ public:
virtual String as_text() const override;
virtual String to_string() override;
static Ref<InputEventJoypadButton> create_reference(JoyButton p_btn_index);
// The default device ID is `InputMap::ALL_DEVICES`.
static Ref<InputEventJoypadButton> create_reference(JoyButton p_btn_index, int p_device = -1);
InputEventType get_type() const final override { return InputEventType::JOY_BUTTON; }

View file

@ -127,6 +127,15 @@ def generate_version(argcount, const=False, returns=False, required=False, compa
callsiargs = f"Variant vargs[{argcount}] = {{ "
callsiargptrs = f"\t\t\tconst Variant *vargptrs[{argcount}] = {{ "
callptrargsptr = f"\t\t\tGDExtensionConstTypePtr argptrs[{argcount}] = {{ "
if method_info:
method_info += "\\\n\t\t"
method_info += (
"_gdvirtual_set_method_info_args<"
+ ", ".join(f"m_type{i + 1}" for i in range(argcount))
+ ">(method_info);"
)
callptrargs = ""
for i in range(argcount):
if i > 0:
@ -144,10 +153,6 @@ def generate_version(argcount, const=False, returns=False, required=False, compa
f"PtrToArg<m_type{i + 1}>::EncodeT argval{i + 1} = (PtrToArg<m_type{i + 1}>::EncodeT)arg{i + 1};\\\n"
)
callptrargsptr += f"&argval{i + 1}"
if method_info:
method_info += "\\\n\t\t"
method_info += f"method_info.arguments.push_back(GetTypeInfo<m_type{i + 1}>::get_class_info());\\\n"
method_info += f"\t\tmethod_info.arguments_metadata.push_back(GetTypeInfo<m_type{i + 1}>::METADATA);"
if argcount:
callsiargs += " };\\\n"
@ -197,6 +202,12 @@ def run(target, source, env):
inline constexpr uintptr_t _INVALID_GDVIRTUAL_FUNC_ADDR = static_cast<uintptr_t>(-1);
template <typename... Args>
void _gdvirtual_set_method_info_args(MethodInfo &p_method_info) {
p_method_info.arguments = { GetTypeInfo<Args>::get_class_info()... };
p_method_info.arguments_metadata = { GetTypeInfo<Args>::METADATA... };
}
"""
for i in range(max_versions + 1):

View file

@ -108,6 +108,9 @@ public:
/// Note: Assumes that elements in the span are sorted. Otherwise, use find() instead.
template <typename Comparator = Comparator<T>>
constexpr uint64_t bisect(const T &p_value, bool p_before, Comparator compare = Comparator()) const;
/// The caller is responsible to ensure size() > 0.
constexpr T max() const;
};
template <typename T>
@ -204,6 +207,18 @@ constexpr uint64_t Span<T>::bisect(const T &p_value, bool p_before, Comparator c
return lo;
}
template <typename T>
constexpr T Span<T>::max() const {
DEV_ASSERT(size() > 0);
T max_val = _ptr[0];
for (size_t i = 1; i < _len; ++i) {
if (_ptr[i] > max_val) {
max_val = _ptr[i];
}
}
return max_val;
}
// Zero-constructing Span initializes _ptr and _len to 0 (and thus empty).
template <typename T>
struct is_zero_constructible<Span<T>> : std::true_type {};

View file

@ -64,7 +64,7 @@
</description>
</method>
<method name="get_queue">
<return type="PackedStringArray" />
<return type="StringName[]" />
<description>
Returns a list of the animation keys that are currently queued to play.
</description>
@ -93,6 +93,17 @@
Returns [code]true[/code] if an animation is currently playing with a section.
</description>
</method>
<method name="is_animation_active" qualifiers="const">
<return type="bool" />
<description>
Returns [code]true[/code] if the an animation is currently active. An animation is active if it was played by calling [method play] and was not finished yet, or was stopped by calling [method stop].
This can be used to check whether an animation is currently paused or stopped.
[codeblock]
var is_paused = not is_playing() and is_animation_active()
var is_stopped = not is_playing() and not is_animation_active()
[/codeblock]
</description>
</method>
<method name="is_playing" qualifiers="const">
<return type="bool" />
<description>
@ -280,13 +291,13 @@
</method>
</methods>
<members>
<member name="assigned_animation" type="String" setter="set_assigned_animation" getter="get_assigned_animation">
<member name="assigned_animation" type="StringName" setter="set_assigned_animation" getter="get_assigned_animation">
If playing, the current animation's key, otherwise, the animation last played. When set, this changes the animation, but will not play it unless already playing. See also [member current_animation].
</member>
<member name="autoplay" type="String" setter="set_autoplay" getter="get_autoplay" default="&quot;&quot;">
<member name="autoplay" type="StringName" setter="set_autoplay" getter="get_autoplay" default="&amp;&quot;&quot;">
The key of the animation to play when the scene loads.
</member>
<member name="current_animation" type="String" setter="set_current_animation" getter="get_current_animation" default="&quot;&quot;">
<member name="current_animation" type="StringName" setter="set_current_animation" getter="get_current_animation" default="&amp;&quot;&quot;">
The key of the currently playing animation. If no animation is playing, the property's value is an empty string. Changing this value does not restart the animation. See [method play] for more information on playing animations.
[b]Note:[/b] While this property appears in the Inspector, it's not meant to be edited, and it's not saved in the scene. This property is mainly used to get the currently playing animation, and internally for animation playback tracks. For more information, see [Animation].
</member>
@ -332,7 +343,7 @@
</description>
</signal>
<signal name="current_animation_changed">
<param index="0" name="name" type="String" />
<param index="0" name="name" type="StringName" />
<description>
Emitted when [member current_animation] changes.
</description>

View file

@ -56,6 +56,7 @@
#import "rendering_shader_container_metal.h"
#import <os/signpost.h>
#import <algorithm>
// We have to undefine these macros because they are defined in NSObjCRuntime.h.
#undef MIN

View file

@ -113,7 +113,7 @@ void AnimationPlayerEditor::_notification(int p_what) {
if (player->is_playing()) {
{
String animname = player->get_assigned_animation();
StringName animname = player->get_assigned_animation();
if (player->has_animation(animname)) {
Ref<Animation> anim = player->get_animation(animname);
@ -229,7 +229,7 @@ void AnimationPlayerEditor::_autoplay_pressed() {
if (player->get_autoplay() == current) {
//unset
undo_redo->create_action(TTR("Toggle Autoplay"));
undo_redo->add_do_method(player, "set_autoplay", "");
undo_redo->add_do_method(player, "set_autoplay", StringName());
undo_redo->add_undo_method(player, "set_autoplay", player->get_autoplay());
undo_redo->add_do_method(this, "_animation_player_changed", player);
undo_redo->add_undo_method(this, "_animation_player_changed", player);
@ -238,7 +238,7 @@ void AnimationPlayerEditor::_autoplay_pressed() {
} else {
//set
undo_redo->create_action(TTR("Toggle Autoplay"));
undo_redo->add_do_method(player, "set_autoplay", current);
undo_redo->add_do_method(player, "set_autoplay", StringName(current));
undo_redo->add_undo_method(player, "set_autoplay", player->get_autoplay());
undo_redo->add_do_method(this, "_animation_player_changed", player);
undo_redo->add_undo_method(this, "_animation_player_changed", player);
@ -564,8 +564,8 @@ void AnimationPlayerEditor::_animation_remove_confirmed() {
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action(TTR("Remove Animation"));
if (player->get_autoplay() == current) {
undo_redo->add_do_method(player, "set_autoplay", "");
undo_redo->add_undo_method(player, "set_autoplay", current);
undo_redo->add_do_method(player, "set_autoplay", StringName());
undo_redo->add_undo_method(player, "set_autoplay", StringName(current));
// Avoid having the autoplay icon linger around if there is only one animation in the player.
undo_redo->add_do_method(this, "_animation_player_changed", player);
}
@ -597,7 +597,7 @@ void AnimationPlayerEditor::_select_anim_by_name(const String &p_anim) {
}
float AnimationPlayerEditor::_get_editor_step() const {
const String current = player->get_assigned_animation();
const StringName current = player->get_assigned_animation();
const Ref<Animation> anim = player->get_animation(current);
ERR_FAIL_COND_V(anim.is_null(), 0.0);
@ -1411,7 +1411,7 @@ void AnimationPlayerEditor::_seek_value_changed(float p_value, bool p_timeline_o
};
updating = true;
String current = player->get_assigned_animation();
StringName current = player->get_assigned_animation();
if (current.is_empty() || !player->has_animation(current)) {
updating = false;
current = "";
@ -1460,7 +1460,7 @@ void AnimationPlayerEditor::_animation_finished(const String &p_name) {
finishing = true;
}
void AnimationPlayerEditor::_current_animation_changed(const String &p_name) {
void AnimationPlayerEditor::_current_animation_changed(const StringName &p_name) {
if (is_visible_in_tree()) {
if (finishing) {
finishing = false; // Maybe redundant since it will be false in the AnimationPlayerEditor::_process(), but for safety.

View file

@ -206,7 +206,7 @@ class AnimationPlayerEditor : public VBoxContainer {
void _list_changed();
void _animation_finished(const String &p_name);
void _current_animation_changed(const String &p_name);
void _current_animation_changed(const StringName &p_name);
void _update_animation();
void _update_player();
void _set_controls_disabled(bool p_disabled);

View file

@ -4067,6 +4067,7 @@ void EditorNode::set_addon_plugin_enabled(const String &p_addon, bool p_enabled,
Ref<Script> scr; // We need to save it for creating "ep" below.
// Only try to load the script if it has a name. Else, the plugin has no init script.
EditorPlugin *ep = nullptr;
if (script_path.length() > 0) {
script_path = addon_path.get_base_dir().path_join(script_path);
// We should not use the cached version on startup to prevent a script reload
@ -4101,10 +4102,15 @@ void EditorNode::set_addon_plugin_enabled(const String &p_addon, bool p_enabled,
show_warning(vformat(TTR("Unable to load addon script from path: '%s'. Script is not in tool mode."), script_path));
return;
}
Object *obj = ClassDB::instantiate(scr->get_instance_base_type());
ep = Object::cast_to<EditorPlugin>(obj);
ERR_FAIL_NULL(ep);
ep->set_script(scr);
} else {
ep = memnew(EditorPlugin);
}
EditorPlugin *ep = memnew(EditorPlugin);
ep->set_script(scr);
ep->set_plugin_version(plugin_version);
addon_name_to_plugin[addon_path] = ep;
add_editor_plugin(ep, p_config_changed);

View file

@ -133,7 +133,7 @@ void SpriteFramesEditor::_sheet_preview_draw() {
if (frames_selected.is_empty()) {
split_sheet_dialog->get_ok_button()->set_disabled(true);
split_sheet_dialog->set_ok_button_text(TTR("No Frames Selected"));
split_sheet_dialog->set_ok_button_text(TTRC("No Frames Selected"));
return;
}
@ -676,9 +676,30 @@ void SpriteFramesEditor::_notification(int p_what) {
_update_show_settings();
} break;
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: {
_update_show_settings();
} break;
case NOTIFICATION_TRANSLATION_CHANGED: {
_update_show_settings();
anim_speed->set_suffix(TTR("FPS"));
// Similar to `_update_library_impl()`, but only updates text for "empty" items.
if (frames.is_valid()) {
for (int i = 0; i < frames->get_frame_count(edited_anim); i++) {
Ref<Texture2D> texture = frames->get_frame_texture(edited_anim, i);
if (texture.is_null()) {
String name = itos(i);
float duration = frames->get_frame_duration(edited_anim, i);
texture = empty_icon;
name += ": " + TTR("(empty)");
if (duration != 1.0f) {
name += String::utf8(" [× ") + String::num(duration, 2) + "]";
}
frame_list->set_item_text(i, name);
}
}
}
} break;
case NOTIFICATION_READY: {
@ -701,11 +722,11 @@ void SpriteFramesEditor::_file_load_request(const Vector<String> &p_path, int p_
resource = ResourceLoader::load(p_path[i]);
if (resource.is_null()) {
dialog->set_text(TTR("ERROR: Couldn't load frame resource!"));
dialog->set_title(TTR("Error!"));
dialog->set_text(TTRC("ERROR: Couldn't load frame resource!"));
dialog->set_title(TTRC("Error!"));
//dialog->get_cancel()->set_text("Close");
dialog->set_ok_button_text(TTR("Close"));
dialog->set_ok_button_text(TTRC("Close"));
dialog->popup_centered();
return; ///beh should show an error i guess
}
@ -1235,7 +1256,7 @@ void SpriteFramesEditor::_animation_remove() {
return;
}
delete_dialog->set_text(TTR("Delete Animation?"));
delete_dialog->set_text(TTRC("Delete Animation?"));
delete_dialog->popup_centered();
}
@ -1550,6 +1571,8 @@ void SpriteFramesEditor::_update_library_impl() {
}
bool is_first_selection = true;
// NOTE: When the language is changed, the text of the items is updated in `NOTIFICATION_TRANSLATION_CHANGED`.
// If there are changes related to the items and their text in the loop below, the code in `NOTIFICATION_TRANSLATION_CHANGED` must also be changed.
for (int i = 0; i < frames->get_frame_count(edited_anim); i++) {
String name = itos(i);
Ref<Texture2D> texture = frames->get_frame_texture(edited_anim, i);
@ -1963,7 +1986,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
vbc_animlist->set_custom_minimum_size(Size2(150, 0) * EDSCALE);
VBoxContainer *sub_vb = memnew(VBoxContainer);
vbc_animlist->add_margin_child(TTR("Animations:"), sub_vb, true);
vbc_animlist->add_margin_child(TTRC("Animations:"), sub_vb, true);
sub_vb->set_v_size_flags(SIZE_EXPAND_FILL);
HBoxContainer *hbc_animlist = memnew(HBoxContainer);
@ -1995,7 +2018,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
autoplay = memnew(Button);
autoplay->set_theme_type_variation(SceneStringName(FlatButton));
autoplay->set_tooltip_text(TTR("Autoplay on Load"));
autoplay->set_tooltip_text(TTRC("Autoplay on Load"));
autoplay_container->add_child(autoplay);
hbc_animlist->add_child(memnew(VSeparator));
@ -2003,7 +2026,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
anim_loop = memnew(Button);
anim_loop->set_toggle_mode(true);
anim_loop->set_theme_type_variation(SceneStringName(FlatButton));
anim_loop->set_tooltip_text(TTR("Animation Looping"));
anim_loop->set_tooltip_text(TTRC("Animation Looping"));
anim_loop->connect(SceneStringName(pressed), callable_mp(this, &SpriteFramesEditor::_animation_loop_changed));
hbc_animlist->add_child(anim_loop);
@ -2013,7 +2036,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
anim_speed->set_max(120);
anim_speed->set_step(0.01);
anim_speed->set_custom_arrow_step(1);
anim_speed->set_tooltip_text(TTR("Animation Speed"));
anim_speed->set_tooltip_text(TTRC("Animation Speed"));
anim_speed->get_line_edit()->set_expand_to_text_length_enabled(true);
anim_speed->get_line_edit()->connect(SceneStringName(resized), callable_mp(this, &SpriteFramesEditor::_animation_speed_resized));
anim_speed->connect(SceneStringName(value_changed), callable_mp(this, &SpriteFramesEditor::_animation_speed_changed));
@ -2022,7 +2045,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
anim_search_box = memnew(LineEdit);
sub_vb->add_child(anim_search_box);
anim_search_box->set_h_size_flags(SIZE_EXPAND_FILL);
anim_search_box->set_placeholder(TTR("Filter Animations"));
anim_search_box->set_placeholder(TTRC("Filter Animations"));
anim_search_box->set_clear_button_enabled(true);
anim_search_box->connect(SceneStringName(text_changed), callable_mp(this, &SpriteFramesEditor::_animation_search_text_changed));
@ -2030,6 +2053,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
sub_vb->add_child(animations);
animations->set_v_size_flags(SIZE_EXPAND_FILL);
animations->set_hide_root(true);
animations->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
// HACK: The cell_selected signal is emitted before the FPS spinbox loses focus and applies the change.
animations->connect("cell_selected", callable_mp(this, &SpriteFramesEditor::_animation_selected), CONNECT_DEFERRED);
animations->connect("item_edited", callable_mp(this, &SpriteFramesEditor::_animation_name_edited));
@ -2045,7 +2069,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
missing_anim_label = memnew(Label);
missing_anim_label->set_focus_mode(FOCUS_ACCESSIBILITY);
missing_anim_label->set_text(TTR("This resource does not have any animations."));
missing_anim_label->set_text(TTRC("This resource does not have any animations."));
missing_anim_label->set_h_size_flags(SIZE_EXPAND_FILL);
missing_anim_label->set_v_size_flags(SIZE_EXPAND_FILL);
missing_anim_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
@ -2059,7 +2083,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
anim_frames_vb->hide();
sub_vb = memnew(VBoxContainer);
anim_frames_vb->add_margin_child(TTR("Animation Frames:"), sub_vb, true);
anim_frames_vb->add_margin_child(TTRC("Animation Frames:"), sub_vb, true);
HFlowContainer *hfc = memnew(HFlowContainer);
sub_vb->add_child(hfc);
@ -2070,27 +2094,27 @@ SpriteFramesEditor::SpriteFramesEditor() {
play_bw_from = memnew(Button);
play_bw_from->set_theme_type_variation(SceneStringName(FlatButton));
play_bw_from->set_tooltip_text(TTR("Play selected animation backwards from current pos. (A)"));
play_bw_from->set_tooltip_text(TTRC("Play selected animation backwards from current pos. (A)"));
playback_container->add_child(play_bw_from);
play_bw = memnew(Button);
play_bw->set_theme_type_variation(SceneStringName(FlatButton));
play_bw->set_tooltip_text(TTR("Play selected animation backwards from end. (Shift+A)"));
play_bw->set_tooltip_text(TTRC("Play selected animation backwards from end. (Shift+A)"));
playback_container->add_child(play_bw);
stop = memnew(Button);
stop->set_theme_type_variation(SceneStringName(FlatButton));
stop->set_tooltip_text(TTR("Pause/stop animation playback. (S)"));
stop->set_tooltip_text(TTRC("Pause/stop animation playback. (S)"));
playback_container->add_child(stop);
play = memnew(Button);
play->set_theme_type_variation(SceneStringName(FlatButton));
play->set_tooltip_text(TTR("Play selected animation from start. (Shift+D)"));
play->set_tooltip_text(TTRC("Play selected animation from start. (Shift+D)"));
playback_container->add_child(play);
play_from = memnew(Button);
play_from->set_theme_type_variation(SceneStringName(FlatButton));
play_from->set_tooltip_text(TTR("Play selected animation from current pos. (D)"));
play_from->set_tooltip_text(TTRC("Play selected animation from current pos. (D)"));
playback_container->add_child(play_from);
hfc->add_child(memnew(VSeparator));
@ -2163,7 +2187,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
hfc->add_child(hbc_frame_duration);
Label *label = memnew(Label);
label->set_text(TTR("Frame Duration:"));
label->set_text(TTRC("Frame Duration:"));
hbc_frame_duration->add_child(label);
frame_duration = memnew(SpinBox);
@ -2276,7 +2300,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
split_sheet_dialog = memnew(ConfirmationDialog);
add_child(split_sheet_dialog);
split_sheet_dialog->set_title(TTR("Select Frames"));
split_sheet_dialog->set_title(TTRC("Select Frames"));
split_sheet_dialog->connect(SceneStringName(confirmed), callable_mp(this, &SpriteFramesEditor::_sheet_add_frames));
HBoxContainer *split_sheet_hb = memnew(HBoxContainer);
@ -2291,30 +2315,30 @@ SpriteFramesEditor::SpriteFramesEditor() {
HBoxContainer *split_sheet_menu_hb = memnew(HBoxContainer);
split_sheet_menu_hb->add_child(memnew(Label(TTR("Frame Order"))));
split_sheet_menu_hb->add_child(memnew(Label(TTRC("Frame Order"))));
split_sheet_order = memnew(OptionButton);
split_sheet_order->add_item(TTR("As Selected"), FRAME_ORDER_SELECTION);
split_sheet_order->add_separator(TTR("By Row"));
split_sheet_order->add_item(TTR("Left to Right, Top to Bottom"), FRAME_ORDER_LEFT_RIGHT_TOP_BOTTOM);
split_sheet_order->add_item(TTR("Left to Right, Bottom to Top"), FRAME_ORDER_LEFT_RIGHT_BOTTOM_TOP);
split_sheet_order->add_item(TTR("Right to Left, Top to Bottom"), FRAME_ORDER_RIGHT_LEFT_TOP_BOTTOM);
split_sheet_order->add_item(TTR("Right to Left, Bottom to Top"), FRAME_ORDER_RIGHT_LEFT_BOTTOM_TOP);
split_sheet_order->add_separator(TTR("By Column"));
split_sheet_order->add_item(TTR("Top to Bottom, Left to Right"), FRAME_ORDER_TOP_BOTTOM_LEFT_RIGHT);
split_sheet_order->add_item(TTR("Top to Bottom, Right to Left"), FRAME_ORDER_TOP_BOTTOM_RIGHT_LEFT);
split_sheet_order->add_item(TTR("Bottom to Top, Left to Right"), FRAME_ORDER_BOTTOM_TOP_LEFT_RIGHT);
split_sheet_order->add_item(TTR("Bottom to Top, Right to Left"), FRAME_ORDER_BOTTOM_TOP_RIGHT_LEFT);
split_sheet_order->add_item(TTRC("As Selected"), FRAME_ORDER_SELECTION);
split_sheet_order->add_separator(TTRC("By Row"));
split_sheet_order->add_item(TTRC("Left to Right, Top to Bottom"), FRAME_ORDER_LEFT_RIGHT_TOP_BOTTOM);
split_sheet_order->add_item(TTRC("Left to Right, Bottom to Top"), FRAME_ORDER_LEFT_RIGHT_BOTTOM_TOP);
split_sheet_order->add_item(TTRC("Right to Left, Top to Bottom"), FRAME_ORDER_RIGHT_LEFT_TOP_BOTTOM);
split_sheet_order->add_item(TTRC("Right to Left, Bottom to Top"), FRAME_ORDER_RIGHT_LEFT_BOTTOM_TOP);
split_sheet_order->add_separator(TTRC("By Column"));
split_sheet_order->add_item(TTRC("Top to Bottom, Left to Right"), FRAME_ORDER_TOP_BOTTOM_LEFT_RIGHT);
split_sheet_order->add_item(TTRC("Top to Bottom, Right to Left"), FRAME_ORDER_TOP_BOTTOM_RIGHT_LEFT);
split_sheet_order->add_item(TTRC("Bottom to Top, Left to Right"), FRAME_ORDER_BOTTOM_TOP_LEFT_RIGHT);
split_sheet_order->add_item(TTRC("Bottom to Top, Right to Left"), FRAME_ORDER_BOTTOM_TOP_RIGHT_LEFT);
split_sheet_order->connect(SceneStringName(item_selected), callable_mp(this, &SpriteFramesEditor::_sheet_order_selected));
split_sheet_menu_hb->add_child(split_sheet_order);
Button *select_all = memnew(Button);
select_all->set_text(TTR("Select All"));
select_all->set_text(TTRC("Select All"));
select_all->connect(SceneStringName(pressed), callable_mp(this, &SpriteFramesEditor::_sheet_select_all_frames));
split_sheet_menu_hb->add_child(select_all);
Button *clear_all = memnew(Button);
clear_all->set_text(TTR("Select None"));
clear_all->set_text(TTRC("Select None"));
clear_all->connect(SceneStringName(pressed), callable_mp(this, &SpriteFramesEditor::_sheet_clear_all_frames));
split_sheet_menu_hb->add_child(clear_all);
@ -2324,7 +2348,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
toggle_settings_button->set_h_size_flags(SIZE_SHRINK_END);
toggle_settings_button->set_theme_type_variation(SceneStringName(FlatButton));
toggle_settings_button->connect(SceneStringName(pressed), callable_mp(this, &SpriteFramesEditor::_toggle_show_settings));
toggle_settings_button->set_tooltip_text(TTR("Toggle Settings Panel"));
toggle_settings_button->set_tooltip_text(TTRC("Toggle Settings Panel"));
split_sheet_menu_hb->add_child(toggle_settings_button);
split_sheet_vb->add_child(split_sheet_menu_hb);
@ -2362,21 +2386,21 @@ SpriteFramesEditor::SpriteFramesEditor() {
split_sheet_zoom_out = memnew(Button);
split_sheet_zoom_out->set_theme_type_variation(SceneStringName(FlatButton));
split_sheet_zoom_out->set_focus_mode(FOCUS_ACCESSIBILITY);
split_sheet_zoom_out->set_tooltip_text(TTR("Zoom Out"));
split_sheet_zoom_out->set_tooltip_text(TTRC("Zoom Out"));
split_sheet_zoom_out->connect(SceneStringName(pressed), callable_mp(this, &SpriteFramesEditor::_sheet_zoom_out));
split_sheet_zoom_hb->add_child(split_sheet_zoom_out);
split_sheet_zoom_reset = memnew(Button);
split_sheet_zoom_reset->set_theme_type_variation(SceneStringName(FlatButton));
split_sheet_zoom_reset->set_focus_mode(FOCUS_ACCESSIBILITY);
split_sheet_zoom_reset->set_tooltip_text(TTR("Zoom Reset"));
split_sheet_zoom_reset->set_tooltip_text(TTRC("Zoom Reset"));
split_sheet_zoom_reset->connect(SceneStringName(pressed), callable_mp(this, &SpriteFramesEditor::_sheet_zoom_reset));
split_sheet_zoom_hb->add_child(split_sheet_zoom_reset);
split_sheet_zoom_in = memnew(Button);
split_sheet_zoom_in->set_theme_type_variation(SceneStringName(FlatButton));
split_sheet_zoom_in->set_focus_mode(FOCUS_ACCESSIBILITY);
split_sheet_zoom_in->set_tooltip_text(TTR("Zoom In"));
split_sheet_zoom_in->set_tooltip_text(TTRC("Zoom In"));
split_sheet_zoom_in->connect(SceneStringName(pressed), callable_mp(this, &SpriteFramesEditor::_sheet_zoom_in));
split_sheet_zoom_hb->add_child(split_sheet_zoom_in);
@ -2386,7 +2410,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
HBoxContainer *split_sheet_h_hb = memnew(HBoxContainer);
split_sheet_h_hb->set_h_size_flags(SIZE_EXPAND_FILL);
Label *split_sheet_h_label = memnew(Label(TTR("Horizontal")));
Label *split_sheet_h_label = memnew(Label(TTRC("Horizontal")));
split_sheet_h_label->set_h_size_flags(SIZE_EXPAND_FILL);
split_sheet_h_hb->add_child(split_sheet_h_label);
@ -2404,7 +2428,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
HBoxContainer *split_sheet_v_hb = memnew(HBoxContainer);
split_sheet_v_hb->set_h_size_flags(SIZE_EXPAND_FILL);
Label *split_sheet_v_label = memnew(Label(TTR("Vertical")));
Label *split_sheet_v_label = memnew(Label(TTRC("Vertical")));
split_sheet_v_label->set_h_size_flags(SIZE_EXPAND_FILL);
split_sheet_v_hb->add_child(split_sheet_v_label);
@ -2422,7 +2446,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
HBoxContainer *split_sheet_size_hb = memnew(HBoxContainer);
split_sheet_size_hb->set_h_size_flags(SIZE_EXPAND_FILL);
Label *split_sheet_size_label = memnew(Label(TTR("Size")));
Label *split_sheet_size_label = memnew(Label(TTRC("Size")));
split_sheet_size_label->set_h_size_flags(SIZE_EXPAND_FILL);
split_sheet_size_label->set_v_size_flags(SIZE_SHRINK_BEGIN);
split_sheet_size_hb->add_child(split_sheet_size_label);
@ -2453,7 +2477,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
HBoxContainer *split_sheet_sep_hb = memnew(HBoxContainer);
split_sheet_sep_hb->set_h_size_flags(SIZE_EXPAND_FILL);
Label *split_sheet_sep_label = memnew(Label(TTR("Separation")));
Label *split_sheet_sep_label = memnew(Label(TTRC("Separation")));
split_sheet_sep_label->set_h_size_flags(SIZE_EXPAND_FILL);
split_sheet_sep_label->set_v_size_flags(SIZE_SHRINK_BEGIN);
split_sheet_sep_hb->add_child(split_sheet_sep_label);
@ -2482,7 +2506,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
HBoxContainer *split_sheet_offset_hb = memnew(HBoxContainer);
split_sheet_offset_hb->set_h_size_flags(SIZE_EXPAND_FILL);
Label *split_sheet_offset_label = memnew(Label(TTR("Offset")));
Label *split_sheet_offset_label = memnew(Label(TTRC("Offset")));
split_sheet_offset_label->set_h_size_flags(SIZE_EXPAND_FILL);
split_sheet_offset_label->set_v_size_flags(SIZE_SHRINK_BEGIN);
split_sheet_offset_hb->add_child(split_sheet_offset_label);
@ -2509,14 +2533,14 @@ SpriteFramesEditor::SpriteFramesEditor() {
split_sheet_settings_vb->add_child(split_sheet_offset_hb);
Button *auto_slice = memnew(Button);
auto_slice->set_text(TTR("Auto Slice"));
auto_slice->set_text(TTRC("Auto Slice"));
auto_slice->connect(SceneStringName(pressed), callable_mp(this, &SpriteFramesEditor::_auto_slice_sprite_sheet));
split_sheet_settings_vb->add_child(auto_slice);
split_sheet_hb->add_child(split_sheet_settings_vb);
file_split_sheet = memnew(EditorFileDialog);
file_split_sheet->set_title(TTR("Create Frames from Sprite Sheet"));
file_split_sheet->set_title(TTRC("Create Frames from Sprite Sheet"));
file_split_sheet->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
add_child(file_split_sheet);
file_split_sheet->connect("file_selected", callable_mp(this, &SpriteFramesEditor::_prepare_sprite_sheet));

View file

@ -527,10 +527,8 @@ void InputEventConfigurationDialog::_input_list_item_selected() {
} break;
case INPUT_JOY_BUTTON: {
JoyButton idx = (JoyButton)(int)selected->get_meta("__index");
Ref<InputEventJoypadButton> jb = InputEventJoypadButton::create_reference(idx);
// Maintain selected device
jb->set_device(_get_current_device());
Ref<InputEventJoypadButton> jb = InputEventJoypadButton::create_reference(idx, _get_current_device());
_set_event(jb, jb, false);
} break;

View file

@ -40,3 +40,17 @@ GH-111117
Validate extension JSON: JSON file: Field was added in a way that breaks compatibility 'classes/LineEdit/methods/edit': arguments
Optional argument added. Compatibility method registered.
GH-110767
---------
Validate extension JSON: Error: Field 'classes/AnimationPlayer/methods/get_assigned_animation/return_value': type changed value in new API, from "String" to "StringName".
Validate extension JSON: Error: Field 'classes/AnimationPlayer/methods/get_autoplay/return_value': type changed value in new API, from "String" to "StringName".
Validate extension JSON: Error: Field 'classes/AnimationPlayer/methods/get_current_animation/return_value': type changed value in new API, from "String" to "StringName".
Validate extension JSON: Error: Field 'classes/AnimationPlayer/methods/get_queue/return_value': type changed value in new API, from "PackedStringArray" to "typedarray::StringName".
Validate extension JSON: Error: Field 'classes/AnimationPlayer/methods/set_assigned_animation/arguments/0': type changed value in new API, from "String" to "StringName".
Validate extension JSON: Error: Field 'classes/AnimationPlayer/methods/set_autoplay/arguments/0': type changed value in new API, from "String" to "StringName".
Validate extension JSON: Error: Field 'classes/AnimationPlayer/methods/set_current_animation/arguments/0': type changed value in new API, from "String" to "StringName".
Validate extension JSON: Error: Field 'classes/AnimationPlayer/signals/current_animation_changed/arguments/0': type changed value in new API, from "String" to "StringName".
Return types and parameters changed to StringName to improve performance. Compatibility methods registered; No compatibility system for signal arguments.

View file

@ -58,6 +58,38 @@ void AnimationPlayer::_seek_bind_compat_80813(double p_time, bool p_update) {
seek(p_time, p_update, false);
}
Vector<String> AnimationPlayer::_get_queue_compat_110767() {
Vector<String> queue;
for (const Variant &E : get_queue()) {
queue.push_back(E);
}
return queue;
}
String AnimationPlayer::_get_current_animation_compat_110767() const {
return get_current_animation();
}
void AnimationPlayer::_set_current_animation_compat_110767(const String &p_animation) {
set_current_animation(p_animation);
}
String AnimationPlayer::_get_assigned_animation_compat_110767() const {
return get_assigned_animation();
}
void AnimationPlayer::_set_assigned_animation_compat_110767(const String &p_animation) {
set_assigned_animation(p_animation);
}
String AnimationPlayer::_get_autoplay_compat_110767() const {
return get_autoplay();
}
void AnimationPlayer::_set_autoplay_compat_110767(const String &p_name) {
set_autoplay(p_name);
}
void AnimationPlayer::_bind_compatibility_methods() {
ClassDB::bind_method(D_METHOD("set_process_callback", "mode"), &AnimationPlayer::_set_process_callback_bind_compat_80813);
ClassDB::bind_method(D_METHOD("get_process_callback"), &AnimationPlayer::_get_process_callback_bind_compat_80813);
@ -65,6 +97,15 @@ void AnimationPlayer::_bind_compatibility_methods() {
ClassDB::bind_method(D_METHOD("get_method_call_mode"), &AnimationPlayer::_get_method_call_mode_bind_compat_80813);
ClassDB::bind_method(D_METHOD("set_root", "path"), &AnimationPlayer::_set_root_bind_compat_80813);
ClassDB::bind_method(D_METHOD("get_root"), &AnimationPlayer::_get_root_bind_compat_80813);
ClassDB::bind_compatibility_method(D_METHOD("get_queue"), &AnimationPlayer::_get_queue_compat_110767);
ClassDB::bind_compatibility_method(D_METHOD("get_current_animation"), &AnimationPlayer::_get_current_animation_compat_110767);
ClassDB::bind_compatibility_method(D_METHOD("set_current_animation", "animation"), &AnimationPlayer::_set_current_animation_compat_110767);
ClassDB::bind_compatibility_method(D_METHOD("get_assigned_animation"), &AnimationPlayer::_get_assigned_animation_compat_110767);
ClassDB::bind_compatibility_method(D_METHOD("set_assigned_animation", "animation"), &AnimationPlayer::_set_assigned_animation_compat_110767);
ClassDB::bind_compatibility_method(D_METHOD("get_autoplay"), &AnimationPlayer::_get_autoplay_compat_110767);
ClassDB::bind_compatibility_method(D_METHOD("set_autoplay", "name"), &AnimationPlayer::_set_autoplay_compat_110767);
ClassDB::bind_compatibility_method(D_METHOD("seek", "seconds", "update"), &AnimationPlayer::_seek_bind_compat_80813, DEFVAL(false));
BIND_ENUM_CONSTANT(ANIMATION_PROCESS_PHYSICS);
BIND_ENUM_CONSTANT(ANIMATION_PROCESS_IDLE);

View file

@ -365,8 +365,8 @@ void AnimationPlayer::queue(const StringName &p_name) {
}
}
Vector<String> AnimationPlayer::get_queue() {
Vector<String> ret;
TypedArray<StringName> AnimationPlayer::get_queue() {
TypedArray<StringName> ret;
for (const StringName &E : playback_queue) {
ret.push_back(E);
}
@ -579,8 +579,8 @@ bool AnimationPlayer::is_playing() const {
return playing;
}
void AnimationPlayer::set_current_animation(const String &p_animation) {
if (p_animation == "[stop]" || p_animation.is_empty()) {
void AnimationPlayer::set_current_animation(const StringName &p_animation) {
if (p_animation == SNAME("[stop]") || p_animation.is_empty()) {
stop();
} else if (!is_playing()) {
play(p_animation);
@ -592,16 +592,16 @@ void AnimationPlayer::set_current_animation(const String &p_animation) {
}
}
String AnimationPlayer::get_current_animation() const {
return (is_playing() ? playback.assigned : "");
StringName AnimationPlayer::get_current_animation() const {
return (is_playing() ? playback.assigned : StringName());
}
void AnimationPlayer::set_assigned_animation(const String &p_animation) {
void AnimationPlayer::set_assigned_animation(const StringName &p_animation) {
if (is_playing()) {
float speed = playback.current.speed_scale;
play(p_animation, -1.0, speed, std::signbit(speed));
} else {
ERR_FAIL_COND_MSG(!animation_set.has(p_animation), vformat("Animation not found: %s.", p_animation));
ERR_FAIL_COND_MSG(!animation_set.has(p_animation), vformat("Animation not found: %s.", p_animation.operator String()));
playback.current.pos = 0;
playback.current.from = &animation_set[p_animation];
playback.current.start_time = -1;
@ -611,7 +611,7 @@ void AnimationPlayer::set_assigned_animation(const String &p_animation) {
}
}
String AnimationPlayer::get_assigned_animation() const {
StringName AnimationPlayer::get_assigned_animation() const {
return playback.assigned;
}
@ -745,7 +745,7 @@ bool AnimationPlayer::has_section() const {
return Animation::is_greater_or_equal_approx(playback.current.start_time, 0) || Animation::is_greater_or_equal_approx(playback.current.end_time, 0);
}
void AnimationPlayer::set_autoplay(const String &p_name) {
void AnimationPlayer::set_autoplay(const StringName &p_name) {
if (is_inside_tree() && !Engine::get_singleton()->is_editor_hint()) {
WARN_PRINT("Setting autoplay after the node has been added to the scene has no effect.");
}
@ -753,7 +753,7 @@ void AnimationPlayer::set_autoplay(const String &p_name) {
autoplay = p_name;
}
String AnimationPlayer::get_autoplay() const {
StringName AnimationPlayer::get_autoplay() const {
return autoplay;
}
@ -977,6 +977,7 @@ void AnimationPlayer::_bind_methods() {
ClassDB::bind_method(D_METHOD("pause"), &AnimationPlayer::pause);
ClassDB::bind_method(D_METHOD("stop", "keep_state"), &AnimationPlayer::stop, DEFVAL(false));
ClassDB::bind_method(D_METHOD("is_playing"), &AnimationPlayer::is_playing);
ClassDB::bind_method(D_METHOD("is_animation_active"), &AnimationPlayer::is_valid);
ClassDB::bind_method(D_METHOD("set_current_animation", "animation"), &AnimationPlayer::set_current_animation);
ClassDB::bind_method(D_METHOD("get_current_animation"), &AnimationPlayer::get_current_animation);
@ -1028,7 +1029,7 @@ void AnimationPlayer::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "speed_scale", PROPERTY_HINT_RANGE, "-4,4,0.001,or_less,or_greater"), "set_speed_scale", "get_speed_scale");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "movie_quit_on_finish"), "set_movie_quit_on_finish_enabled", "is_movie_quit_on_finish_enabled");
ADD_SIGNAL(MethodInfo(SNAME("current_animation_changed"), PropertyInfo(Variant::STRING, "name")));
ADD_SIGNAL(MethodInfo(SNAME("current_animation_changed"), PropertyInfo(Variant::STRING_NAME, "name")));
ADD_SIGNAL(MethodInfo(SNAME("animation_changed"), PropertyInfo(Variant::STRING_NAME, "old_name"), PropertyInfo(Variant::STRING_NAME, "new_name")));
}

View file

@ -166,6 +166,14 @@ protected:
void _play_compat_84906(const StringName &p_name = StringName(), double p_custom_blend = -1, float p_custom_scale = 1.0, bool p_from_end = false);
void _play_backwards_compat_84906(const StringName &p_name = StringName(), double p_custom_blend = -1);
Vector<String> _get_queue_compat_110767();
String _get_current_animation_compat_110767() const;
void _set_current_animation_compat_110767(const String &p_animation);
String _get_assigned_animation_compat_110767() const;
void _set_assigned_animation_compat_110767(const String &p_animation);
String _get_autoplay_compat_110767() const;
void _set_autoplay_compat_110767(const String &p_name);
static void _bind_compatibility_methods();
#endif // DISABLE_DEPRECATED
@ -200,23 +208,23 @@ public:
void play_section_backwards(const StringName &p_name = StringName(), double p_start_time = -1, double p_end_time = -1, double p_custom_blend = -1);
void play_with_capture(const StringName &p_name = StringName(), double p_duration = -1.0, double p_custom_blend = -1, float p_custom_scale = 1.0, bool p_from_end = false, Tween::TransitionType p_trans_type = Tween::TRANS_LINEAR, Tween::EaseType p_ease_type = Tween::EASE_IN);
void queue(const StringName &p_name);
Vector<String> get_queue();
TypedArray<StringName> get_queue();
void clear_queue();
void pause();
void stop(bool p_keep_state = false);
bool is_playing() const;
String get_current_animation() const;
void set_current_animation(const String &p_animation);
String get_assigned_animation() const;
void set_assigned_animation(const String &p_animation);
StringName get_current_animation() const;
void set_current_animation(const StringName &p_animation);
StringName get_assigned_animation() const;
void set_assigned_animation(const StringName &p_animation);
bool is_valid() const;
void set_speed_scale(float p_speed);
float get_speed_scale() const;
float get_playing_speed() const;
void set_autoplay(const String &p_name);
String get_autoplay() const;
void set_autoplay(const StringName &p_name);
StringName get_autoplay() const;
void set_movie_quit_on_finish_enabled(bool p_enabled);
bool is_movie_quit_on_finish_enabled() const;

View file

@ -260,11 +260,8 @@ private:
RID contact_3d_debug_multimesh;
RID contact_3d_debug_instance;
Rect2 last_vp_rect;
bool transparent_bg = false;
bool use_hdr_2d = false;
bool gen_mipmaps = false;
bool snap_controls_to_pixels = true;
bool snap_2d_transforms_to_pixel = false;

View file

@ -37,33 +37,8 @@
// Theme owner node.
void ThemeOwner::set_owner_node(Node *p_node) {
owner_control = nullptr;
owner_window = nullptr;
Control *c = Object::cast_to<Control>(p_node);
if (c) {
owner_control = c;
return;
}
Window *w = Object::cast_to<Window>(p_node);
if (w) {
owner_window = w;
return;
}
}
Node *ThemeOwner::get_owner_node() const {
if (owner_control) {
return owner_control;
} else if (owner_window) {
return owner_window;
}
return nullptr;
}
bool ThemeOwner::has_owner_node() const {
return bool(owner_control || owner_window);
ERR_FAIL_COND(p_node && !Object::cast_to<Control>(p_node) && !Object::cast_to<Window>(p_node));
owner_node = p_node;
}
void ThemeOwner::set_owner_context(ThemeContext *p_context, bool p_propagate) {
@ -219,16 +194,16 @@ void ThemeOwner::get_theme_type_dependencies(const Node *p_for_node, const Strin
// and eventually the chain must lead to native types).
// First, look through themes owned by nodes in the tree.
Node *owner_node = get_owner_node();
Node *current_owner = owner_node;
while (owner_node) {
Ref<Theme> owner_theme = _get_owner_node_theme(owner_node);
while (current_owner) {
Ref<Theme> owner_theme = _get_owner_node_theme(current_owner);
if (owner_theme.is_valid() && owner_theme->get_type_variation_base(type_variation) != StringName()) {
owner_theme->get_type_dependencies(type_name, type_variation, r_result);
return;
}
owner_node = _get_next_owner_node(owner_node);
current_owner = _get_next_owner_node(current_owner);
}
// Second, check global contexts.
@ -254,19 +229,19 @@ Variant ThemeOwner::get_theme_item_in_types(Theme::DataType p_data_type, const S
// First, look through each control or window node in the branch, until no valid parent can be found.
// Only nodes with a theme resource attached are considered.
Node *owner_node = get_owner_node();
Node *current_owner = owner_node;
while (owner_node) {
while (current_owner) {
// For each theme resource check the theme types provided and see if p_name exists with any of them.
for (const StringName &E : p_theme_types) {
Ref<Theme> owner_theme = _get_owner_node_theme(owner_node);
Ref<Theme> owner_theme = _get_owner_node_theme(current_owner);
if (owner_theme.is_valid() && owner_theme->has_theme_item(p_data_type, p_name, E)) {
return owner_theme->get_theme_item(p_data_type, p_name, E);
}
}
owner_node = _get_next_owner_node(owner_node);
current_owner = _get_next_owner_node(current_owner);
}
// Second, check global themes from the appropriate context.
@ -290,19 +265,19 @@ bool ThemeOwner::has_theme_item_in_types(Theme::DataType p_data_type, const Stri
// First, look through each control or window node in the branch, until no valid parent can be found.
// Only nodes with a theme resource attached are considered.
Node *owner_node = get_owner_node();
Node *current_owner = owner_node;
while (owner_node) {
while (current_owner) {
// For each theme resource check the theme types provided and see if p_name exists with any of them.
for (const StringName &E : p_theme_types) {
Ref<Theme> owner_theme = _get_owner_node_theme(owner_node);
Ref<Theme> owner_theme = _get_owner_node_theme(current_owner);
if (owner_theme.is_valid() && owner_theme->has_theme_item(p_data_type, p_name, E)) {
return true;
}
}
owner_node = _get_next_owner_node(owner_node);
current_owner = _get_next_owner_node(current_owner);
}
// Second, check global themes from the appropriate context.
@ -325,16 +300,16 @@ float ThemeOwner::get_theme_default_base_scale() {
// First, look through each control or window node in the branch, until no valid parent can be found.
// Only nodes with a theme resource attached are considered.
// For each theme resource see if their assigned theme has the default value defined and valid.
Node *owner_node = get_owner_node();
Node *current_owner = owner_node;
while (owner_node) {
Ref<Theme> owner_theme = _get_owner_node_theme(owner_node);
while (current_owner) {
Ref<Theme> owner_theme = _get_owner_node_theme(current_owner);
if (owner_theme.is_valid() && owner_theme->has_default_base_scale()) {
return owner_theme->get_default_base_scale();
}
owner_node = _get_next_owner_node(owner_node);
current_owner = _get_next_owner_node(current_owner);
}
// Second, check global themes from the appropriate context.
@ -355,16 +330,16 @@ Ref<Font> ThemeOwner::get_theme_default_font() {
// First, look through each control or window node in the branch, until no valid parent can be found.
// Only nodes with a theme resource attached are considered.
// For each theme resource see if their assigned theme has the default value defined and valid.
Node *owner_node = get_owner_node();
Node *current_owner = owner_node;
while (owner_node) {
Ref<Theme> owner_theme = _get_owner_node_theme(owner_node);
while (current_owner) {
Ref<Theme> owner_theme = _get_owner_node_theme(current_owner);
if (owner_theme.is_valid() && owner_theme->has_default_font()) {
return owner_theme->get_default_font();
}
owner_node = _get_next_owner_node(owner_node);
current_owner = _get_next_owner_node(current_owner);
}
// Second, check global themes from the appropriate context.
@ -385,16 +360,16 @@ int ThemeOwner::get_theme_default_font_size() {
// First, look through each control or window node in the branch, until no valid parent can be found.
// Only nodes with a theme resource attached are considered.
// For each theme resource see if their assigned theme has the default value defined and valid.
Node *owner_node = get_owner_node();
Node *current_owner = owner_node;
while (owner_node) {
Ref<Theme> owner_theme = _get_owner_node_theme(owner_node);
while (current_owner) {
Ref<Theme> owner_theme = _get_owner_node_theme(current_owner);
if (owner_theme.is_valid() && owner_theme->has_default_font_size()) {
return owner_theme->get_default_font_size();
}
owner_node = _get_next_owner_node(owner_node);
current_owner = _get_next_owner_node(current_owner);
}
// Second, check global themes from the appropriate context.

View file

@ -43,8 +43,7 @@ class ThemeOwner : public Object {
Node *holder = nullptr;
Control *owner_control = nullptr;
Window *owner_window = nullptr;
Node *owner_node = nullptr;
ThemeContext *owner_context = nullptr;
void _owner_context_changed();
@ -57,8 +56,8 @@ public:
// Theme owner node.
void set_owner_node(Node *p_node);
Node *get_owner_node() const;
bool has_owner_node() const;
Node *get_owner_node() const { return owner_node; }
bool has_owner_node() const { return owner_node != nullptr; }
void set_owner_context(ThemeContext *p_context, bool p_propagate = true);

View file

@ -14,18 +14,11 @@ SConscript("display/SCsub")
SConscript("movie_writer/SCsub")
SConscript("rendering/SCsub")
SConscript("text/SCsub")
if not env["disable_navigation_2d"]:
SConscript("navigation_2d/SCsub")
if not env["disable_physics_2d"]:
SConscript("physics_2d/SCsub")
if not env["disable_navigation_3d"]:
SConscript("navigation_3d/SCsub")
if not env["disable_physics_3d"]:
SConscript("physics_3d/SCsub")
if not env["disable_xr"]:
SConscript("xr/SCsub")
SConscript("navigation_2d/SCsub")
SConscript("physics_2d/SCsub")
SConscript("navigation_3d/SCsub")
SConscript("physics_3d/SCsub")
SConscript("xr/SCsub")
lib = env.add_library("servers", env.servers_sources)

View file

@ -3,4 +3,5 @@ from misc.utility.scons_hints import *
Import("env")
env.add_source_files(env.servers_sources, "*.cpp")
if not env["disable_navigation_2d"]:
env.add_source_files(env.servers_sources, "*.cpp")

View file

@ -3,4 +3,8 @@ from misc.utility.scons_hints import *
Import("env")
env.add_source_files(env.servers_sources, "*.cpp")
if not env["disable_navigation_3d"]:
env.add_source_files(env.servers_sources, "*.cpp")
else:
if env.debug_features:
env.add_source_files(env.servers_sources, "navigation_server_3d.cpp")

View file

@ -3,4 +3,5 @@ from misc.utility.scons_hints import *
Import("env")
env.add_source_files(env.servers_sources, "*.cpp")
if not env["disable_physics_2d"]:
env.add_source_files(env.servers_sources, "*.cpp")

View file

@ -3,4 +3,5 @@ from misc.utility.scons_hints import *
Import("env")
env.add_source_files(env.servers_sources, "*.cpp")
if not env["disable_physics_3d"]:
env.add_source_files(env.servers_sources, "*.cpp")

View file

@ -762,10 +762,10 @@ void SceneShaderForwardClustered::init(const String p_defines) {
actions.renames["LIGHT_VERTEX"] = "light_vertex";
actions.renames["NODE_POSITION_WORLD"] = "read_model_matrix[3].xyz";
actions.renames["CAMERA_POSITION_WORLD"] = "scene_data.inv_view_matrix[3].xyz";
actions.renames["CAMERA_DIRECTION_WORLD"] = "scene_data.inv_view_matrix[2].xyz";
actions.renames["CAMERA_POSITION_WORLD"] = "inv_view_matrix[3].xyz";
actions.renames["CAMERA_DIRECTION_WORLD"] = "inv_view_matrix[2].xyz";
actions.renames["CAMERA_VISIBLE_LAYERS"] = "scene_data.camera_visible_layers";
actions.renames["NODE_POSITION_VIEW"] = "(scene_data.view_matrix * read_model_matrix)[3].xyz";
actions.renames["NODE_POSITION_VIEW"] = "(read_view_matrix * read_model_matrix)[3].xyz";
actions.renames["VIEW_INDEX"] = "ViewIndex";
actions.renames["VIEW_MONO_LEFT"] = "0";

View file

@ -696,10 +696,10 @@ void SceneShaderForwardMobile::init(const String p_defines) {
actions.renames["LIGHT_VERTEX"] = "light_vertex";
actions.renames["NODE_POSITION_WORLD"] = "read_model_matrix[3].xyz";
actions.renames["CAMERA_POSITION_WORLD"] = "scene_data.inv_view_matrix[3].xyz";
actions.renames["CAMERA_DIRECTION_WORLD"] = "scene_data.inv_view_matrix[2].xyz";
actions.renames["CAMERA_POSITION_WORLD"] = "inv_view_matrix[3].xyz";
actions.renames["CAMERA_DIRECTION_WORLD"] = "inv_view_matrix[2].xyz";
actions.renames["CAMERA_VISIBLE_LAYERS"] = "scene_data.camera_visible_layers";
actions.renames["NODE_POSITION_VIEW"] = "(scene_data.view_matrix * read_model_matrix)[3].xyz";
actions.renames["NODE_POSITION_VIEW"] = "(read_view_matrix * read_model_matrix)[3].xyz";
actions.renames["VIEW_INDEX"] = "ViewIndex";
actions.renames["VIEW_MONO_LEFT"] = "0";

View file

@ -81,15 +81,26 @@ void light_compute(hvec3 N, hvec3 L, hvec3 V, half A, hvec3 light_color, bool is
inout hvec3 diffuse_light, inout hvec3 specular_light) {
#if defined(LIGHT_CODE_USED)
// Light is written by the user shader.
mat4 inv_view_matrix = scene_data_block.data.inv_view_matrix;
mat4 read_view_matrix = scene_data_block.data.view_matrix;
mat4 inv_view_matrix = transpose(mat4(scene_data_block.data.inv_view_matrix[0],
scene_data_block.data.inv_view_matrix[1],
scene_data_block.data.inv_view_matrix[2],
vec4(0.0, 0.0, 0.0, 1.0)));
mat4 read_view_matrix = transpose(mat4(scene_data_block.data.view_matrix[0],
scene_data_block.data.view_matrix[1],
scene_data_block.data.view_matrix[2],
vec4(0.0, 0.0, 0.0, 1.0)));
#ifdef USING_MOBILE_RENDERER
mat4 read_model_matrix = instances.data[draw_call.instance_index].transform;
uint instance_index = draw_call.instance_index;
#else
mat4 read_model_matrix = instances.data[instance_index_interp].transform;
uint instance_index = instance_index_interp;
#endif
mat4 read_model_matrix = transpose(mat4(instances.data[instance_index].transform[0],
instances.data[instance_index].transform[1],
instances.data[instance_index].transform[2],
vec4(0.0, 0.0, 0.0, 1.0)));
#undef projection_matrix
#define projection_matrix scene_data_block.data.projection_matrix
#undef inv_projection_matrix

View file

@ -33,8 +33,6 @@
#include "core/object/object.h"
#include "core/variant/type_info.h"
#include <algorithm>
#define STEPIFY(m_number, m_alignment) ((((m_number) + ((m_alignment) - 1)) / (m_alignment)) * (m_alignment))
// This may one day be used in Godot for interoperability between C arrays, Vector and LocalVector.

View file

@ -70,7 +70,7 @@ class RenderingShaderContainerFormat;
template <typename... RESOURCE_TYPES>
struct VersatileResourceTemplate {
static constexpr size_t RESOURCE_SIZES[] = { sizeof(RESOURCE_TYPES)... };
static constexpr size_t MAX_RESOURCE_SIZE = std::max_element(RESOURCE_SIZES, RESOURCE_SIZES + sizeof...(RESOURCE_TYPES))[0];
static constexpr size_t MAX_RESOURCE_SIZE = Span(RESOURCE_SIZES).max();
uint8_t data[MAX_RESOURCE_SIZE];
template <typename T>

View file

@ -3,4 +3,5 @@ from misc.utility.scons_hints import *
Import("env")
env.add_source_files(env.servers_sources, "*.cpp")
if not env["disable_xr"]:
env.add_source_files(env.servers_sources, "*.cpp")