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.cpp77
-rw-r--r--editor/animation_track_editor.h2
-rw-r--r--editor/connections_dialog.cpp8
-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/editor_audio_buses.cpp10
-rw-r--r--editor/editor_file_dialog.cpp6
-rw-r--r--editor/editor_folding.cpp4
-rw-r--r--editor/editor_inspector.cpp11
-rw-r--r--editor/editor_node.cpp4
-rw-r--r--editor/editor_properties.cpp7
-rw-r--r--editor/filesystem_dock.cpp11
-rw-r--r--editor/icons/ProximityGroup3D.svg1
-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/theme_editor_preview.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
39 files changed, 205 insertions, 138 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..0c2754ba74 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"));
}
@@ -3240,7 +3250,7 @@ void AnimationTrackEditGroup::set_type_and_name(const Ref<Texture2D> &p_type, co
node_name = p_name;
node = p_node;
update();
- minimum_size_changed();
+ update_minimum_size();
}
Size2 AnimationTrackEditGroup::get_minimum_size() const {
@@ -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,55 @@ 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;
+ }
+ }
+
+ int existing_idx = -1;
+ 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);
+ } else {
+ 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 +6204,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_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/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_inspector.cpp b/editor/editor_inspector.cpp
index e1fae47057..d61be38014 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -1144,7 +1144,7 @@ void EditorInspectorSection::_test_unfold() {
void EditorInspectorSection::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_THEME_CHANGED: {
- minimum_size_changed();
+ update_minimum_size();
} break;
case NOTIFICATION_SORT_CHILDREN: {
if (!vbox_added) {
@@ -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();
}
@@ -1995,7 +1995,7 @@ void EditorInspectorArray::_notification(int p_what) {
prev_page_button->set_icon(get_theme_icon(SNAME("PagePrevious"), SNAME("EditorIcons")));
next_page_button->set_icon(get_theme_icon(SNAME("PageNext"), SNAME("EditorIcons")));
last_page_button->set_icon(get_theme_icon(SNAME("PageLast"), SNAME("EditorIcons")));
- minimum_size_changed();
+ update_minimum_size();
} break;
case NOTIFICATION_DRAG_BEGIN: {
Dictionary dict = get_viewport()->gui_get_drag_data();
@@ -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 ae13b59f63..9ffe677091 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -4236,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);
@@ -5052,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..b30168e5c3 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -832,7 +832,7 @@ public:
update();
} else if (expand_hovered) {
expanded = !expanded;
- minimum_size_changed();
+ update_minimum_size();
update();
}
}
@@ -935,7 +935,7 @@ public:
}
if ((expansion_rows != prev_expansion_rows) && expanded) {
- minimum_size_changed();
+ update_minimum_size();
}
if ((expansion_rows == 0) && (layer_index == layer_count)) {
@@ -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/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/icons/ProximityGroup3D.svg b/editor/icons/ProximityGroup3D.svg
deleted file mode 100644
index 5cbf8add7b..0000000000
--- a/editor/icons/ProximityGroup3D.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m1 1v14h14v-14zm2 2h10v10h-10zm7.5 1c-.82843.0000048-1.5.67157-1.5 1.5.0000048.82843.67157 1.5 1.5 1.5.82842-.0000048 1.5-.67157 1.5-1.5-.000005-.82843-.67158-1.5-1.5-1.5zm-5 5c-.82843-.0000048-1.5.67157-1.5 1.5-.0000048.82843.67157 1.5 1.5 1.5.82843.000005 1.5-.67157 1.5-1.5.0000048-.82843-.67157-1.5-1.5-1.5zm5 0c-.82843.0000048-1.5.67157-1.5 1.5.0000048.82842.67157 1.5 1.5 1.5.82842-.000005 1.5-.67158 1.5-1.5-.000005-.82843-.67158-1.5-1.5-1.5z" fill="#fc7f7f" fill-opacity=".99608"/></svg>
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/theme_editor_preview.cpp b/editor/plugins/theme_editor_preview.cpp
index 86b0fc0eaf..7340c17b6e 100644
--- a/editor/plugins/theme_editor_preview.cpp
+++ b/editor/plugins/theme_editor_preview.cpp
@@ -47,7 +47,7 @@ void ThemeEditorPreview::add_preview_overlay(Control *p_overlay) {
void ThemeEditorPreview::_propagate_redraw(Control *p_at) {
p_at->notification(NOTIFICATION_THEME_CHANGED);
- p_at->minimum_size_changed();
+ p_at->update_minimum_size();
p_at->update();
for (int i = 0; i < p_at->get_child_count(); i++) {
Control *a = Object::cast_to<Control>(p_at->get_child(i));
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() {