summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/animation_bezier_editor.cpp2
-rw-r--r--editor/animation_track_editor.cpp74
-rw-r--r--editor/animation_track_editor.h2
-rw-r--r--editor/connections_dialog.cpp8
-rw-r--r--editor/debugger/editor_debugger_node.cpp5
-rw-r--r--editor/debugger/editor_debugger_node.h3
-rw-r--r--editor/debugger/editor_debugger_server.cpp48
-rw-r--r--editor/debugger/editor_debugger_server.h4
-rw-r--r--editor/debugger/editor_debugger_tree.cpp2
-rw-r--r--editor/debugger/script_editor_debugger.cpp2
-rw-r--r--editor/dependency_editor.cpp3
-rw-r--r--editor/doc_tools.cpp12
-rw-r--r--editor/editor_audio_buses.cpp10
-rw-r--r--editor/editor_file_dialog.cpp6
-rw-r--r--editor/editor_folding.cpp4
-rw-r--r--editor/editor_help.cpp39
-rw-r--r--editor/editor_inspector.cpp7
-rw-r--r--editor/editor_node.cpp16
-rw-r--r--editor/editor_properties.cpp3
-rw-r--r--editor/editor_run.cpp30
-rw-r--r--editor/editor_run.h2
-rw-r--r--editor/filesystem_dock.cpp11
-rw-r--r--editor/import/dynamicfont_import_settings.cpp4
-rw-r--r--editor/plugins/animation_blend_space_1d_editor.cpp3
-rw-r--r--editor/plugins/animation_blend_space_2d_editor.cpp3
-rw-r--r--editor/plugins/animation_blend_tree_editor_plugin.cpp17
-rw-r--r--editor/plugins/animation_blend_tree_editor_plugin.h4
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp5
-rw-r--r--editor/plugins/animation_state_machine_editor.cpp5
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp5
-rw-r--r--editor/plugins/curve_editor_plugin.cpp2
-rw-r--r--editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp46
-rw-r--r--editor/plugins/gpu_particles_collision_sdf_editor_plugin.h1
-rw-r--r--editor/plugins/node_3d_editor_gizmos.cpp1
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp4
-rw-r--r--editor/plugins/ot_features_plugin.cpp1
-rw-r--r--editor/plugins/script_editor_plugin.cpp2
-rw-r--r--editor/plugins/script_text_editor.cpp4
-rw-r--r--editor/plugins/shader_editor_plugin.cpp2
-rw-r--r--editor/plugins/text_editor.cpp2
-rw-r--r--editor/plugins/tiles/tile_map_editor.cpp2
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp30
-rw-r--r--editor/plugins/voxel_gi_editor_plugin.cpp45
-rw-r--r--editor/plugins/voxel_gi_editor_plugin.h1
-rw-r--r--editor/scene_tree_editor.cpp2
45 files changed, 304 insertions, 180 deletions
diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp
index f7f88ad0d5..a970ce3f1d 100644
--- a/editor/animation_bezier_editor.cpp
+++ b/editor/animation_bezier_editor.cpp
@@ -663,7 +663,7 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
if (mb.is_valid() && mb->get_button_index() == MouseButton::RIGHT && mb->is_pressed()) {
menu_insert_key = mb->get_position();
if (menu_insert_key.x >= timeline->get_name_limit() && menu_insert_key.x <= get_size().width - timeline->get_buttons_width()) {
- Vector2 popup_pos = get_global_transform().xform(mb->get_position());
+ Vector2 popup_pos = get_screen_position() + mb->get_position();
menu->clear();
menu->add_icon_item(bezier_icon, TTR("Insert Key Here"), MENU_KEY_INSERT);
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index 6fce55f8e3..51d3eca149 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -39,6 +39,7 @@
#include "editor_scale.h"
#include "scene/animation/animation_player.h"
#include "scene/main/window.h"
+#include "scene/scene_string_names.h"
#include "servers/audio/audio_stream.h"
class AnimationTrackKeyEdit : public Object {
@@ -2872,13 +2873,18 @@ void AnimationTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
if (editor->is_selection_active()) {
menu->add_separator();
menu->add_icon_item(get_theme_icon(SNAME("Duplicate"), SNAME("EditorIcons")), TTR("Duplicate Key(s)"), MENU_KEY_DUPLICATE);
+
+ AnimationPlayer *player = AnimationPlayerEditor::get_singleton()->get_player();
+ if (!player->has_animation(SceneStringNames::get_singleton()->RESET) || animation != player->get_animation(SceneStringNames::get_singleton()->RESET)) {
+ menu->add_icon_item(get_theme_icon(SNAME("Reload"), SNAME("EditorIcons")), TTR("Add RESET Value(s)"), MENU_KEY_ADD_RESET);
+ }
+
menu->add_separator();
menu->add_icon_item(get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), TTR("Delete Key(s)"), MENU_KEY_DELETE);
}
menu->set_as_minsize();
- Vector2 popup_pos = get_screen_transform().xform(get_local_mouse_position());
- menu->set_position(popup_pos);
+ menu->set_position(get_screen_position() + get_local_mouse_position());
menu->popup();
insert_at_pos = offset + timeline->get_value();
@@ -3061,6 +3067,9 @@ void AnimationTrackEdit::_menu_selected(int p_index) {
} break;
case MENU_KEY_DUPLICATE: {
emit_signal(SNAME("duplicate_request"));
+ } break;
+ case MENU_KEY_ADD_RESET: {
+ emit_signal(SNAME("create_reset_request"));
} break;
case MENU_KEY_DELETE: {
@@ -3123,6 +3132,7 @@ void AnimationTrackEdit::_bind_methods() {
ADD_SIGNAL(MethodInfo("move_selection_cancel"));
ADD_SIGNAL(MethodInfo("duplicate_request"));
+ ADD_SIGNAL(MethodInfo("create_reset_request"));
ADD_SIGNAL(MethodInfo("duplicate_transpose_request"));
ADD_SIGNAL(MethodInfo("delete_request"));
}
@@ -3505,7 +3515,7 @@ void AnimationTrackEditor::make_insert_queue() {
void AnimationTrackEditor::commit_insert_queue() {
bool reset_allowed = true;
AnimationPlayer *player = AnimationPlayerEditor::get_singleton()->get_player();
- if (player->has_animation("RESET") && player->get_animation("RESET") == animation) {
+ if (player->has_animation(SceneStringNames::get_singleton()->RESET) && player->get_animation(SceneStringNames::get_singleton()->RESET) == animation) {
// Avoid messing with the reset animation itself.
reset_allowed = false;
} else {
@@ -3925,15 +3935,15 @@ void AnimationTrackEditor::insert_value_key(const String &p_property, const Vari
Ref<Animation> AnimationTrackEditor::_create_and_get_reset_animation() {
AnimationPlayer *player = AnimationPlayerEditor::get_singleton()->get_player();
- if (player->has_animation("RESET")) {
- return player->get_animation("RESET");
+ if (player->has_animation(SceneStringNames::get_singleton()->RESET)) {
+ return player->get_animation(SceneStringNames::get_singleton()->RESET);
} else {
Ref<Animation> reset_anim;
reset_anim.instantiate();
reset_anim->set_length(ANIM_MIN_LENGTH);
- undo_redo->add_do_method(player, "add_animation", "RESET", reset_anim);
+ undo_redo->add_do_method(player, "add_animation", SceneStringNames::get_singleton()->RESET, reset_anim);
undo_redo->add_do_method(AnimationPlayerEditor::get_singleton(), "_animation_player_changed", player);
- undo_redo->add_undo_method(player, "remove_animation", "RESET");
+ undo_redo->add_undo_method(player, "remove_animation", SceneStringNames::get_singleton()->RESET);
undo_redo->add_undo_method(AnimationPlayerEditor::get_singleton(), "_animation_player_changed", player);
return reset_anim;
}
@@ -4388,6 +4398,7 @@ void AnimationTrackEditor::_update_tracks() {
track_edit->connect("duplicate_request", callable_mp(this, &AnimationTrackEditor::_edit_menu_pressed), varray(EDIT_DUPLICATE_SELECTION), CONNECT_DEFERRED);
track_edit->connect("duplicate_transpose_request", callable_mp(this, &AnimationTrackEditor::_edit_menu_pressed), varray(EDIT_DUPLICATE_TRANSPOSED), CONNECT_DEFERRED);
+ track_edit->connect("create_reset_request", callable_mp(this, &AnimationTrackEditor::_edit_menu_pressed), varray(EDIT_ADD_RESET_KEY), CONNECT_DEFERRED);
track_edit->connect("delete_request", callable_mp(this, &AnimationTrackEditor::_edit_menu_pressed), varray(EDIT_DELETE_SELECTION), CONNECT_DEFERRED);
}
}
@@ -5720,6 +5731,54 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
}
_anim_duplicate_keys(true);
} break;
+ case EDIT_ADD_RESET_KEY: {
+ undo_redo->create_action(TTR("Anim Add RESET Keys"));
+ Ref<Animation> reset = _create_and_get_reset_animation();
+ int reset_tracks = reset->get_track_count();
+ Set<int> tracks_added;
+
+ for (const KeyValue<SelectedKey, KeyInfo> &E : selection) {
+ const SelectedKey &sk = E.key;
+
+ // Only add one key per track.
+ if (tracks_added.has(sk.track)) {
+ continue;
+ }
+ tracks_added.insert(sk.track);
+
+ int dst_track = -1;
+
+ const NodePath &path = animation->track_get_path(sk.track);
+ for (int i = 0; i < reset->get_track_count(); i++) {
+ if (reset->track_get_path(i) == path) {
+ dst_track = i;
+ break;
+ }
+ }
+
+ if (dst_track == -1) {
+ // If adding multiple tracks, make sure that correct track is referenced.
+ dst_track = reset_tracks;
+ reset_tracks++;
+
+ undo_redo->add_do_method(reset.ptr(), "add_track", animation->track_get_type(sk.track));
+ undo_redo->add_do_method(reset.ptr(), "track_set_path", dst_track, path);
+ undo_redo->add_undo_method(reset.ptr(), "remove_track", dst_track);
+ }
+
+ int existing_idx = reset->track_find_key(dst_track, 0, true);
+
+ undo_redo->add_do_method(reset.ptr(), "track_insert_key", dst_track, 0, animation->track_get_key_value(sk.track, sk.key), animation->track_get_key_transition(sk.track, sk.key));
+ undo_redo->add_undo_method(reset.ptr(), "track_remove_key_at_time", dst_track, 0);
+
+ if (existing_idx != -1) {
+ undo_redo->add_undo_method(reset.ptr(), "track_insert_key", dst_track, 0, reset->track_get_key_value(dst_track, existing_idx), reset->track_get_key_transition(dst_track, existing_idx));
+ }
+ }
+
+ undo_redo->commit_action();
+
+ } break;
case EDIT_DELETE_SELECTION: {
if (bezier_edit->is_visible()) {
bezier_edit->delete_selection();
@@ -6144,6 +6203,7 @@ AnimationTrackEditor::AnimationTrackEditor() {
edit->get_popup()->add_separator();
edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/duplicate_selection", TTR("Duplicate Selection"), KeyModifierMask::CMD | Key::D), EDIT_DUPLICATE_SELECTION);
edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/duplicate_selection_transposed", TTR("Duplicate Transposed"), KeyModifierMask::SHIFT | KeyModifierMask::CMD | Key::D), EDIT_DUPLICATE_TRANSPOSED);
+ edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/add_reset_value", TTR("Add RESET Value(s)")));
edit->get_popup()->add_separator();
edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/delete_selection", TTR("Delete Selection"), Key::KEY_DELETE), EDIT_DELETE_SELECTION);
diff --git a/editor/animation_track_editor.h b/editor/animation_track_editor.h
index 2bdc1d4107..5ebfd26322 100644
--- a/editor/animation_track_editor.h
+++ b/editor/animation_track_editor.h
@@ -140,6 +140,7 @@ class AnimationTrackEdit : public Control {
MENU_LOOP_CLAMP,
MENU_KEY_INSERT,
MENU_KEY_DUPLICATE,
+ MENU_KEY_ADD_RESET,
MENU_KEY_DELETE
};
AnimationTimelineEdit *timeline;
@@ -500,6 +501,7 @@ public:
EDIT_SCALE_CONFIRM,
EDIT_DUPLICATE_SELECTION,
EDIT_DUPLICATE_TRANSPOSED,
+ EDIT_ADD_RESET_KEY,
EDIT_DELETE_SELECTION,
EDIT_GOTO_NEXT_STEP,
EDIT_GOTO_PREV_STEP,
diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp
index d00fdd0ce7..2088a7e1c4 100644
--- a/editor/connections_dialog.cpp
+++ b/editor/connections_dialog.cpp
@@ -838,13 +838,15 @@ void ConnectionsDock::_rmb_pressed(Vector2 position) {
return;
}
- Vector2 global_position = tree->get_global_position() + position;
+ Vector2 screen_position = tree->get_screen_position() + position;
if (_is_item_signal(*item)) {
- signal_menu->set_position(global_position);
+ signal_menu->set_position(screen_position);
+ signal_menu->reset_size();
signal_menu->popup();
} else {
- slot_menu->set_position(global_position);
+ slot_menu->set_position(screen_position);
+ slot_menu->reset_size();
slot_menu->popup();
}
}
diff --git a/editor/debugger/editor_debugger_node.cpp b/editor/debugger/editor_debugger_node.cpp
index 391839d639..85cf1558fe 100644
--- a/editor/debugger/editor_debugger_node.cpp
+++ b/editor/debugger/editor_debugger_node.cpp
@@ -183,6 +183,11 @@ ScriptEditorDebugger *EditorDebuggerNode::get_default_debugger() const {
return Object::cast_to<ScriptEditorDebugger>(tabs->get_tab_control(0));
}
+String EditorDebuggerNode::get_server_uri() const {
+ ERR_FAIL_COND_V(server.is_null(), "");
+ return server->get_uri();
+}
+
Error EditorDebuggerNode::start(const String &p_uri) {
stop();
ERR_FAIL_COND_V(p_uri.find("://") < 0, ERR_INVALID_PARAMETER);
diff --git a/editor/debugger/editor_debugger_node.h b/editor/debugger/editor_debugger_node.h
index 4d9e846834..135122db68 100644
--- a/editor/debugger/editor_debugger_node.h
+++ b/editor/debugger/editor_debugger_node.h
@@ -188,8 +188,9 @@ public:
void set_camera_override(CameraOverride p_override);
CameraOverride get_camera_override();
- Error start(const String &p_uri = "tcp://");
+ String get_server_uri() const;
+ Error start(const String &p_uri = "tcp://");
void stop();
void add_debugger_plugin(const Ref<Script> &p_script);
diff --git a/editor/debugger/editor_debugger_server.cpp b/editor/debugger/editor_debugger_server.cpp
index 8c3833af50..34904d55aa 100644
--- a/editor/debugger/editor_debugger_server.cpp
+++ b/editor/debugger/editor_debugger_server.cpp
@@ -41,15 +41,18 @@
class EditorDebuggerServerTCP : public EditorDebuggerServer {
private:
Ref<TCPServer> server;
+ String endpoint;
public:
static EditorDebuggerServer *create(const String &p_protocol);
- virtual void poll() {}
- virtual Error start(const String &p_uri);
- virtual void stop();
- virtual bool is_active() const;
- virtual bool is_connection_available() const;
- virtual Ref<RemoteDebuggerPeer> take_connection();
+
+ virtual void poll() override {}
+ virtual String get_uri() const override;
+ virtual Error start(const String &p_uri) override;
+ virtual void stop() override;
+ virtual bool is_active() const override;
+ virtual bool is_connection_available() const override;
+ virtual Ref<RemoteDebuggerPeer> take_connection() override;
EditorDebuggerServerTCP();
};
@@ -63,21 +66,42 @@ EditorDebuggerServerTCP::EditorDebuggerServerTCP() {
server.instantiate();
}
+String EditorDebuggerServerTCP::get_uri() const {
+ return endpoint;
+}
+
Error EditorDebuggerServerTCP::start(const String &p_uri) {
- int bind_port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port");
+ // Default host and port
String bind_host = (String)EditorSettings::get_singleton()->get("network/debug/remote_host");
+ int bind_port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port");
+
+ // Optionally override
if (!p_uri.is_empty() && p_uri != "tcp://") {
String scheme, path;
Error err = p_uri.parse_url(scheme, bind_host, bind_port, path);
ERR_FAIL_COND_V(err != OK, ERR_INVALID_PARAMETER);
ERR_FAIL_COND_V(!bind_host.is_valid_ip_address() && bind_host != "*", ERR_INVALID_PARAMETER);
}
- const Error err = server->listen(bind_port, bind_host);
- if (err != OK) {
- EditorNode::get_log()->add_message(String("Error listening on port ") + itos(bind_port), EditorLog::MSG_TYPE_ERROR);
- return err;
+
+ // Try listening on ports
+ const int max_attempts = 5;
+ for (int attempt = 1;; ++attempt) {
+ const Error err = server->listen(bind_port, bind_host);
+ if (err == OK) {
+ break;
+ }
+ if (attempt >= max_attempts) {
+ EditorNode::get_log()->add_message(vformat("Cannot listen on port %d, remote debugging unavailable.", bind_port), EditorLog::MSG_TYPE_ERROR);
+ return err;
+ }
+ int last_port = bind_port++;
+ EditorNode::get_log()->add_message(vformat("Cannot listen on port %d, trying %d instead.", last_port, bind_port), EditorLog::MSG_TYPE_WARNING);
}
- return err;
+
+ // Endpoint that the client should connect to
+ endpoint = vformat("tcp://%s:%d", bind_host, bind_port);
+
+ return OK;
}
void EditorDebuggerServerTCP::stop() {
diff --git a/editor/debugger/editor_debugger_server.h b/editor/debugger/editor_debugger_server.h
index 844d1a9e5a..6a4ca895d1 100644
--- a/editor/debugger/editor_debugger_server.h
+++ b/editor/debugger/editor_debugger_server.h
@@ -47,8 +47,10 @@ public:
static void register_protocol_handler(const String &p_protocol, CreateServerFunc p_func);
static EditorDebuggerServer *create(const String &p_protocol);
+
+ virtual String get_uri() const = 0;
virtual void poll() = 0;
- virtual Error start(const String &p_uri = "") = 0;
+ virtual Error start(const String &p_uri) = 0;
virtual void stop() = 0;
virtual bool is_active() const = 0;
virtual bool is_connection_available() const = 0;
diff --git a/editor/debugger/editor_debugger_tree.cpp b/editor/debugger/editor_debugger_tree.cpp
index 1feab98948..be369aa0ca 100644
--- a/editor/debugger/editor_debugger_tree.cpp
+++ b/editor/debugger/editor_debugger_tree.cpp
@@ -107,7 +107,7 @@ void EditorDebuggerTree::_scene_tree_rmb_selected(const Vector2 &p_position) {
item_menu->clear();
item_menu->add_icon_item(get_theme_icon(SNAME("CreateNewSceneFrom"), SNAME("EditorIcons")), TTR("Save Branch as Scene"), ITEM_MENU_SAVE_REMOTE_NODE);
item_menu->add_icon_item(get_theme_icon(SNAME("CopyNodePath"), SNAME("EditorIcons")), TTR("Copy Node Path"), ITEM_MENU_COPY_NODE_PATH);
- item_menu->set_position(get_screen_transform().xform(get_local_mouse_position()));
+ item_menu->set_position(get_screen_position() + get_local_mouse_position());
item_menu->popup();
}
diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp
index b18c225f23..bcff9cc56a 100644
--- a/editor/debugger/script_editor_debugger.cpp
+++ b/editor/debugger/script_editor_debugger.cpp
@@ -1428,7 +1428,7 @@ void ScriptEditorDebugger::_error_tree_item_rmb_selected(const Vector2 &p_pos) {
}
if (item_menu->get_item_count() > 0) {
- item_menu->set_position(error_tree->get_global_position() + p_pos);
+ item_menu->set_position(error_tree->get_screen_position() + p_pos);
item_menu->popup();
}
}
diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp
index f18284638f..7ab5d9a97c 100644
--- a/editor/dependency_editor.cpp
+++ b/editor/dependency_editor.cpp
@@ -275,7 +275,8 @@ void DependencyEditorOwners::_list_rmb_select(int p_item, const Vector2 &p_pos)
file_options->add_item(TTR("Open"), FILE_OPEN);
}
- file_options->set_position(owners->get_global_position() + p_pos);
+ file_options->set_position(owners->get_screen_position() + p_pos);
+ file_options->reset_size();
file_options->popup();
}
diff --git a/editor/doc_tools.cpp b/editor/doc_tools.cpp
index f2b08a574f..f1d427648a 100644
--- a/editor/doc_tools.cpp
+++ b/editor/doc_tools.cpp
@@ -341,11 +341,17 @@ void DocTools::generate(bool p_basic_types) {
}
DocData::PropertyDoc prop;
-
prop.name = E.name;
-
prop.overridden = inherited;
+ if (inherited) {
+ String parent = ClassDB::get_parent_class(c.name);
+ while (!ClassDB::has_property(parent, prop.name, true)) {
+ parent = ClassDB::get_parent_class(parent);
+ }
+ prop.overrides = parent;
+ }
+
bool default_value_valid = false;
Variant default_value;
@@ -1357,7 +1363,7 @@ Error DocTools::save_classes(const String &p_default_path, const Map<String, Str
const DocData::PropertyDoc &p = c.properties[i];
if (c.properties[i].overridden) {
- _write_string(f, 2, "<member name=\"" + p.name + "\" type=\"" + p.type + "\" setter=\"" + p.setter + "\" getter=\"" + p.getter + "\" override=\"true\"" + additional_attributes + " />");
+ _write_string(f, 2, "<member name=\"" + p.name + "\" type=\"" + p.type + "\" setter=\"" + p.setter + "\" getter=\"" + p.getter + "\" overrides=\"" + p.overrides + "\"" + additional_attributes + " />");
} else {
_write_string(f, 2, "<member name=\"" + p.name + "\" type=\"" + p.type + "\" setter=\"" + p.setter + "\" getter=\"" + p.getter + "\"" + additional_attributes + ">");
_write_string(f, 3, p.description.strip_edges().xml_escape());
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index dd9f10a23b..0d7a2eded9 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -487,7 +487,8 @@ void EditorAudioBus::_effect_edited() {
if (effect->get_metadata(0) == Variant()) {
Rect2 area = effects->get_item_rect(effect);
- effect_options->set_position(effects->get_global_position() + area.position + Vector2(0, area.size.y));
+ effect_options->set_position(effects->get_screen_position() + area.position + Vector2(0, area.size.y));
+ effect_options->reset_size();
effect_options->popup();
//add effect
} else {
@@ -535,8 +536,8 @@ void EditorAudioBus::gui_input(const Ref<InputEvent> &p_event) {
Ref<InputEventMouseButton> mb = p_event;
if (mb.is_valid() && mb->get_button_index() == MouseButton::RIGHT && mb->is_pressed()) {
- Vector2 pos = mb->get_position();
- bus_popup->set_position(get_global_position() + pos);
+ bus_popup->set_position(get_screen_position() + mb->get_position());
+ bus_popup->reset_size();
bus_popup->popup();
}
}
@@ -737,7 +738,8 @@ void EditorAudioBus::_effect_rmb(const Vector2 &p_pos) {
return;
}
- delete_effect_popup->set_position(get_global_mouse_position());
+ delete_effect_popup->set_position(get_screen_position() + get_local_mouse_position());
+ delete_effect_popup->reset_size();
delete_effect_popup->popup();
}
diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp
index ec8651ac7c..b5300bdc1b 100644
--- a/editor/editor_file_dialog.cpp
+++ b/editor/editor_file_dialog.cpp
@@ -608,7 +608,8 @@ void EditorFileDialog::_item_list_item_rmb_selected(int p_item, const Vector2 &p
}
if (item_menu->get_item_count() > 0) {
- item_menu->set_position(item_list->get_global_position() + p_pos);
+ item_menu->set_position(item_list->get_screen_position() + p_pos);
+ item_menu->reset_size();
item_menu->popup();
}
}
@@ -629,7 +630,8 @@ void EditorFileDialog::_item_list_rmb_clicked(const Vector2 &p_pos) {
item_menu->add_separator();
item_menu->add_icon_item(item_list->get_theme_icon(SNAME("Filesystem"), SNAME("EditorIcons")), TTR("Open in File Manager"), ITEM_MENU_SHOW_IN_EXPLORER);
- item_menu->set_position(item_list->get_global_position() + p_pos);
+ item_menu->set_position(item_list->get_screen_position() + p_pos);
+ item_menu->reset_size();
item_menu->popup();
}
diff --git a/editor/editor_folding.cpp b/editor/editor_folding.cpp
index 29e3236ac2..c98606730c 100644
--- a/editor/editor_folding.cpp
+++ b/editor/editor_folding.cpp
@@ -262,10 +262,6 @@ void EditorFolding::_do_object_unfolds(Object *p_object, Set<RES> &resources) {
if (E.type == Variant::OBJECT) {
RES res = p_object->get(E.name);
- print_line("res: " + String(E.name) + " valid " + itos(res.is_valid()));
- if (res.is_valid()) {
- print_line("path " + res->get_path());
- }
if (res.is_valid() && !resources.has(res) && res->get_path() != String() && !res->get_path().is_resource_file()) {
resources.insert(res);
_do_object_unfolds(res.ptr(), resources);
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 4082dcefbc..c95b1c753e 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -673,7 +673,7 @@ void EditorHelp::_update_doc() {
class_desc->add_newline();
class_desc->push_font(doc_code_font);
class_desc->push_indent(1);
- class_desc->push_table(2);
+ class_desc->push_table(4);
class_desc->set_table_column_expand(1, true);
for (int i = 0; i < cd.properties.size(); i++) {
@@ -683,13 +683,14 @@ void EditorHelp::_update_doc() {
}
property_line[cd.properties[i].name] = class_desc->get_line_count() - 2; //gets overridden if description
+ // Property type.
class_desc->push_cell();
class_desc->push_paragraph(RichTextLabel::ALIGN_RIGHT, Control::TEXT_DIRECTION_AUTO, "");
class_desc->push_font(doc_code_font);
_add_type(cd.properties[i].type, cd.properties[i].enumeration);
class_desc->pop();
class_desc->pop();
- class_desc->pop();
+ class_desc->pop(); // cell
bool describe = false;
@@ -710,6 +711,7 @@ void EditorHelp::_update_doc() {
describe = false;
}
+ // Property name.
class_desc->push_cell();
class_desc->push_font(doc_code_font);
class_desc->push_color(headline_color);
@@ -725,18 +727,43 @@ void EditorHelp::_update_doc() {
property_descr = true;
}
+ class_desc->pop();
+ class_desc->pop();
+ class_desc->pop(); // cell
+
+ // Property value.
+ class_desc->push_cell();
+ class_desc->push_font(doc_code_font);
+
if (cd.properties[i].default_value != "") {
class_desc->push_color(symbol_color);
- class_desc->add_text(cd.properties[i].overridden ? " [" + TTR("override:") + " " : " [" + TTR("default:") + " ");
+ if (cd.properties[i].overridden) {
+ class_desc->add_text(" [");
+ class_desc->push_meta("@member " + cd.properties[i].overrides + "." + cd.properties[i].name);
+ _add_text(vformat(TTR("overrides %s:"), cd.properties[i].overrides));
+ class_desc->pop();
+ class_desc->add_text(" ");
+ } else {
+ class_desc->add_text(" [" + TTR("default:") + " ");
+ }
class_desc->pop();
+
class_desc->push_color(value_color);
_add_text(_fix_constant(cd.properties[i].default_value));
class_desc->pop();
+
class_desc->push_color(symbol_color);
class_desc->add_text("]");
class_desc->pop();
}
+ class_desc->pop();
+ class_desc->pop(); // cell
+
+ // Property setters and getters.
+ class_desc->push_cell();
+ class_desc->push_font(doc_code_font);
+
if (cd.is_script_doc && (cd.properties[i].setter != "" || cd.properties[i].getter != "")) {
class_desc->push_color(symbol_color);
class_desc->add_text(" [" + TTR("property:") + " ");
@@ -764,12 +791,10 @@ void EditorHelp::_update_doc() {
}
class_desc->pop();
- class_desc->pop();
-
- class_desc->pop();
+ class_desc->pop(); // cell
}
- class_desc->pop(); //table
+ class_desc->pop(); // table
class_desc->pop();
class_desc->pop(); // font
class_desc->add_newline();
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index e1fae47057..81c9d996cb 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -1555,7 +1555,7 @@ void EditorInspectorArray::_panel_gui_input(Ref<InputEvent> p_event, int p_index
popup_array_index_pressed = begin_array_index + p_index;
rmb_popup->set_item_disabled(OPTION_MOVE_UP, popup_array_index_pressed == 0);
rmb_popup->set_item_disabled(OPTION_MOVE_DOWN, popup_array_index_pressed == count - 1);
- rmb_popup->set_position(mb->get_global_position());
+ rmb_popup->set_position(get_screen_position() + mb->get_position());
rmb_popup->reset_size();
rmb_popup->popup();
}
@@ -2194,10 +2194,7 @@ void EditorInspector::remove_inspector_plugin(const Ref<EditorInspectorPlugin> &
for (int i = idx; i < inspector_plugin_count - 1; i++) {
inspector_plugins[i] = inspector_plugins[i + 1];
}
-
- if (idx == inspector_plugin_count - 1) {
- inspector_plugins[idx] = Ref<EditorInspectorPlugin>();
- }
+ inspector_plugins[inspector_plugin_count - 1] = Ref<EditorInspectorPlugin>();
inspector_plugin_count--;
}
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 6aaf0b063f..9ffe677091 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -2315,8 +2315,6 @@ void EditorNode::_run(bool p_current, const String &p_custom) {
play_custom_scene_button->set_icon(gui_base->get_theme_icon(SNAME("PlayCustom"), SNAME("EditorIcons")));
String run_filename;
- String args;
- bool skip_breakpoints;
if (p_current || (editor_data.get_edited_scene_root() && p_custom != String() && p_custom == editor_data.get_edited_scene_root()->get_scene_file_path())) {
Node *scene = editor_data.get_edited_scene_root();
@@ -2371,17 +2369,11 @@ void EditorNode::_run(bool p_current, const String &p_custom) {
make_bottom_panel_item_visible(log);
}
- List<String> breakpoints;
- editor_data.get_editor_breakpoints(&breakpoints);
-
- args = ProjectSettings::get_singleton()->get("editor/run/main_run_args");
- skip_breakpoints = EditorDebuggerNode::get_singleton()->is_skip_breakpoints();
-
EditorDebuggerNode::get_singleton()->start();
- Error error = editor_run.run(run_filename, args, breakpoints, skip_breakpoints);
+ Error error = editor_run.run(run_filename);
if (error != OK) {
EditorDebuggerNode::get_singleton()->stop();
- show_accept(TTR("Could not start subprocess!"), TTR("OK"));
+ show_accept(TTR("Could not start subprocess(es)!"), TTR("OK"));
return;
}
@@ -4244,7 +4236,6 @@ void EditorNode::_dock_make_float() {
Size2 dock_size = dock->get_size() + borders * 2; // remember size
Point2 dock_screen_pos = dock->get_global_position() + get_tree()->get_root()->get_position() - borders;
- print_line("dock pos: " + dock->get_global_position() + " window pos: " + get_tree()->get_root()->get_position());
int dock_index = dock->get_index();
dock_slot[dock_popup_selected]->remove_child(dock);
@@ -5060,7 +5051,8 @@ void EditorNode::_scene_tab_input(const Ref<InputEvent> &p_input) {
scene_tabs_context_menu->add_item(TTR("Close Tabs to the Right"), FILE_CLOSE_RIGHT);
scene_tabs_context_menu->add_item(TTR("Close All Tabs"), FILE_CLOSE_ALL);
}
- scene_tabs_context_menu->set_position(mb->get_global_position());
+ scene_tabs_context_menu->set_position(scene_tabs->get_screen_position() + mb->get_position());
+ scene_tabs_context_menu->reset_size();
scene_tabs_context_menu->popup();
}
if (mb->get_button_index() == MouseButton::WHEEL_UP && mb->is_pressed()) {
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index e48679cad7..4debc705ac 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -1283,7 +1283,8 @@ void EditorPropertyEasing::_drag_easing(const Ref<InputEvent> &p_ev) {
}
if (mb->is_pressed() && mb->get_button_index() == MouseButton::RIGHT) {
- preset->set_position(easing_draw->get_screen_transform().xform(mb->get_position()));
+ preset->set_position(easing_draw->get_screen_position() + mb->get_position());
+ preset->reset_size();
preset->popup();
// Ensure the easing doesn't appear as being dragged
diff --git a/editor/editor_run.cpp b/editor/editor_run.cpp
index 0a77a8b0bb..3f4418d5f2 100644
--- a/editor/editor_run.cpp
+++ b/editor/editor_run.cpp
@@ -31,6 +31,7 @@
#include "editor_run.h"
#include "core/config/project_settings.h"
+#include "editor/editor_node.h"
#include "editor_settings.h"
#include "servers/display_server.h"
@@ -42,20 +43,17 @@ String EditorRun::get_running_scene() const {
return running_scene;
}
-Error EditorRun::run(const String &p_scene, const String &p_custom_args, const List<String> &p_breakpoints, const bool &p_skip_breakpoints) {
+Error EditorRun::run(const String &p_scene) {
List<String> args;
String resource_path = ProjectSettings::get_singleton()->get_resource_path();
- String remote_host = EditorSettings::get_singleton()->get("network/debug/remote_host");
- int remote_port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port");
-
- if (resource_path != "") {
+ if (!resource_path.is_empty()) {
args.push_back("--path");
args.push_back(resource_path.replace(" ", "%20"));
}
args.push_back("--remote-debug");
- args.push_back("tcp://" + remote_host + ":" + String::num(remote_port));
+ args.push_back(EditorDebuggerNode::get_singleton()->get_server_uri());
args.push_back("--allow_focus_steal_pid");
args.push_back(itos(OS::get_singleton()->get_process_id()));
@@ -162,10 +160,13 @@ Error EditorRun::run(const String &p_scene, const String &p_custom_args, const L
} break;
}
- if (p_breakpoints.size()) {
+ List<String> breakpoints;
+ EditorNode::get_editor_data().get_editor_breakpoints(&breakpoints);
+
+ if (!breakpoints.is_empty()) {
args.push_back("--breakpoints");
String bpoints;
- for (const List<String>::Element *E = p_breakpoints.front(); E; E = E->next()) {
+ for (const List<String>::Element *E = breakpoints.front(); E; E = E->next()) {
bpoints += E->get().replace(" ", "%20");
if (E->next()) {
bpoints += ",";
@@ -175,7 +176,7 @@ Error EditorRun::run(const String &p_scene, const String &p_custom_args, const L
args.push_back(bpoints);
}
- if (p_skip_breakpoints) {
+ if (EditorDebuggerNode::get_singleton()->is_skip_breakpoints()) {
args.push_back("--skip-breakpoints");
}
@@ -185,20 +186,21 @@ Error EditorRun::run(const String &p_scene, const String &p_custom_args, const L
String exec = OS::get_singleton()->get_executable_path();
- if (p_custom_args != "") {
+ const String raw_custom_args = ProjectSettings::get_singleton()->get("editor/run/main_run_args");
+ if (!raw_custom_args.is_empty()) {
// Allow the user to specify a command to run, similar to Steam's launch options.
// In this case, Godot will no longer be run directly; it's up to the underlying command
// to run it. For instance, this can be used on Linux to force a running project
// to use Optimus using `prime-run` or similar.
// Example: `prime-run %command% --time-scale 0.5`
- const int placeholder_pos = p_custom_args.find("%command%");
+ const int placeholder_pos = raw_custom_args.find("%command%");
Vector<String> custom_args;
if (placeholder_pos != -1) {
// Prepend executable-specific custom arguments.
// If nothing is placed before `%command%`, behave as if no placeholder was specified.
- Vector<String> exec_args = p_custom_args.substr(0, placeholder_pos).split(" ", false);
+ Vector<String> exec_args = raw_custom_args.substr(0, placeholder_pos).split(" ", false);
if (exec_args.size() >= 1) {
exec = exec_args[0];
exec_args.remove_at(0);
@@ -214,13 +216,13 @@ Error EditorRun::run(const String &p_scene, const String &p_custom_args, const L
}
// Append Godot-specific custom arguments.
- custom_args = p_custom_args.substr(placeholder_pos + String("%command%").size()).split(" ", false);
+ custom_args = raw_custom_args.substr(placeholder_pos + String("%command%").size()).split(" ", false);
for (int i = 0; i < custom_args.size(); i++) {
args.push_back(custom_args[i].replace(" ", "%20"));
}
} else {
// Append Godot-specific custom arguments.
- custom_args = p_custom_args.split(" ", false);
+ custom_args = raw_custom_args.split(" ", false);
for (int i = 0; i < custom_args.size(); i++) {
args.push_back(custom_args[i].replace(" ", "%20"));
}
diff --git a/editor/editor_run.h b/editor/editor_run.h
index d6cf3fed71..3bfe28e1ad 100644
--- a/editor/editor_run.h
+++ b/editor/editor_run.h
@@ -50,7 +50,7 @@ private:
public:
Status get_status() const;
String get_running_scene() const;
- Error run(const String &p_scene, const String &p_custom_args, const List<String> &p_breakpoints, const bool &p_skip_breakpoints = false);
+ Error run(const String &p_scene);
void run_native_notify() { status = STATUS_PLAY; }
void stop();
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index abe20c693b..6d0b07d601 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -2521,6 +2521,7 @@ void FileSystemDock::_tree_rmb_select(const Vector2 &p_pos) {
tree_popup->reset_size();
_file_and_folders_fill_popup(tree_popup, paths);
tree_popup->set_position(tree->get_screen_position() + p_pos);
+ tree_popup->reset_size();
tree_popup->popup();
}
}
@@ -2535,7 +2536,8 @@ void FileSystemDock::_tree_rmb_empty(const Vector2 &p_pos) {
tree_popup->add_icon_item(get_theme_icon(SNAME("Script"), SNAME("EditorIcons")), TTR("New Script..."), FILE_NEW_SCRIPT);
tree_popup->add_icon_item(get_theme_icon(SNAME("Object"), SNAME("EditorIcons")), TTR("New Resource..."), FILE_NEW_RESOURCE);
tree_popup->add_icon_item(get_theme_icon(SNAME("TextFile"), SNAME("EditorIcons")), TTR("New TextFile..."), FILE_NEW_TEXTFILE);
- tree_popup->set_position(tree->get_global_position() + p_pos);
+ tree_popup->set_position(tree->get_screen_position() + p_pos);
+ tree_popup->reset_size();
tree_popup->popup();
}
@@ -2560,9 +2562,9 @@ void FileSystemDock::_file_list_rmb_select(int p_item, const Vector2 &p_pos) {
// Popup.
if (!paths.is_empty()) {
file_list_popup->clear();
- file_list_popup->reset_size();
_file_and_folders_fill_popup(file_list_popup, paths, searched_string.length() == 0);
- file_list_popup->set_position(files->get_global_position() + p_pos);
+ file_list_popup->set_position(files->get_screen_position() + p_pos);
+ file_list_popup->reset_size();
file_list_popup->popup();
}
}
@@ -2583,7 +2585,8 @@ void FileSystemDock::_file_list_rmb_pressed(const Vector2 &p_pos) {
file_list_popup->add_icon_item(get_theme_icon(SNAME("TextFile"), SNAME("EditorIcons")), TTR("New TextFile..."), FILE_NEW_TEXTFILE);
file_list_popup->add_separator();
file_list_popup->add_icon_item(get_theme_icon(SNAME("Filesystem"), SNAME("EditorIcons")), TTR("Open in File Manager"), FILE_SHOW_IN_EXPLORER);
- file_list_popup->set_position(files->get_global_position() + p_pos);
+ file_list_popup->set_position(files->get_screen_position() + p_pos);
+ file_list_popup->reset_size();
file_list_popup->popup();
}
diff --git a/editor/import/dynamicfont_import_settings.cpp b/editor/import/dynamicfont_import_settings.cpp
index 45937e20bc..a44ee8a3f6 100644
--- a/editor/import/dynamicfont_import_settings.cpp
+++ b/editor/import/dynamicfont_import_settings.cpp
@@ -1159,7 +1159,7 @@ void DynamicFontImportSettings::_range_update(int32_t p_start, int32_t p_end) {
/*************************************************************************/
void DynamicFontImportSettings::_lang_add() {
- menu_langs->set_position(lang_list->get_screen_transform().xform(lang_list->get_local_mouse_position()));
+ menu_langs->set_position(lang_list->get_screen_position() + lang_list->get_local_mouse_position());
menu_langs->reset_size();
menu_langs->popup();
}
@@ -1186,7 +1186,7 @@ void DynamicFontImportSettings::_lang_remove(Object *p_item, int p_column, int p
}
void DynamicFontImportSettings::_script_add() {
- menu_scripts->set_position(script_list->get_screen_transform().xform(script_list->get_local_mouse_position()));
+ menu_scripts->set_position(script_list->get_screen_position() + script_list->get_local_mouse_position());
menu_scripts->reset_size();
menu_scripts->popup();
}
diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp
index cfb7217baa..e8d91ed1ae 100644
--- a/editor/plugins/animation_blend_space_1d_editor.cpp
+++ b/editor/plugins/animation_blend_space_1d_editor.cpp
@@ -98,7 +98,8 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref<InputEven
menu->add_separator();
menu->add_item(TTR("Load..."), MENU_LOAD_FILE);
- menu->set_position(blend_space_draw->get_screen_transform().xform(mb->get_position()));
+ menu->set_position(blend_space_draw->get_screen_position() + mb->get_position());
+ menu->reset_size();
menu->popup();
add_point_pos = (mb->get_position() / blend_space_draw->get_size()).x;
diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp
index 9af060ed84..cb9fe10212 100644
--- a/editor/plugins/animation_blend_space_2d_editor.cpp
+++ b/editor/plugins/animation_blend_space_2d_editor.cpp
@@ -121,7 +121,8 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEven
menu->add_separator();
menu->add_item(TTR("Load..."), MENU_LOAD_FILE);
- menu->set_position(blend_space_draw->get_screen_transform().xform(mb->get_position()));
+ menu->set_position(blend_space_draw->get_screen_position() + mb->get_position());
+ menu->reset_size();
menu->popup();
add_point_pos = (mb->get_position() / blend_space_draw->get_size());
add_point_pos.y = 1.0 - add_point_pos.y;
diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp
index c4a938f91d..2e051b9601 100644
--- a/editor/plugins/animation_blend_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp
@@ -83,7 +83,7 @@ void AnimationNodeBlendTreeEditor::_update_options_menu(bool p_has_input_ports)
}
add_node->get_popup()->add_separator();
add_node->get_popup()->add_item(TTR("Load..."), MENU_LOAD_FILE);
- use_popup_menu_position = false;
+ use_position_from_popup_menu = false;
}
Size2 AnimationNodeBlendTreeEditor::get_minimum_size() const {
@@ -319,8 +319,8 @@ void AnimationNodeBlendTreeEditor::_add_node(int p_idx) {
}
Point2 instance_pos = graph->get_scroll_ofs();
- if (use_popup_menu_position) {
- instance_pos += popup_menu_position;
+ if (use_position_from_popup_menu) {
+ instance_pos += position_from_popup_menu;
} else {
instance_pos += graph->get_size() * 0.5;
}
@@ -355,14 +355,15 @@ void AnimationNodeBlendTreeEditor::_add_node(int p_idx) {
void AnimationNodeBlendTreeEditor::_popup(bool p_has_input_ports, const Vector2 &p_popup_position, const Vector2 &p_node_position) {
_update_options_menu(p_has_input_ports);
- use_popup_menu_position = true;
- popup_menu_position = p_popup_position;
- add_node->get_popup()->set_position(p_node_position);
+ use_position_from_popup_menu = true;
+ position_from_popup_menu = p_node_position;
+ add_node->get_popup()->set_position(p_popup_position);
+ add_node->get_popup()->reset_size();
add_node->get_popup()->popup();
}
void AnimationNodeBlendTreeEditor::_popup_request(const Vector2 &p_position) {
- _popup(false, graph->get_local_mouse_position(), p_position);
+ _popup(false, graph->get_screen_position() + graph->get_local_mouse_position(), p_position);
}
void AnimationNodeBlendTreeEditor::_connection_to_empty(const String &p_from, int p_from_slot, const Vector2 &p_release_position) {
@@ -918,7 +919,7 @@ void AnimationNodeBlendTreeEditor::edit(const Ref<AnimationNode> &p_node) {
AnimationNodeBlendTreeEditor::AnimationNodeBlendTreeEditor() {
singleton = this;
updating = false;
- use_popup_menu_position = false;
+ use_position_from_popup_menu = false;
graph = memnew(GraphEdit);
add_child(graph);
diff --git a/editor/plugins/animation_blend_tree_editor_plugin.h b/editor/plugins/animation_blend_tree_editor_plugin.h
index 0fcafad40e..68da5c6f79 100644
--- a/editor/plugins/animation_blend_tree_editor_plugin.h
+++ b/editor/plugins/animation_blend_tree_editor_plugin.h
@@ -49,8 +49,8 @@ class AnimationNodeBlendTreeEditor : public AnimationTreeNodeEditorPlugin {
Ref<AnimationNodeBlendTree> blend_tree;
GraphEdit *graph;
MenuButton *add_node;
- Vector2 popup_menu_position;
- bool use_popup_menu_position;
+ Vector2 position_from_popup_menu;
+ bool use_position_from_popup_menu;
PanelContainer *error_panel;
Label *error_label;
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index 226046f250..f936871bce 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -42,6 +42,7 @@
#include "editor/plugins/node_3d_editor_plugin.h" // For onion skinning.
#include "scene/main/window.h"
#include "scene/resources/animation.h"
+#include "scene/scene_string_names.h"
#include "servers/rendering_server.h"
void AnimationPlayerEditor::_node_removed(Node *p_node) {
@@ -836,12 +837,12 @@ void AnimationPlayerEditor::_update_player() {
for (const StringName &E : animlist) {
Ref<Texture2D> icon;
if (E == player->get_autoplay()) {
- if (E == "RESET") {
+ if (E == SceneStringNames::get_singleton()->RESET) {
icon = autoplay_reset_icon;
} else {
icon = autoplay_icon;
}
- } else if (E == "RESET") {
+ } else if (E == SceneStringNames::get_singleton()->RESET) {
icon = reset_icon;
}
animation->add_icon_item(icon, E);
diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp
index 191f5d9071..d3dd33e67e 100644
--- a/editor/plugins/animation_state_machine_editor.cpp
+++ b/editor/plugins/animation_state_machine_editor.cpp
@@ -118,7 +118,8 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
menu->add_separator();
menu->add_item(TTR("Load..."), MENU_LOAD_FILE);
- menu->set_position(state_machine_draw->get_screen_transform().xform(mb->get_position()));
+ menu->set_position(state_machine_draw->get_screen_position() + mb->get_position());
+ menu->reset_size();
menu->popup();
add_node_pos = mb->get_position() / EDSCALE + state_machine->get_graph_offset();
}
@@ -151,7 +152,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
edit_rect.position -= line_sb->get_offset();
edit_rect.size += line_sb->get_minimum_size();
- name_edit_popup->set_position(state_machine_draw->get_screen_transform().xform(edit_rect.position));
+ name_edit_popup->set_position(state_machine_draw->get_screen_position() + edit_rect.position);
name_edit_popup->set_size(edit_rect.size);
name_edit->set_text(node_rects[i].node_name);
name_edit_popup->popup();
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index aa46eef21f..737b69b8b7 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -2258,7 +2258,8 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
}
selection_menu_additive_selection = b->is_shift_pressed();
- selection_menu->set_position(get_screen_transform().xform(b->get_position()));
+ selection_menu->set_position(get_screen_position() + b->get_position());
+ selection_menu->reset_size();
selection_menu->popup();
return true;
}
@@ -2266,7 +2267,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
if (b.is_valid() && b->is_pressed() && b->get_button_index() == MouseButton::RIGHT) {
add_node_menu->reset_size();
- add_node_menu->set_position(get_screen_position() + b->get_position());
+ add_node_menu->set_position(get_screen_transform().xform(get_local_mouse_position()));
add_node_menu->popup();
node_create_position = transform.affine_inverse().xform((get_local_mouse_position()));
return true;
diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp
index d99d6709ad..0c269e9b07 100644
--- a/editor/plugins/curve_editor_plugin.cpp
+++ b/editor/plugins/curve_editor_plugin.cpp
@@ -117,7 +117,7 @@ void CurveEditor::gui_input(const Ref<InputEvent> &p_event) {
switch (mb.get_button_index()) {
case MouseButton::RIGHT:
_context_click_pos = mpos;
- open_context_menu(get_global_transform().xform(mpos));
+ open_context_menu(get_screen_position() + mpos);
break;
case MouseButton::MIDDLE:
diff --git a/editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp b/editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp
index 6df2e34ceb..57279c57e7 100644
--- a/editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp
+++ b/editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp
@@ -68,32 +68,36 @@ void GPUParticlesCollisionSDFEditorPlugin::_notification(int p_what) {
return;
}
+ // Set information tooltip on the Bake button. This information is useful
+ // to optimize performance (video RAM size) and reduce collision tunneling (individual cell size).
+
const Vector3i size = col_sdf->get_estimated_cell_size();
- String text = vformat(String::utf8("%d × %d × %d"), size.x, size.y, size.z);
- int data_size = 2;
- const double size_mb = size.x * size.y * size.z * data_size / (1024.0 * 1024.0);
- text += " - " + vformat(TTR("VRAM Size: %s MB"), String::num(size_mb, 2));
+ const Vector3 extents = col_sdf->get_extents();
- if (bake_info->get_text() == text) {
- return;
+ int data_size = 2;
+ const double size_mb = size.x * size.y * size.z * data_size / (1024.0 * 1024.0);
+ // Add a qualitative measurement to help the user assess whether a GPUParticlesCollisionSDF node is using a lot of VRAM.
+ String size_quality;
+ if (size_mb < 8.0) {
+ size_quality = TTR("Low");
+ } else if (size_mb < 32.0) {
+ size_quality = TTR("Moderate");
+ } else {
+ size_quality = TTR("High");
}
- // Color the label depending on the estimated performance level.
- Color color;
- if (size_mb <= 16.0 + CMP_EPSILON) {
- // Fast.
- color = bake_info->get_theme_color(SNAME("success_color"), SNAME("Editor"));
- } else if (size_mb <= 64.0 + CMP_EPSILON) {
- // Medium.
- color = bake_info->get_theme_color(SNAME("warning_color"), SNAME("Editor"));
- } else {
- // Slow.
- color = bake_info->get_theme_color(SNAME("error_color"), SNAME("Editor"));
+ String text;
+ text += vformat(TTR("Subdivisions: %s"), vformat(String::utf8("%d × %d × %d"), size.x, size.y, size.z)) + "\n";
+ text += vformat(TTR("Cell size: %s"), vformat(String::utf8("%.3f × %.3f × %.3f"), extents.x / size.x, extents.y / size.y, extents.z / size.z)) + "\n";
+ text += vformat(TTR("Video RAM size: %s MB (%s)"), String::num(size_mb, 2), size_quality);
+
+ // Only update the tooltip when needed to avoid constant redrawing.
+ if (bake->get_tooltip(Point2()) == text) {
+ return;
}
- bake_info->add_theme_color_override("font_color", color);
- bake_info->set_text(text);
+ bake->set_tooltip(text);
}
}
@@ -178,10 +182,6 @@ GPUParticlesCollisionSDFEditorPlugin::GPUParticlesCollisionSDFEditorPlugin(Edito
bake->set_text(TTR("Bake SDF"));
bake->connect("pressed", callable_mp(this, &GPUParticlesCollisionSDFEditorPlugin::_bake));
bake_hb->add_child(bake);
- bake_info = memnew(Label);
- bake_info->set_h_size_flags(Control::SIZE_EXPAND_FILL);
- bake_info->set_clip_text(true);
- bake_hb->add_child(bake_info);
add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU, bake_hb);
col_sdf = nullptr;
diff --git a/editor/plugins/gpu_particles_collision_sdf_editor_plugin.h b/editor/plugins/gpu_particles_collision_sdf_editor_plugin.h
index 5a71fc44ef..26b8b352d6 100644
--- a/editor/plugins/gpu_particles_collision_sdf_editor_plugin.h
+++ b/editor/plugins/gpu_particles_collision_sdf_editor_plugin.h
@@ -42,7 +42,6 @@ class GPUParticlesCollisionSDFEditorPlugin : public EditorPlugin {
GPUParticlesCollisionSDF *col_sdf;
HBoxContainer *bake_hb;
- Label *bake_info;
Button *bake;
EditorNode *editor;
diff --git a/editor/plugins/node_3d_editor_gizmos.cpp b/editor/plugins/node_3d_editor_gizmos.cpp
index 60ba98a706..1f5d68929a 100644
--- a/editor/plugins/node_3d_editor_gizmos.cpp
+++ b/editor/plugins/node_3d_editor_gizmos.cpp
@@ -2871,7 +2871,6 @@ void GPUParticlesCollision3DGizmoPlugin::commit_handle(const EditorNode3DGizmo *
void GPUParticlesCollision3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
Node3D *cs = p_gizmo->get_spatial_node();
- print_line("redraw request " + itos(cs != nullptr));
p_gizmo->clear();
const Ref<Material> material =
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index 51086d47b7..fb469b3e00 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -1291,7 +1291,8 @@ void Node3DEditorViewport::_list_select(Ref<InputEventMouseButton> b) {
selection_menu->set_item_tooltip(i, String(spat->get_name()) + "\nType: " + spat->get_class() + "\nPath: " + node_path);
}
- selection_menu->set_position(get_screen_transform().xform(b->get_position()));
+ selection_menu->set_position(get_screen_position() + b->get_position());
+ selection_menu->reset_size();
selection_menu->popup();
}
}
@@ -6646,6 +6647,7 @@ void Node3DEditor::unhandled_key_input(const Ref<InputEvent> &p_event) {
void Node3DEditor::_sun_environ_settings_pressed() {
Vector2 pos = sun_environ_settings->get_screen_position() + sun_environ_settings->get_size();
sun_environ_popup->set_position(pos - Vector2(sun_environ_popup->get_contents_minimum_size().width / 2, 0));
+ sun_environ_popup->reset_size();
sun_environ_popup->popup();
}
diff --git a/editor/plugins/ot_features_plugin.cpp b/editor/plugins/ot_features_plugin.cpp
index c949621e28..7f3ebc01d5 100644
--- a/editor/plugins/ot_features_plugin.cpp
+++ b/editor/plugins/ot_features_plugin.cpp
@@ -136,6 +136,7 @@ void OpenTypeFeaturesAdd::update_property() {
void OpenTypeFeaturesAdd::_features_menu() {
Size2 size = get_size();
menu->set_position(get_screen_position() + Size2(0, size.height * get_global_transform().get_scale().y));
+ menu->reset_size();
menu->popup();
}
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index aeb6ba13d5..5dbcb3788d 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -3055,7 +3055,7 @@ void ScriptEditor::_make_script_list_context_menu() {
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/window_sort"), WINDOW_SORT);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/toggle_scripts_panel"), TOGGLE_SCRIPTS_PANEL);
- context_menu->set_position(get_global_transform().xform(get_local_mouse_position()));
+ context_menu->set_position(get_screen_position() + get_local_mouse_position());
context_menu->reset_size();
context_menu->popup();
}
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index 30a4cef8ca..66b803e3ab 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -1611,7 +1611,7 @@ void ScriptTextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
float alpha = color.size() > 3 ? color[3] : 1.0f;
color_picker->set_pick_color(Color(color[0], color[1], color[2], alpha));
}
- color_panel->set_position(get_global_transform().xform(local_pos));
+ color_panel->set_position(get_screen_position() + local_pos);
} else {
has_color = false;
}
@@ -1688,7 +1688,7 @@ void ScriptTextEditor::_make_context_menu(bool p_selection, bool p_color, bool p
context_menu->set_item_disabled(context_menu->get_item_index(EDIT_UNDO), !tx->has_undo());
context_menu->set_item_disabled(context_menu->get_item_index(EDIT_REDO), !tx->has_redo());
- context_menu->set_position(get_global_transform().xform(p_pos));
+ context_menu->set_position(get_screen_position() + p_pos);
context_menu->reset_size();
context_menu->popup();
}
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index 7c1fda77bb..5d14590797 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -645,7 +645,7 @@ void ShaderEditor::_make_context_menu(bool p_selection, Vector2 p_position) {
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_comment"), EDIT_TOGGLE_COMMENT);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_bookmark"), BOOKMARK_TOGGLE);
- context_menu->set_position(get_global_transform().xform(p_position));
+ context_menu->set_position(get_screen_position() + p_position);
context_menu->reset_size();
context_menu->popup();
}
diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp
index e252792c43..ceb2c8394d 100644
--- a/editor/plugins/text_editor.cpp
+++ b/editor/plugins/text_editor.cpp
@@ -507,7 +507,7 @@ void TextEditor::_make_context_menu(bool p_selection, bool p_can_fold, bool p_is
context_menu->set_item_disabled(context_menu->get_item_index(EDIT_UNDO), !tx->has_undo());
context_menu->set_item_disabled(context_menu->get_item_index(EDIT_REDO), !tx->has_redo());
- context_menu->set_position(get_global_transform().xform(p_position));
+ context_menu->set_position(get_screen_position() + p_position);
context_menu->reset_size();
context_menu->popup();
}
diff --git a/editor/plugins/tiles/tile_map_editor.cpp b/editor/plugins/tiles/tile_map_editor.cpp
index 37d52174f9..fd2648a469 100644
--- a/editor/plugins/tiles/tile_map_editor.cpp
+++ b/editor/plugins/tiles/tile_map_editor.cpp
@@ -3786,7 +3786,7 @@ void TileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) {
}
// Draw the warning icon.
- int min_axis = missing_tile_texture->get_size().min_axis();
+ Vector2::Axis min_axis = missing_tile_texture->get_size().min_axis_index();
Vector2 icon_size;
icon_size[min_axis] = tile_set->get_tile_size()[min_axis] / 3;
icon_size[(min_axis + 1) % 2] = (icon_size[min_axis] * missing_tile_texture->get_size()[(min_axis + 1) % 2] / missing_tile_texture->get_size()[min_axis]);
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index 44f2eaa2a1..a71a8b33cb 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -2078,6 +2078,7 @@ void VisualShaderEditor::_comment_desc_popup_show(const Point2 &p_position, int
}
comment_desc_change_edit->set_text(node->get_description());
comment_desc_change_popup->set_meta("id", p_node_id);
+ comment_desc_change_popup->reset_size();
comment_desc_change_popup->popup();
comment_desc_change_popup->set_position(p_position);
}
@@ -3165,7 +3166,7 @@ void VisualShaderEditor::_graph_gui_input(const Ref<InputEvent> &p_event) {
}
menu_point = graph->get_local_mouse_position();
- Point2 gpos = Input::get_singleton()->get_mouse_position();
+ Point2 gpos = get_screen_position() + get_local_mouse_position();
popup_menu->set_position(gpos);
popup_menu->reset_size();
popup_menu->popup();
@@ -3184,28 +3185,21 @@ void VisualShaderEditor::_show_members_dialog(bool at_mouse_pos, VisualShaderNod
saved_node_pos_dirty = true;
saved_node_pos = graph->get_local_mouse_position();
- Point2 gpos = Input::get_singleton()->get_mouse_position();
- members_dialog->popup();
+ Point2 gpos = get_screen_position() + get_local_mouse_position();
members_dialog->set_position(gpos);
} else {
- members_dialog->popup();
saved_node_pos_dirty = false;
- members_dialog->set_position(graph->get_global_position() + Point2(5 * EDSCALE, 65 * EDSCALE));
+ members_dialog->set_position(graph->get_screen_position() + Point2(5 * EDSCALE, 65 * EDSCALE));
}
+ members_dialog->popup();
- // keep dialog within window bounds
- Size2 window_size = DisplayServer::get_singleton()->window_get_size();
+ // Keep dialog within window bounds.
+ Rect2 window_rect = Rect2(DisplayServer::get_singleton()->window_get_position(), DisplayServer::get_singleton()->window_get_size());
Rect2 dialog_rect = Rect2(members_dialog->get_position(), members_dialog->get_size());
- if (dialog_rect.position.y + dialog_rect.size.y > window_size.y) {
- int difference = dialog_rect.position.y + dialog_rect.size.y - window_size.y;
- members_dialog->set_position(members_dialog->get_position() - Point2(0, difference));
- }
- if (dialog_rect.position.x + dialog_rect.size.x > window_size.x) {
- int difference = dialog_rect.position.x + dialog_rect.size.x - window_size.x;
- members_dialog->set_position(members_dialog->get_position() - Point2(difference, 0));
- }
+ Vector2 difference = (dialog_rect.get_end() - window_rect.get_end()).max(Vector2());
+ members_dialog->set_position(members_dialog->get_position() - difference);
- node_filter->call_deferred(SNAME("grab_focus")); // still not visible
+ node_filter->call_deferred(SNAME("grab_focus")); // Still not visible.
node_filter->select_all();
}
@@ -3781,10 +3775,10 @@ void VisualShaderEditor::_node_menu_id_pressed(int p_idx) {
_convert_constants_to_uniforms(true);
break;
case NodeMenuOptions::SET_COMMENT_TITLE:
- _comment_title_popup_show(get_global_mouse_position(), selected_comment);
+ _comment_title_popup_show(get_screen_position() + get_local_mouse_position(), selected_comment);
break;
case NodeMenuOptions::SET_COMMENT_DESCRIPTION:
- _comment_desc_popup_show(get_global_mouse_position(), selected_comment);
+ _comment_desc_popup_show(get_screen_position() + get_local_mouse_position(), selected_comment);
break;
default:
break;
diff --git a/editor/plugins/voxel_gi_editor_plugin.cpp b/editor/plugins/voxel_gi_editor_plugin.cpp
index 9a44d40dcb..4f3cb9e189 100644
--- a/editor/plugins/voxel_gi_editor_plugin.cpp
+++ b/editor/plugins/voxel_gi_editor_plugin.cpp
@@ -67,31 +67,36 @@ void VoxelGIEditorPlugin::_notification(int p_what) {
return;
}
+ // Set information tooltip on the Bake button. This information is useful
+ // to optimize performance (video RAM size) and reduce light leaking (individual cell size).
+
const Vector3i size = voxel_gi->get_estimated_cell_size();
- String text = vformat(String::utf8("%d × %d × %d"), size.x, size.y, size.z);
+
+ const Vector3 extents = voxel_gi->get_extents();
+
const int data_size = 4;
const double size_mb = size.x * size.y * size.z * data_size / (1024.0 * 1024.0);
- text += " - " + vformat(TTR("VRAM Size: %s MB"), String::num(size_mb, 2));
-
- if (bake_info->get_text() == text) {
- return;
+ // Add a qualitative measurement to help the user assess whether a VoxelGI node is using a lot of VRAM.
+ String size_quality;
+ if (size_mb < 16.0) {
+ size_quality = TTR("Low");
+ } else if (size_mb < 64.0) {
+ size_quality = TTR("Moderate");
+ } else {
+ size_quality = TTR("High");
}
- // Color the label depending on the estimated performance level.
- Color color;
- if (size_mb <= 16.0 + CMP_EPSILON) {
- // Fast.
- color = bake_info->get_theme_color(SNAME("success_color"), SNAME("Editor"));
- } else if (size_mb <= 64.0 + CMP_EPSILON) {
- // Medium.
- color = bake_info->get_theme_color(SNAME("warning_color"), SNAME("Editor"));
- } else {
- // Slow.
- color = bake_info->get_theme_color(SNAME("error_color"), SNAME("Editor"));
+ String text;
+ text += vformat(TTR("Subdivisions: %s"), vformat(String::utf8("%d × %d × %d"), size.x, size.y, size.z)) + "\n";
+ text += vformat(TTR("Cell size: %s"), vformat(String::utf8("%.3f × %.3f × %.3f"), extents.x / size.x, extents.y / size.y, extents.z / size.z)) + "\n";
+ text += vformat(TTR("Video RAM size: %s MB (%s)"), String::num(size_mb, 2), size_quality);
+
+ // Only update the tooltip when needed to avoid constant redrawing.
+ if (bake->get_tooltip(Point2()) == text) {
+ return;
}
- bake_info->add_theme_color_override("font_color", color);
- bake_info->set_text(text);
+ bake->set_tooltip(text);
}
}
@@ -147,10 +152,6 @@ VoxelGIEditorPlugin::VoxelGIEditorPlugin(EditorNode *p_node) {
bake->set_text(TTR("Bake GI Probe"));
bake->connect("pressed", callable_mp(this, &VoxelGIEditorPlugin::_bake));
bake_hb->add_child(bake);
- bake_info = memnew(Label);
- bake_info->set_h_size_flags(Control::SIZE_EXPAND_FILL);
- bake_info->set_clip_text(true);
- bake_hb->add_child(bake_info);
add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU, bake_hb);
voxel_gi = nullptr;
diff --git a/editor/plugins/voxel_gi_editor_plugin.h b/editor/plugins/voxel_gi_editor_plugin.h
index 4d3cfe90f6..ed66728557 100644
--- a/editor/plugins/voxel_gi_editor_plugin.h
+++ b/editor/plugins/voxel_gi_editor_plugin.h
@@ -42,7 +42,6 @@ class VoxelGIEditorPlugin : public EditorPlugin {
VoxelGI *voxel_gi;
HBoxContainer *bake_hb;
- Label *bake_info;
Button *bake;
EditorNode *editor;
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp
index 73523474ef..d64efcc2ac 100644
--- a/editor/scene_tree_editor.cpp
+++ b/editor/scene_tree_editor.cpp
@@ -1122,7 +1122,7 @@ void SceneTreeEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data,
}
void SceneTreeEditor::_rmb_select(const Vector2 &p_pos) {
- emit_signal(SNAME("rmb_pressed"), tree->get_screen_transform().xform(p_pos));
+ emit_signal(SNAME("rmb_pressed"), tree->get_screen_position() + p_pos);
}
void SceneTreeEditor::update_warning() {