summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/action_map_editor.cpp2
-rw-r--r--editor/code_editor.cpp4
-rw-r--r--editor/debugger/editor_debugger_node.cpp8
-rw-r--r--editor/debugger/editor_debugger_node.h2
-rw-r--r--editor/debugger/editor_debugger_server.cpp17
-rw-r--r--editor/debugger/editor_debugger_server.h2
-rw-r--r--editor/editor_command_palette.cpp27
-rw-r--r--editor/editor_command_palette.h11
-rw-r--r--editor/editor_inspector.cpp23
-rw-r--r--editor/editor_inspector.h1
-rw-r--r--editor/editor_node.cpp30
-rw-r--r--editor/editor_node.h3
-rw-r--r--editor/editor_plugin.cpp1
-rw-r--r--editor/editor_properties.cpp178
-rw-r--r--editor/editor_properties.h2
-rw-r--r--editor/import/scene_importer_mesh.cpp51
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp2
-rw-r--r--editor/plugins/animation_player_editor_plugin.h5
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp2
-rw-r--r--editor/project_manager.cpp4
20 files changed, 229 insertions, 146 deletions
diff --git a/editor/action_map_editor.cpp b/editor/action_map_editor.cpp
index 7aa63f899b..6789b5be00 100644
--- a/editor/action_map_editor.cpp
+++ b/editor/action_map_editor.cpp
@@ -248,10 +248,8 @@ void InputEventConfigurationDialog::_listen_window_input(const Ref<InputEvent> &
k->set_pressed(false); // to avoid serialisation of 'pressed' property - doesn't matter for actions anyway.
// Maintain physical keycode option state
if (physical_key_checkbox->is_pressed()) {
- k->set_physical_keycode(k->get_keycode());
k->set_keycode(KEY_NONE);
} else {
- k->set_keycode((Key)k->get_physical_keycode());
k->set_physical_keycode(KEY_NONE);
}
}
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 8aa5d62f98..5599076c40 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -1302,7 +1302,9 @@ void CodeTextEditor::_delete_line(int p_line) {
text_editor->set_caret_column(0);
}
text_editor->backspace();
- text_editor->unfold_line(p_line);
+ if (p_line < text_editor->get_line_count()) {
+ text_editor->unfold_line(p_line);
+ }
text_editor->set_caret_line(p_line);
}
diff --git a/editor/debugger/editor_debugger_node.cpp b/editor/debugger/editor_debugger_node.cpp
index 07c02eb022..be84e8dec5 100644
--- a/editor/debugger/editor_debugger_node.cpp
+++ b/editor/debugger/editor_debugger_node.cpp
@@ -183,16 +183,16 @@ ScriptEditorDebugger *EditorDebuggerNode::get_default_debugger() const {
return Object::cast_to<ScriptEditorDebugger>(tabs->get_tab_control(0));
}
-Error EditorDebuggerNode::start(const String &p_protocol) {
+Error EditorDebuggerNode::start(const String &p_uri) {
stop();
+ ERR_FAIL_COND_V(p_uri.find("://") < 0, ERR_INVALID_PARAMETER);
if (EDITOR_GET("run/output/always_open_output_on_play")) {
EditorNode::get_singleton()->make_bottom_panel_item_visible(EditorNode::get_log());
} else {
EditorNode::get_singleton()->make_bottom_panel_item_visible(this);
}
-
- server = Ref<EditorDebuggerServer>(EditorDebuggerServer::create(p_protocol));
- const Error err = server->start();
+ server = Ref<EditorDebuggerServer>(EditorDebuggerServer::create(p_uri.substr(0, p_uri.find("://") + 3)));
+ const Error err = server->start(p_uri);
if (err != OK) {
return err;
}
diff --git a/editor/debugger/editor_debugger_node.h b/editor/debugger/editor_debugger_node.h
index 39a95326be..4d9e846834 100644
--- a/editor/debugger/editor_debugger_node.h
+++ b/editor/debugger/editor_debugger_node.h
@@ -188,7 +188,7 @@ public:
void set_camera_override(CameraOverride p_override);
CameraOverride get_camera_override();
- Error start(const String &p_protocol = "tcp://");
+ Error start(const String &p_uri = "tcp://");
void stop();
diff --git a/editor/debugger/editor_debugger_server.cpp b/editor/debugger/editor_debugger_server.cpp
index e8524e0702..8c3833af50 100644
--- a/editor/debugger/editor_debugger_server.cpp
+++ b/editor/debugger/editor_debugger_server.cpp
@@ -45,7 +45,7 @@ private:
public:
static EditorDebuggerServer *create(const String &p_protocol);
virtual void poll() {}
- virtual Error start();
+ virtual Error start(const String &p_uri);
virtual void stop();
virtual bool is_active() const;
virtual bool is_connection_available() const;
@@ -63,11 +63,18 @@ EditorDebuggerServerTCP::EditorDebuggerServerTCP() {
server.instantiate();
}
-Error EditorDebuggerServerTCP::start() {
- int remote_port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port");
- const Error err = server->listen(remote_port);
+Error EditorDebuggerServerTCP::start(const String &p_uri) {
+ int bind_port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port");
+ String bind_host = (String)EditorSettings::get_singleton()->get("network/debug/remote_host");
+ 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(remote_port), EditorLog::MSG_TYPE_ERROR);
+ EditorNode::get_log()->add_message(String("Error listening on port ") + itos(bind_port), EditorLog::MSG_TYPE_ERROR);
return err;
}
return err;
diff --git a/editor/debugger/editor_debugger_server.h b/editor/debugger/editor_debugger_server.h
index 6216d0df3d..844d1a9e5a 100644
--- a/editor/debugger/editor_debugger_server.h
+++ b/editor/debugger/editor_debugger_server.h
@@ -48,7 +48,7 @@ public:
static void register_protocol_handler(const String &p_protocol, CreateServerFunc p_func);
static EditorDebuggerServer *create(const String &p_protocol);
virtual void poll() = 0;
- virtual Error start() = 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/editor_command_palette.cpp b/editor/editor_command_palette.cpp
index 25250e231e..4ad45f9649 100644
--- a/editor/editor_command_palette.cpp
+++ b/editor/editor_command_palette.cpp
@@ -70,6 +70,7 @@ void EditorCommandPalette::_update_command_search(const String &search_text) {
r.key_name = command_keys[i];
r.display_name = commands[r.key_name].name;
r.shortcut_text = commands[r.key_name].shortcut;
+ r.last_used = commands[r.key_name].last_used;
if (search_text.is_subsequence_ofi(r.display_name)) {
if (!search_text.is_empty()) {
@@ -94,6 +95,9 @@ void EditorCommandPalette::_update_command_search(const String &search_text) {
if (!search_text.is_empty()) {
SortArray<CommandEntry, CommandEntryComparator> sorter;
sorter.sort(entries.ptrw(), entries.size());
+ } else {
+ SortArray<CommandEntry, CommandHistoryComparator> sorter;
+ sorter.sort(entries.ptrw(), entries.size());
}
const int entry_limit = MIN(entries.size(), 300);
@@ -213,7 +217,9 @@ void EditorCommandPalette::_add_command(String p_command_name, String p_key_name
void EditorCommandPalette::execute_command(String &p_command_key) {
ERR_FAIL_COND_MSG(!commands.has(p_command_key), p_command_key + " not found.");
+ commands[p_command_key].last_used = OS::get_singleton()->get_unix_time();
commands[p_command_key].callable.call_deferred(nullptr, 0);
+ _save_history();
}
void EditorCommandPalette::register_shortcuts_as_command() {
@@ -230,6 +236,14 @@ void EditorCommandPalette::register_shortcuts_as_command() {
key = unregistered_shortcuts.next(key);
}
unregistered_shortcuts.clear();
+
+ // Load command use history.
+ Dictionary command_history = EditorSettings::get_singleton()->get_project_metadata("command_palette", "command_history", Dictionary());
+ Array history_entries = command_history.keys();
+ for (int i = 0; i < history_entries.size(); i++) {
+ const String &history_key = history_entries[i];
+ commands[history_key].last_used = command_history[history_key];
+ }
}
Ref<Shortcut> EditorCommandPalette::add_shortcut_command(const String &p_command, const String &p_key, Ref<Shortcut> p_shortcut) {
@@ -252,6 +266,19 @@ void EditorCommandPalette::_theme_changed() {
command_search_box->set_right_icon(search_options->get_theme_icon("Search", "EditorIcons"));
}
+void EditorCommandPalette::_save_history() const {
+ Dictionary command_history;
+ List<String> command_keys;
+ commands.get_key_list(&command_keys);
+
+ for (const String &key : command_keys) {
+ if (commands[key].last_used > 0) {
+ command_history[key] = commands[key].last_used;
+ }
+ }
+ EditorSettings::get_singleton()->set_project_metadata("command_palette", "command_history", command_history);
+}
+
EditorCommandPalette *EditorCommandPalette::get_singleton() {
if (singleton == nullptr) {
singleton = memnew(EditorCommandPalette);
diff --git a/editor/editor_command_palette.h b/editor/editor_command_palette.h
index 093f4b797d..39821a1169 100644
--- a/editor/editor_command_palette.h
+++ b/editor/editor_command_palette.h
@@ -47,13 +47,15 @@ class EditorCommandPalette : public ConfirmationDialog {
Callable callable;
String name;
String shortcut;
+ int last_used = 0; // Store time as int, because doubles have problems with text serialization.
};
struct CommandEntry {
String key_name;
String display_name;
String shortcut_text;
- float score;
+ int last_used = 0;
+ float score = 0;
};
struct CommandEntryComparator {
@@ -62,6 +64,12 @@ class EditorCommandPalette : public ConfirmationDialog {
}
};
+ struct CommandHistoryComparator {
+ _FORCE_INLINE_ bool operator()(const CommandEntry &A, const CommandEntry &B) const {
+ return A.last_used > B.last_used;
+ }
+ };
+
HashMap<String, Command> commands;
HashMap<String, Pair<String, Ref<Shortcut>>> unregistered_shortcuts;
@@ -74,6 +82,7 @@ class EditorCommandPalette : public ConfirmationDialog {
void _update_command_keys();
void _add_command(String p_command_name, String p_key_name, Callable p_binded_action, String p_shortcut_text = "None");
void _theme_changed();
+ void _save_history() const;
EditorCommandPalette();
protected:
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index 298c1ed917..7631e425e8 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -815,6 +815,19 @@ void EditorProperty::unhandled_key_input(const Ref<InputEvent> &p_event) {
}
}
+const Color *EditorProperty::_get_property_colors() {
+ const Color base = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
+ const float saturation = base.get_s() * 0.75;
+ const float value = base.get_v();
+
+ static Color c[4];
+ c[0].set_hsv(0.0 / 3.0 + 0.05, saturation, value);
+ c[1].set_hsv(1.0 / 3.0 + 0.05, saturation, value);
+ c[2].set_hsv(2.0 / 3.0 + 0.05, saturation, value);
+ c[3].set_hsv(1.5 / 3.0 + 0.05, saturation, value);
+ return c;
+}
+
void EditorProperty::set_label_reference(Control *p_control) {
label_reference = p_control;
}
@@ -1266,9 +1279,13 @@ void EditorInspectorSection::_notification(int p_what) {
}
header_height += get_theme_constant(SNAME("vseparation"), SNAME("Tree"));
+ Rect2 header_rect = Rect2(Vector2(), Vector2(get_size().width, header_height));
Color c = bg_color;
c.a *= 0.4;
- draw_rect(Rect2(Vector2(), Vector2(get_size().width, header_height)), c);
+ if (foldable && header_rect.has_point(get_local_mouse_position())) {
+ c = c.lightened(Input::get_singleton()->is_mouse_button_pressed(MOUSE_BUTTON_LEFT) ? -0.05 : 0.2);
+ }
+ draw_rect(header_rect, c);
const int arrow_margin = 2;
const int arrow_width = arrow.is_valid() ? arrow->get_width() : 0;
@@ -1315,12 +1332,14 @@ void EditorInspectorSection::_notification(int p_what) {
if (dropping) {
dropping_unfold_timer->start();
}
+ update();
} break;
case NOTIFICATION_MOUSE_EXIT: {
if (dropping) {
dropping_unfold_timer->stop();
}
+ update();
} break;
}
}
@@ -1395,6 +1414,8 @@ void EditorInspectorSection::gui_input(const Ref<InputEvent> &p_event) {
} else {
fold();
}
+ } else if (mb.is_valid() && !mb->is_pressed()) {
+ update();
}
}
diff --git a/editor/editor_inspector.h b/editor/editor_inspector.h
index 5992c23f8c..b71efe8f19 100644
--- a/editor/editor_inspector.h
+++ b/editor/editor_inspector.h
@@ -123,6 +123,7 @@ protected:
virtual void gui_input(const Ref<InputEvent> &p_event) override;
virtual void unhandled_key_input(const Ref<InputEvent> &p_event) override;
+ const Color *_get_property_colors();
public:
void emit_changed(const StringName &p_property, const Variant &p_value, const StringName &p_field = StringName(), bool p_changing = false);
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index cf4f8c0b7d..9c7f80b2b0 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -524,6 +524,26 @@ void EditorNode::_update_from_settings() {
RS::get_singleton()->light_projectors_set_filter(RS::LightProjectorFilter(int(GLOBAL_GET("rendering/textures/light_projectors/filter"))));
}
+void EditorNode::_select_default_main_screen_plugin() {
+ if (EDITOR_3D < main_editor_buttons.size() && main_editor_buttons[EDITOR_3D]->is_visible()) {
+ // If the 3D editor is enabled, use this as the default.
+ _editor_select(EDITOR_3D);
+ return;
+ }
+
+ // Switch to the first main screen plugin that is enabled. Usually this is
+ // 2D, but may be subsequent ones if 2D is disabled in the feature profile.
+ for (int i = 0; i < main_editor_buttons.size(); i++) {
+ Button *editor_button = main_editor_buttons[i];
+ if (editor_button->is_visible()) {
+ _editor_select(i);
+ return;
+ }
+ }
+
+ _editor_select(-1);
+}
+
void EditorNode::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_PROCESS: {
@@ -613,11 +633,7 @@ void EditorNode::_notification(int p_what) {
feature_profile_manager->notify_changed();
- if (!main_editor_buttons[EDITOR_3D]->is_visible()) { //may be hidden due to feature profile
- _editor_select(EDITOR_2D);
- } else {
- _editor_select(EDITOR_3D);
- }
+ _select_default_main_screen_plugin();
// Save the project after opening to mark it as last modified, except in headless mode.
if (DisplayServer::get_singleton()->window_can_draw()) {
@@ -3100,9 +3116,10 @@ void EditorNode::add_editor_plugin(EditorPlugin *p_editor, bool p_config_changed
tb->set_flat(true);
tb->set_toggle_mode(true);
tb->connect("pressed", callable_mp(singleton, &EditorNode::_editor_select), varray(singleton->main_editor_buttons.size()));
+ tb->set_name(p_editor->get_name());
tb->set_text(p_editor->get_name());
- Ref<Texture2D> icon = p_editor->get_icon();
+ Ref<Texture2D> icon = p_editor->get_icon();
if (icon.is_valid()) {
tb->set_icon(icon);
} else if (singleton->gui_base->has_theme_icon(p_editor->get_name(), "EditorIcons")) {
@@ -3112,7 +3129,6 @@ void EditorNode::add_editor_plugin(EditorPlugin *p_editor, bool p_config_changed
tb->add_theme_font_override("font", singleton->gui_base->get_theme_font(SNAME("main_button_font"), SNAME("EditorFonts")));
tb->add_theme_font_size_override("font_size", singleton->gui_base->get_theme_font_size(SNAME("main_button_font_size"), SNAME("EditorFonts")));
- tb->set_name(p_editor->get_name());
singleton->main_editor_buttons.push_back(tb);
singleton->main_editor_button_vb->add_child(tb);
singleton->editor_table.push_back(p_editor);
diff --git a/editor/editor_node.h b/editor/editor_node.h
index 488957b1df..2e8b850c7b 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -32,7 +32,6 @@
#define EDITOR_NODE_H
#include "core/templates/safe_refcount.h"
-#include "editor/editor_command_palette.h"
#include "editor/editor_data.h"
#include "editor/editor_export.h"
#include "editor/editor_folding.h"
@@ -682,6 +681,8 @@ private:
bool immediate_dialog_confirmed = false;
void _immediate_dialog_confirmed();
+ void _select_default_main_screen_plugin();
+
protected:
void _notification(int p_what);
diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp
index 73ea4fb5ef..5baffb6f9d 100644
--- a/editor/editor_plugin.cpp
+++ b/editor/editor_plugin.cpp
@@ -30,6 +30,7 @@
#include "editor_plugin.h"
+#include "editor/editor_command_palette.h"
#include "editor/editor_export.h"
#include "editor/editor_node.h"
#include "editor/editor_paths.h"
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 1729705be5..c1e60e141c 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -1510,11 +1510,9 @@ void EditorPropertyVector2::update_property() {
void EditorPropertyVector2::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
- Color base = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
+ const Color *colors = _get_property_colors();
for (int i = 0; i < 2; i++) {
- Color c = base;
- c.set_hsv(float(i) / 3.0 + 0.05, c.get_s() * 0.75, c.get_v());
- spin[i]->set_custom_label_color(true, c);
+ spin[i]->set_custom_label_color(true, colors[i]);
}
}
}
@@ -1603,11 +1601,9 @@ void EditorPropertyRect2::update_property() {
void EditorPropertyRect2::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
- Color base = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
+ const Color *colors = _get_property_colors();
for (int i = 0; i < 4; i++) {
- Color c = base;
- c.set_hsv(float(i % 2) / 3.0 + 0.05, c.get_s() * 0.75, c.get_v());
- spin[i]->set_custom_label_color(true, c);
+ spin[i]->set_custom_label_color(true, colors[i % 2]);
}
}
}
@@ -1731,11 +1727,9 @@ Vector3 EditorPropertyVector3::get_vector() {
void EditorPropertyVector3::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
- Color base = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
+ const Color *colors = _get_property_colors();
for (int i = 0; i < 3; i++) {
- Color c = base;
- c.set_hsv(float(i) / 3.0 + 0.05, c.get_s() * 0.75, c.get_v());
- spin[i]->set_custom_label_color(true, c);
+ spin[i]->set_custom_label_color(true, colors[i]);
}
}
}
@@ -1820,11 +1814,9 @@ void EditorPropertyVector2i::update_property() {
void EditorPropertyVector2i::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
- Color base = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
+ const Color *colors = _get_property_colors();
for (int i = 0; i < 2; i++) {
- Color c = base;
- c.set_hsv(float(i) / 3.0 + 0.05, c.get_s() * 0.75, c.get_v());
- spin[i]->set_custom_label_color(true, c);
+ spin[i]->set_custom_label_color(true, colors[i]);
}
}
}
@@ -1913,11 +1905,9 @@ void EditorPropertyRect2i::update_property() {
void EditorPropertyRect2i::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
- Color base = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
+ const Color *colors = _get_property_colors();
for (int i = 0; i < 4; i++) {
- Color c = base;
- c.set_hsv(float(i % 2) / 3.0 + 0.05, c.get_s() * 0.75, c.get_v());
- spin[i]->set_custom_label_color(true, c);
+ spin[i]->set_custom_label_color(true, colors[i % 2]);
}
}
}
@@ -2014,11 +2004,9 @@ void EditorPropertyVector3i::update_property() {
void EditorPropertyVector3i::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
- Color base = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
+ const Color *colors = _get_property_colors();
for (int i = 0; i < 3; i++) {
- Color c = base;
- c.set_hsv(float(i) / 3.0 + 0.05, c.get_s() * 0.75, c.get_v());
- spin[i]->set_custom_label_color(true, c);
+ spin[i]->set_custom_label_color(true, colors[i]);
}
}
}
@@ -2106,11 +2094,9 @@ void EditorPropertyPlane::update_property() {
void EditorPropertyPlane::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
- Color base = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
- for (int i = 0; i < 3; i++) {
- Color c = base;
- c.set_hsv(float(i) / 3.0 + 0.05, c.get_s() * 0.75, c.get_v());
- spin[i]->set_custom_label_color(true, c);
+ const Color *colors = _get_property_colors();
+ for (int i = 0; i < 4; i++) {
+ spin[i]->set_custom_label_color(true, colors[i]);
}
}
}
@@ -2199,11 +2185,9 @@ void EditorPropertyQuaternion::update_property() {
void EditorPropertyQuaternion::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
- Color base = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
- for (int i = 0; i < 3; i++) {
- Color c = base;
- c.set_hsv(float(i) / 3.0 + 0.05, c.get_s() * 0.75, c.get_v());
- spin[i]->set_custom_label_color(true, c);
+ const Color *colors = _get_property_colors();
+ for (int i = 0; i < 4; i++) {
+ spin[i]->set_custom_label_color(true, colors[i]);
}
}
}
@@ -2295,11 +2279,9 @@ void EditorPropertyAABB::update_property() {
void EditorPropertyAABB::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
- Color base = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
+ const Color *colors = _get_property_colors();
for (int i = 0; i < 6; i++) {
- Color c = base;
- c.set_hsv(float(i % 3) / 3.0 + 0.05, c.get_s() * 0.75, c.get_v());
- spin[i]->set_custom_label_color(true, c);
+ spin[i]->set_custom_label_color(true, colors[i % 3]);
}
}
}
@@ -2354,10 +2336,10 @@ void EditorPropertyTransform2D::_value_changed(double val, const String &p_name)
Transform2D p;
p[0][0] = spin[0]->get_value();
- p[0][1] = spin[1]->get_value();
- p[1][0] = spin[2]->get_value();
- p[1][1] = spin[3]->get_value();
- p[2][0] = spin[4]->get_value();
+ p[1][0] = spin[1]->get_value();
+ p[2][0] = spin[2]->get_value();
+ p[0][1] = spin[3]->get_value();
+ p[1][1] = spin[4]->get_value();
p[2][1] = spin[5]->get_value();
emit_changed(get_edited_property(), p, p_name);
@@ -2367,10 +2349,10 @@ void EditorPropertyTransform2D::update_property() {
Transform2D val = get_edited_object()->get(get_edited_property());
setting = true;
spin[0]->set_value(val[0][0]);
- spin[1]->set_value(val[0][1]);
- spin[2]->set_value(val[1][0]);
- spin[3]->set_value(val[1][1]);
- spin[4]->set_value(val[2][0]);
+ spin[1]->set_value(val[1][0]);
+ spin[2]->set_value(val[2][0]);
+ spin[3]->set_value(val[0][1]);
+ spin[4]->set_value(val[1][1]);
spin[5]->set_value(val[2][1]);
setting = false;
@@ -2378,11 +2360,14 @@ void EditorPropertyTransform2D::update_property() {
void EditorPropertyTransform2D::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
- Color base = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
+ const Color *colors = _get_property_colors();
for (int i = 0; i < 6; i++) {
- Color c = base;
- c.set_hsv(float(i % 2) / 3.0 + 0.05, c.get_s() * 0.75, c.get_v());
- spin[i]->set_custom_label_color(true, c);
+ // For Transform2D, use the 4th color (cyan) for the origin vector.
+ if (i % 3 == 2) {
+ spin[i]->set_custom_label_color(true, colors[3]);
+ } else {
+ spin[i]->set_custom_label_color(true, colors[i % 3]);
+ }
}
}
}
@@ -2402,17 +2387,19 @@ void EditorPropertyTransform2D::setup(double p_min, double p_max, double p_step,
}
}
-EditorPropertyTransform2D::EditorPropertyTransform2D() {
+EditorPropertyTransform2D::EditorPropertyTransform2D(bool p_include_origin) {
GridContainer *g = memnew(GridContainer);
- g->set_columns(2);
+ g->set_columns(p_include_origin ? 3 : 2);
add_child(g);
- static const char *desc[6] = { "x", "y", "x", "y", "x", "y" };
+ static const char *desc[6] = { "xx", "xy", "xo", "yx", "yy", "yo" };
for (int i = 0; i < 6; i++) {
spin[i] = memnew(EditorSpinSlider);
spin[i]->set_label(desc[i]);
spin[i]->set_flat(true);
- g->add_child(spin[i]);
+ if (p_include_origin || i % 3 != 2) {
+ g->add_child(spin[i]);
+ }
spin[i]->set_h_size_flags(SIZE_EXPAND_FILL);
add_focusable(spin[i]);
spin[i]->connect("value_changed", callable_mp(this, &EditorPropertyTransform2D::_value_changed), varray(desc[i]));
@@ -2436,13 +2423,13 @@ void EditorPropertyBasis::_value_changed(double val, const String &p_name) {
Basis p;
p[0][0] = spin[0]->get_value();
- p[1][0] = spin[1]->get_value();
- p[2][0] = spin[2]->get_value();
- p[0][1] = spin[3]->get_value();
+ p[0][1] = spin[1]->get_value();
+ p[0][2] = spin[2]->get_value();
+ p[1][0] = spin[3]->get_value();
p[1][1] = spin[4]->get_value();
- p[2][1] = spin[5]->get_value();
- p[0][2] = spin[6]->get_value();
- p[1][2] = spin[7]->get_value();
+ p[1][2] = spin[5]->get_value();
+ p[2][0] = spin[6]->get_value();
+ p[2][1] = spin[7]->get_value();
p[2][2] = spin[8]->get_value();
emit_changed(get_edited_property(), p, p_name);
@@ -2452,13 +2439,13 @@ void EditorPropertyBasis::update_property() {
Basis val = get_edited_object()->get(get_edited_property());
setting = true;
spin[0]->set_value(val[0][0]);
- spin[1]->set_value(val[1][0]);
- spin[2]->set_value(val[2][0]);
- spin[3]->set_value(val[0][1]);
+ spin[1]->set_value(val[0][1]);
+ spin[2]->set_value(val[0][2]);
+ spin[3]->set_value(val[1][0]);
spin[4]->set_value(val[1][1]);
- spin[5]->set_value(val[2][1]);
- spin[6]->set_value(val[0][2]);
- spin[7]->set_value(val[1][2]);
+ spin[5]->set_value(val[1][2]);
+ spin[6]->set_value(val[2][0]);
+ spin[7]->set_value(val[2][1]);
spin[8]->set_value(val[2][2]);
setting = false;
@@ -2466,11 +2453,9 @@ void EditorPropertyBasis::update_property() {
void EditorPropertyBasis::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
- Color base = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
+ const Color *colors = _get_property_colors();
for (int i = 0; i < 9; i++) {
- Color c = base;
- c.set_hsv(float(i % 3) / 3.0 + 0.05, c.get_s() * 0.75, c.get_v());
- spin[i]->set_custom_label_color(true, c);
+ spin[i]->set_custom_label_color(true, colors[i % 3]);
}
}
}
@@ -2495,7 +2480,7 @@ EditorPropertyBasis::EditorPropertyBasis() {
g->set_columns(3);
add_child(g);
- static const char *desc[9] = { "x", "y", "z", "x", "y", "z", "x", "y", "z" };
+ static const char *desc[9] = { "xx", "xy", "xz", "yx", "yy", "yz", "zx", "zy", "zz" };
for (int i = 0; i < 9; i++) {
spin[i] = memnew(EditorSpinSlider);
spin[i]->set_label(desc[i]);
@@ -2524,16 +2509,16 @@ void EditorPropertyTransform3D::_value_changed(double val, const String &p_name)
Transform3D p;
p.basis[0][0] = spin[0]->get_value();
- p.basis[1][0] = spin[1]->get_value();
- p.basis[2][0] = spin[2]->get_value();
- p.basis[0][1] = spin[3]->get_value();
- p.basis[1][1] = spin[4]->get_value();
- p.basis[2][1] = spin[5]->get_value();
- p.basis[0][2] = spin[6]->get_value();
- p.basis[1][2] = spin[7]->get_value();
- p.basis[2][2] = spin[8]->get_value();
- p.origin[0] = spin[9]->get_value();
- p.origin[1] = spin[10]->get_value();
+ p.basis[0][1] = spin[1]->get_value();
+ p.basis[0][2] = spin[2]->get_value();
+ p.origin[0] = spin[3]->get_value();
+ p.basis[1][0] = spin[4]->get_value();
+ p.basis[1][1] = spin[5]->get_value();
+ p.basis[1][2] = spin[6]->get_value();
+ p.origin[1] = spin[7]->get_value();
+ p.basis[2][0] = spin[8]->get_value();
+ p.basis[2][1] = spin[9]->get_value();
+ p.basis[2][2] = spin[10]->get_value();
p.origin[2] = spin[11]->get_value();
emit_changed(get_edited_property(), p, p_name);
@@ -2546,27 +2531,25 @@ void EditorPropertyTransform3D::update_property() {
void EditorPropertyTransform3D::update_using_transform(Transform3D p_transform) {
setting = true;
spin[0]->set_value(p_transform.basis[0][0]);
- spin[1]->set_value(p_transform.basis[1][0]);
- spin[2]->set_value(p_transform.basis[2][0]);
- spin[3]->set_value(p_transform.basis[0][1]);
- spin[4]->set_value(p_transform.basis[1][1]);
- spin[5]->set_value(p_transform.basis[2][1]);
- spin[6]->set_value(p_transform.basis[0][2]);
- spin[7]->set_value(p_transform.basis[1][2]);
- spin[8]->set_value(p_transform.basis[2][2]);
- spin[9]->set_value(p_transform.origin[0]);
- spin[10]->set_value(p_transform.origin[1]);
+ spin[1]->set_value(p_transform.basis[0][1]);
+ spin[2]->set_value(p_transform.basis[0][2]);
+ spin[3]->set_value(p_transform.origin[0]);
+ spin[4]->set_value(p_transform.basis[1][0]);
+ spin[5]->set_value(p_transform.basis[1][1]);
+ spin[6]->set_value(p_transform.basis[1][2]);
+ spin[7]->set_value(p_transform.origin[1]);
+ spin[8]->set_value(p_transform.basis[2][0]);
+ spin[9]->set_value(p_transform.basis[2][1]);
+ spin[10]->set_value(p_transform.basis[2][2]);
spin[11]->set_value(p_transform.origin[2]);
setting = false;
}
void EditorPropertyTransform3D::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
- Color base = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
+ const Color *colors = _get_property_colors();
for (int i = 0; i < 12; i++) {
- Color c = base;
- c.set_hsv(float(i % 3) / 3.0 + 0.05, c.get_s() * 0.75, c.get_v());
- spin[i]->set_custom_label_color(true, c);
+ spin[i]->set_custom_label_color(true, colors[i % 4]);
}
}
}
@@ -2588,10 +2571,10 @@ void EditorPropertyTransform3D::setup(double p_min, double p_max, double p_step,
EditorPropertyTransform3D::EditorPropertyTransform3D() {
GridContainer *g = memnew(GridContainer);
- g->set_columns(3);
+ g->set_columns(4);
add_child(g);
- static const char *desc[12] = { "x", "y", "z", "x", "y", "z", "x", "y", "z", "x", "y", "z" };
+ static const char *desc[12] = { "xx", "xy", "xz", "xo", "yx", "yy", "yz", "yo", "zx", "zy", "zz", "zo" };
for (int i = 0; i < 12; i++) {
spin[i] = memnew(EditorSpinSlider);
spin[i]->set_label(desc[i]);
@@ -3448,7 +3431,6 @@ EditorProperty *EditorInspectorDefaultPlugin::get_editor_for_property(Object *p_
EditorPropertyRangeHint hint = _parse_range_hint(p_hint, p_hint_text, default_float_step);
editor->setup(hint.min, hint.max, hint.step, hint.hide_slider, hint.suffix);
return editor;
-
} break;
case Variant::PLANE: {
EditorPropertyPlane *editor = memnew(EditorPropertyPlane(p_wide));
diff --git a/editor/editor_properties.h b/editor/editor_properties.h
index cee5ab96a7..9a687f1a72 100644
--- a/editor/editor_properties.h
+++ b/editor/editor_properties.h
@@ -554,7 +554,7 @@ protected:
public:
virtual void update_property() override;
void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String());
- EditorPropertyTransform2D();
+ EditorPropertyTransform2D(bool p_include_origin = true);
};
class EditorPropertyBasis : public EditorProperty {
diff --git a/editor/import/scene_importer_mesh.cpp b/editor/import/scene_importer_mesh.cpp
index 55bea50432..5e6dd08e79 100644
--- a/editor/import/scene_importer_mesh.cpp
+++ b/editor/import/scene_importer_mesh.cpp
@@ -525,35 +525,46 @@ Vector<Face3> EditorSceneImporterMesh::get_faces() const {
}
Vector<Ref<Shape3D>> EditorSceneImporterMesh::convex_decompose(const Mesh::ConvexDecompositionSettings &p_settings) const {
- ERR_FAIL_COND_V(!Mesh::convex_composition_function, Vector<Ref<Shape3D>>());
+ ERR_FAIL_COND_V(!Mesh::convex_decomposition_function, Vector<Ref<Shape3D>>());
const Vector<Face3> faces = get_faces();
+ int face_count = faces.size();
- Vector<Vector<Face3>> decomposed = Mesh::convex_composition_function(faces, p_settings);
+ Vector<Vector3> vertices;
+ uint32_t vertex_count = 0;
+ vertices.resize(face_count * 3);
+ Vector<uint32_t> indices;
+ indices.resize(face_count * 3);
+ {
+ Map<Vector3, uint32_t> vertex_map;
+ Vector3 *vertex_w = vertices.ptrw();
+ uint32_t *index_w = indices.ptrw();
+ for (int i = 0; i < face_count; i++) {
+ for (int j = 0; j < 3; j++) {
+ const Vector3 &vertex = faces[i].vertex[j];
+ Map<Vector3, uint32_t>::Element *found_vertex = vertex_map.find(vertex);
+ uint32_t index;
+ if (found_vertex) {
+ index = found_vertex->get();
+ } else {
+ index = ++vertex_count;
+ vertex_map[vertex] = index;
+ vertex_w[index] = vertex;
+ }
+ index_w[i * 3 + j] = index;
+ }
+ }
+ }
+ vertices.resize(vertex_count);
+
+ Vector<Vector<Vector3>> decomposed = Mesh::convex_decomposition_function((real_t *)vertices.ptr(), vertex_count, indices.ptr(), face_count, p_settings, nullptr);
Vector<Ref<Shape3D>> ret;
for (int i = 0; i < decomposed.size(); i++) {
- Set<Vector3> points;
- for (int j = 0; j < decomposed[i].size(); j++) {
- points.insert(decomposed[i][j].vertex[0]);
- points.insert(decomposed[i][j].vertex[1]);
- points.insert(decomposed[i][j].vertex[2]);
- }
-
- Vector<Vector3> convex_points;
- convex_points.resize(points.size());
- {
- Vector3 *w = convex_points.ptrw();
- int idx = 0;
- for (Set<Vector3>::Element *E = points.front(); E; E = E->next()) {
- w[idx++] = E->get();
- }
- }
-
Ref<ConvexPolygonShape3D> shape;
shape.instantiate();
- shape->set_points(convex_points);
+ shape->set_points(decomposed[i]);
ret.push_back(shape);
}
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index 830b010d01..18b4966f80 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -904,7 +904,7 @@ void AnimationPlayerEditor::edit(AnimationPlayer *p_player) {
}
}
-void AnimationPlayerEditor::forward_canvas_force_draw_over_viewport(Control *p_overlay) {
+void AnimationPlayerEditor::forward_force_draw_over_viewport(Control *p_overlay) {
if (!onion.can_overlay) {
return;
}
diff --git a/editor/plugins/animation_player_editor_plugin.h b/editor/plugins/animation_player_editor_plugin.h
index be80b7f4e3..0a514d3ff1 100644
--- a/editor/plugins/animation_player_editor_plugin.h
+++ b/editor/plugins/animation_player_editor_plugin.h
@@ -238,7 +238,7 @@ public:
void set_undo_redo(UndoRedo *p_undo_redo) { undo_redo = p_undo_redo; }
void edit(AnimationPlayer *p_player);
- void forward_canvas_force_draw_over_viewport(Control *p_overlay);
+ void forward_force_draw_over_viewport(Control *p_overlay);
AnimationPlayerEditor(EditorNode *p_editor, AnimationPlayerEditorPlugin *p_plugin);
};
@@ -262,7 +262,8 @@ public:
virtual bool handles(Object *p_object) const override;
virtual void make_visible(bool p_visible) override;
- virtual void forward_canvas_force_draw_over_viewport(Control *p_overlay) override { anim_editor->forward_canvas_force_draw_over_viewport(p_overlay); }
+ virtual void forward_canvas_force_draw_over_viewport(Control *p_overlay) override { anim_editor->forward_force_draw_over_viewport(p_overlay); }
+ virtual void forward_spatial_force_draw_over_viewport(Control *p_overlay) override { anim_editor->forward_force_draw_over_viewport(p_overlay); }
AnimationPlayerEditorPlugin(EditorNode *p_node);
~AnimationPlayerEditorPlugin();
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index 291cafab2b..be5d756444 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -1831,6 +1831,8 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
motion = Vector3(scale, scale, scale);
}
+ motion /= click.distance_to(_edit.center);
+
// Disable local transformation for TRANSFORM_VIEW
bool local_coords = (spatial_editor->are_local_coords_enabled() && _edit.plane != TRANSFORM_VIEW);
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index 05cf3791f4..81554c9550 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -2051,6 +2051,10 @@ void ProjectManager::_open_selected_projects() {
args.push_back("--disable-crash-handler");
}
+ if (OS::get_singleton()->is_single_window()) {
+ args.push_back("--single-window");
+ }
+
String exec = OS::get_singleton()->get_executable_path();
Error err = OS::get_singleton()->create_process(exec, args);
ERR_FAIL_COND(err);