summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/debugger/editor_network_profiler.cpp8
-rw-r--r--editor/editor_audio_buses.cpp6
-rw-r--r--editor/editor_help.cpp8
-rw-r--r--editor/editor_node.cpp34
-rw-r--r--editor/editor_plugin_settings.cpp66
-rw-r--r--editor/editor_plugin_settings.h2
-rw-r--r--editor/editor_settings.cpp4
-rw-r--r--editor/editor_themes.cpp144
-rw-r--r--editor/import/resource_importer_scene.cpp12
-rw-r--r--editor/import/resource_importer_scene.h2
-rw-r--r--editor/import/scene_importer_mesh.cpp102
-rw-r--r--editor/import/scene_importer_mesh.h5
-rw-r--r--editor/plugins/animation_blend_tree_editor_plugin.cpp5
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp8
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp22
-rw-r--r--editor/plugins/node_3d_editor_plugin.h5
-rw-r--r--editor/plugins/script_text_editor.cpp2
-rw-r--r--editor/plugins/shader_editor_plugin.cpp2
-rw-r--r--editor/plugins/skeleton_3d_editor_plugin.cpp4
-rw-r--r--editor/plugins/text_editor.cpp2
-rw-r--r--editor/plugins/texture_3d_editor_plugin.cpp3
-rw-r--r--editor/plugins/texture_layered_editor_plugin.cpp3
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp60
-rw-r--r--editor/project_export.cpp6
24 files changed, 371 insertions, 144 deletions
diff --git a/editor/debugger/editor_network_profiler.cpp b/editor/debugger/editor_network_profiler.cpp
index d541fdd249..2d57dff69d 100644
--- a/editor/debugger/editor_network_profiler.cpp
+++ b/editor/debugger/editor_network_profiler.cpp
@@ -46,8 +46,8 @@ void EditorNetworkProfiler::_notification(int p_what) {
outgoing_bandwidth_text->set_right_icon(get_theme_icon("ArrowUp", "EditorIcons"));
// This needs to be done here to set the faded color when the profiler is first opened
- incoming_bandwidth_text->add_theme_color_override("font_color_uneditable", get_theme_color("font_color", "Editor") * Color(1, 1, 1, 0.5));
- outgoing_bandwidth_text->add_theme_color_override("font_color_uneditable", get_theme_color("font_color", "Editor") * Color(1, 1, 1, 0.5));
+ incoming_bandwidth_text->add_theme_color_override("font_uneditable_color", get_theme_color("font_color", "Editor") * Color(1, 1, 1, 0.5));
+ outgoing_bandwidth_text->add_theme_color_override("font_uneditable_color", get_theme_color("font_color", "Editor") * Color(1, 1, 1, 0.5));
}
}
@@ -113,10 +113,10 @@ void EditorNetworkProfiler::set_bandwidth(int p_incoming, int p_outgoing) {
// Make labels more prominent when the bandwidth is greater than 0 to attract user attention
incoming_bandwidth_text->add_theme_color_override(
- "font_color_uneditable",
+ "font_uneditable_color",
get_theme_color("font_color", "Editor") * Color(1, 1, 1, p_incoming > 0 ? 1 : 0.5));
outgoing_bandwidth_text->add_theme_color_override(
- "font_color_uneditable",
+ "font_uneditable_color",
get_theme_color("font_color", "Editor") * Color(1, 1, 1, p_outgoing > 0 ? 1 : 0.5));
}
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index 7569800a7e..2eef4636d6 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -78,11 +78,11 @@ void EditorAudioBus::_notification(int p_what) {
Color bypass_color = EditorSettings::get_singleton()->is_dark_theme() ? Color(0.13, 0.8, 1.0) : Color(0.44, 0.87, 1.0);
solo->set_icon(get_theme_icon("AudioBusSolo", "EditorIcons"));
- solo->add_theme_color_override("icon_color_pressed", solo_color);
+ solo->add_theme_color_override("icon_pressed_color", solo_color);
mute->set_icon(get_theme_icon("AudioBusMute", "EditorIcons"));
- mute->add_theme_color_override("icon_color_pressed", mute_color);
+ mute->add_theme_color_override("icon_pressed_color", mute_color);
bypass->set_icon(get_theme_icon("AudioBusBypass", "EditorIcons"));
- bypass->add_theme_color_override("icon_color_pressed", bypass_color);
+ bypass->add_theme_color_override("icon_pressed_color", bypass_color);
bus_options->set_icon(get_theme_icon("GuiTabMenuHl", "EditorIcons"));
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 135c40a851..283713cd3c 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -1331,11 +1331,11 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) {
Ref<Font> doc_code_font = p_rt->get_theme_font("doc_source", "EditorFonts");
Ref<Font> doc_kbd_font = p_rt->get_theme_font("doc_keyboard", "EditorFonts");
- Color font_color_hl = p_rt->get_theme_color("headline_color", "EditorHelp");
+ Color headline_color = p_rt->get_theme_color("headline_color", "EditorHelp");
Color accent_color = p_rt->get_theme_color("accent_color", "Editor");
Color property_color = p_rt->get_theme_color("property_color", "Editor");
- Color link_color = accent_color.lerp(font_color_hl, 0.8);
- Color code_color = accent_color.lerp(font_color_hl, 0.6);
+ Color link_color = accent_color.lerp(headline_color, 0.8);
+ Color code_color = accent_color.lerp(headline_color, 0.6);
Color kbd_color = accent_color.lerp(property_color, 0.6);
String bbcode = p_bbcode.dedent().replace("\t", "").replace("\r", "").strip_edges();
@@ -1481,7 +1481,7 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) {
tag_stack.push_front(tag);
} else if (tag == "i") {
//use italics font
- p_rt->push_color(font_color_hl);
+ p_rt->push_color(headline_color);
pos = brk_end + 1;
tag_stack.push_front(tag);
} else if (tag == "code" || tag == "codeblock") {
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index f5260f773d..2cef6a6ede 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -498,6 +498,11 @@ void EditorNode::_notification(int p_what) {
float sss_scale = GLOBAL_GET("rendering/quality/subsurface_scattering/subsurface_scattering_scale");
float sss_depth_scale = GLOBAL_GET("rendering/quality/subsurface_scattering/subsurface_scattering_depth_scale");
RS::get_singleton()->sub_surface_scattering_set_scale(sss_scale, sss_depth_scale);
+
+ uint32_t directional_shadow_size = GLOBAL_GET("rendering/quality/directional_shadow/size");
+ uint32_t directional_shadow_16_bits = GLOBAL_GET("rendering/quality/directional_shadow/16_bits");
+ RS::get_singleton()->directional_shadow_atlas_set_size(directional_shadow_size, directional_shadow_16_bits);
+
RS::ShadowQuality shadows_quality = RS::ShadowQuality(int(GLOBAL_GET("rendering/quality/shadows/soft_shadow_quality")));
RS::get_singleton()->shadows_quality_set(shadows_quality);
RS::ShadowQuality directional_shadow_quality = RS::ShadowQuality(int(GLOBAL_GET("rendering/quality/directional_shadow/soft_shadow_quality")));
@@ -516,6 +521,9 @@ void EditorNode::_notification(int p_what) {
RS::get_singleton()->environment_set_volumetric_fog_positional_shadow_shrink_size(GLOBAL_GET("rendering/volumetric_fog/positional_shadow_shrink"));
RS::get_singleton()->canvas_set_shadow_texture_size(GLOBAL_GET("rendering/quality/2d_shadow_atlas/size"));
+ bool use_half_res_gi = GLOBAL_DEF("rendering/quality/gi/use_half_resolution", false);
+ RS::get_singleton()->gi_set_use_half_resolution(use_half_res_gi);
+
bool snap_2d_transforms = GLOBAL_GET("rendering/quality/2d/snap_2d_transforms_to_pixel");
scene_root->set_snap_2d_transforms_to_pixel(snap_2d_transforms);
bool snap_2d_vertices = GLOBAL_GET("rendering/quality/2d/snap_2d_vertices_to_pixel");
@@ -613,8 +621,8 @@ void EditorNode::_notification(int p_what) {
gui_base->add_theme_style_override("panel", gui_base->get_theme_stylebox("Background", "EditorStyles"));
scene_root_parent->add_theme_style_override("panel", gui_base->get_theme_stylebox("Content", "EditorStyles"));
bottom_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox("panel", "TabContainer"));
- scene_tabs->add_theme_style_override("tab_fg", gui_base->get_theme_stylebox("SceneTabFG", "EditorStyles"));
- scene_tabs->add_theme_style_override("tab_bg", gui_base->get_theme_stylebox("SceneTabBG", "EditorStyles"));
+ scene_tabs->add_theme_style_override("tab_selected", gui_base->get_theme_stylebox("SceneTabFG", "EditorStyles"));
+ scene_tabs->add_theme_style_override("tab_unselected", gui_base->get_theme_stylebox("SceneTabBG", "EditorStyles"));
file_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox("MenuHover", "EditorStyles"));
project_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox("MenuHover", "EditorStyles"));
@@ -2292,6 +2300,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
case FILE_CLOSE: {
if (!p_confirmed) {
tab_closing = p_option == FILE_CLOSE ? editor_data.get_edited_scene() : _next_unsaved_scene(false);
+ _scene_tab_changed(tab_closing);
if (unsaved_cache || p_option == FILE_CLOSE_ALL_AND_QUIT || p_option == FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER) {
String scene_filename = editor_data.get_edited_scene_root(tab_closing)->get_filename();
@@ -2813,6 +2822,10 @@ void EditorNode::_discard_changes(const String &p_str) {
_update_scene_tabs();
if (current_option == FILE_CLOSE_ALL_AND_QUIT || current_option == FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER) {
+ // If restore tabs is enabled, reopen the scene that has just been closed, so it's remembered properly.
+ if (bool(EDITOR_GET("interface/scene_tabs/restore_scenes_on_load"))) {
+ _menu_option_confirm(FILE_OPEN_PREV, true);
+ }
if (_next_unsaved_scene(false) == -1) {
current_option = current_option == FILE_CLOSE_ALL_AND_QUIT ? FILE_QUIT : RUN_PROJECT_MANAGER;
_discard_changes();
@@ -3026,8 +3039,7 @@ void EditorNode::set_addon_plugin_enabled(const String &p_addon, bool p_enabled,
Ref<ConfigFile> cf;
cf.instance();
- String addon_path = String("res://addons").plus_file(p_addon).plus_file("plugin.cfg");
- if (!DirAccess::exists(addon_path.get_base_dir())) {
+ if (!DirAccess::exists(p_addon.get_base_dir())) {
ProjectSettings *ps = ProjectSettings::get_singleton();
PackedStringArray enabled_plugins = ps->get("editor_plugins/enabled");
for (int i = 0; i < enabled_plugins.size(); ++i) {
@@ -3041,14 +3053,14 @@ void EditorNode::set_addon_plugin_enabled(const String &p_addon, bool p_enabled,
WARN_PRINT("Addon '" + p_addon + "' failed to load. No directory found. Removing from enabled plugins.");
return;
}
- Error err = cf->load(addon_path);
+ Error err = cf->load(p_addon);
if (err != OK) {
- show_warning(vformat(TTR("Unable to enable addon plugin at: '%s' parsing of config failed."), addon_path));
+ show_warning(vformat(TTR("Unable to enable addon plugin at: '%s' parsing of config failed."), p_addon));
return;
}
if (!cf->has_section_key("plugin", "script")) {
- show_warning(vformat(TTR("Unable to find script field for addon plugin at: 'res://addons/%s'."), p_addon));
+ show_warning(vformat(TTR("Unable to find script field for addon plugin at: '%s'."), p_addon));
return;
}
@@ -3057,7 +3069,7 @@ void EditorNode::set_addon_plugin_enabled(const String &p_addon, bool p_enabled,
// Only try to load the script if it has a name. Else, the plugin has no init script.
if (script_path.length() > 0) {
- script_path = String("res://addons").plus_file(p_addon).plus_file(script_path);
+ script_path = p_addon.get_base_dir().plus_file(script_path);
script = ResourceLoader::load(script_path);
if (script.is_null()) {
@@ -5963,8 +5975,8 @@ EditorNode::EditorNode() {
tab_preview_panel->add_child(tab_preview);
scene_tabs = memnew(Tabs);
- scene_tabs->add_theme_style_override("tab_fg", gui_base->get_theme_stylebox("SceneTabFG", "EditorStyles"));
- scene_tabs->add_theme_style_override("tab_bg", gui_base->get_theme_stylebox("SceneTabBG", "EditorStyles"));
+ scene_tabs->add_theme_style_override("tab_selected", gui_base->get_theme_stylebox("SceneTabFG", "EditorStyles"));
+ scene_tabs->add_theme_style_override("tab_unselected", gui_base->get_theme_stylebox("SceneTabBG", "EditorStyles"));
scene_tabs->set_select_with_rmb(true);
scene_tabs->add_tab("unsaved");
scene_tabs->set_tab_align(Tabs::ALIGN_LEFT);
@@ -6007,7 +6019,7 @@ EditorNode::EditorNode() {
tabbar_container->add_child(distraction_free);
scene_tab_add->set_tooltip(TTR("Add a new scene."));
scene_tab_add->set_icon(gui_base->get_theme_icon("Add", "EditorIcons"));
- scene_tab_add->add_theme_color_override("icon_color_normal", Color(0.6f, 0.6f, 0.6f, 0.8f));
+ scene_tab_add->add_theme_color_override("icon_normal_color", Color(0.6f, 0.6f, 0.6f, 0.8f));
scene_tab_add->connect("pressed", callable_mp(this, &EditorNode::_menu_option), make_binds(FILE_NEW_SCENE));
scene_root_parent = memnew(PanelContainer);
diff --git a/editor/editor_plugin_settings.cpp b/editor/editor_plugin_settings.cpp
index aa3b75097e..e5b62513ff 100644
--- a/editor/editor_plugin_settings.cpp
+++ b/editor/editor_plugin_settings.cpp
@@ -49,44 +49,16 @@ void EditorPluginSettings::_notification(int p_what) {
void EditorPluginSettings::update_plugins() {
plugin_list->clear();
-
- DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
- Error err = da->change_dir("res://addons");
- if (err != OK) {
- memdelete(da);
- return;
- }
-
updating = true;
-
TreeItem *root = plugin_list->create_item();
- da->list_dir_begin();
-
- String d = da->get_next();
-
- Vector<String> plugins;
-
- while (d != String()) {
- bool dir = da->current_is_dir();
- String path = "res://addons/" + d + "/plugin.cfg";
-
- if (dir && FileAccess::exists(path)) {
- plugins.push_back(d);
- }
-
- d = da->get_next();
- }
-
- da->list_dir_end();
- memdelete(da);
-
+ Vector<String> plugins = _get_plugins("res://addons");
plugins.sort();
for (int i = 0; i < plugins.size(); i++) {
Ref<ConfigFile> cf;
cf.instance();
- String path = "res://addons/" + plugins[i] + "/plugin.cfg";
+ const String path = plugins[i];
Error err2 = cf->load(path);
@@ -117,7 +89,6 @@ void EditorPluginSettings::update_plugins() {
}
if (!key_missing) {
- String d2 = plugins[i];
String name = cf->get_value("plugin", "name");
String author = cf->get_value("plugin", "author");
String version = cf->get_value("plugin", "version");
@@ -127,14 +98,14 @@ void EditorPluginSettings::update_plugins() {
TreeItem *item = plugin_list->create_item(root);
item->set_text(0, name);
item->set_tooltip(0, TTR("Name:") + " " + name + "\n" + TTR("Path:") + " " + path + "\n" + TTR("Main Script:") + " " + script + "\n" + TTR("Description:") + " " + description);
- item->set_metadata(0, d2);
+ item->set_metadata(0, path);
item->set_text(1, version);
item->set_metadata(1, script);
item->set_text(2, author);
item->set_metadata(2, description);
item->set_cell_mode(3, TreeItem::CELL_MODE_CHECK);
item->set_text(3, TTR("Enable"));
- bool is_active = EditorNode::get_singleton()->is_addon_plugin_enabled(d2);
+ bool is_active = EditorNode::get_singleton()->is_addon_plugin_enabled(path);
item->set_checked(3, is_active);
item->set_editable(3, true);
item->add_button(4, get_theme_icon("Edit", "EditorIcons"), BUTTON_PLUGIN_EDIT, false, TTR("Edit Plugin"));
@@ -179,12 +150,39 @@ void EditorPluginSettings::_cell_button_pressed(Object *p_item, int p_column, in
if (p_id == BUTTON_PLUGIN_EDIT) {
if (p_column == 4) {
String dir = item->get_metadata(0);
- plugin_config_dialog->config("res://addons/" + dir + "/plugin.cfg");
+ plugin_config_dialog->config(dir);
plugin_config_dialog->popup_centered();
}
}
}
+Vector<String> EditorPluginSettings::_get_plugins(const String &p_dir) {
+ DirAccessRef da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
+ Error err = da->change_dir(p_dir);
+ if (err != OK) {
+ return Vector<String>();
+ }
+
+ Vector<String> plugins;
+ da->list_dir_begin();
+ for (String path = da->get_next(); path != String(); path = da->get_next()) {
+ if (path[0] == '.' || !da->current_is_dir()) {
+ continue;
+ }
+
+ const String full_path = p_dir.plus_file(path);
+ const String plugin_config = full_path.plus_file("plugin.cfg");
+ if (FileAccess::exists(plugin_config)) {
+ plugins.push_back(plugin_config);
+ } else {
+ plugins.append_array(_get_plugins(full_path));
+ }
+ }
+
+ da->list_dir_end();
+ return plugins;
+}
+
void EditorPluginSettings::_bind_methods() {
}
diff --git a/editor/editor_plugin_settings.h b/editor/editor_plugin_settings.h
index 4f2b5293ec..34b26de90e 100644
--- a/editor/editor_plugin_settings.h
+++ b/editor/editor_plugin_settings.h
@@ -54,6 +54,8 @@ class EditorPluginSettings : public VBoxContainer {
void _create_clicked();
void _cell_button_pressed(Object *p_item, int p_column, int p_id);
+ static Vector<String> _get_plugins(const String &p_dir);
+
protected:
void _notification(int p_what);
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 3eee7b2bfb..7a602912c9 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -659,6 +659,10 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("editors/animation/onion_layers_past_color", Color(1, 0, 0));
_initial_set("editors/animation/onion_layers_future_color", Color(0, 1, 0));
+ // Visual editors
+ _initial_set("editors/visual_editors/minimap_opacity", 0.85);
+ hints["editors/visual_editors/minimap_opacity"] = PropertyInfo(Variant::FLOAT, "editors/visual_editors/minimap_opacity", PROPERTY_HINT_RANGE, "0.0,1.0,0.01", PROPERTY_USAGE_DEFAULT);
+
/* Run */
// Window placement
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 054ada1e8d..8f877a4762 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -92,6 +92,7 @@ static Ref<Texture2D> flip_icon(Ref<Texture2D> p_texture, bool p_flip_y = false,
Ref<ImageTexture> texture(memnew(ImageTexture));
Ref<Image> img = p_texture->get_data();
+ img = img->duplicate();
if (p_flip_y) {
img->flip_y();
@@ -375,18 +376,18 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
const Color contrast_color_2 = base_color.lerp(mono_color, MAX(contrast * 1.5, default_contrast * 1.5));
const Color font_color = mono_color.lerp(base_color, 0.25);
- const Color font_color_hl = mono_color.lerp(base_color, 0.15);
- const Color font_color_disabled = Color(mono_color.r, mono_color.g, mono_color.b, 0.3);
- const Color font_color_selection = accent_color * Color(1, 1, 1, 0.4);
- const Color color_disabled = mono_color.inverted().lerp(base_color, 0.7);
- const Color color_disabled_bg = mono_color.inverted().lerp(base_color, 0.9);
-
- Color icon_color_hover = Color(1, 1, 1) * (dark_theme ? 1.15 : 1.45);
- icon_color_hover.a = 1.0;
+ const Color font_hover_color = mono_color.lerp(base_color, 0.15);
+ const Color font_disabled_color = Color(mono_color.r, mono_color.g, mono_color.b, 0.3);
+ const Color selection_color = accent_color * Color(1, 1, 1, 0.4);
+ const Color disabled_color = mono_color.inverted().lerp(base_color, 0.7);
+ const Color disabled_bg_color = mono_color.inverted().lerp(base_color, 0.9);
+
+ Color icon_hover_color = Color(1, 1, 1) * (dark_theme ? 1.15 : 1.45);
+ icon_hover_color.a = 1.0;
// Make the pressed icon color overbright because icons are not completely white on a dark theme.
// On a light theme, icons are dark, so we need to modulate them with an even brighter color.
- Color icon_color_pressed = accent_color * (dark_theme ? 1.15 : 3.5);
- icon_color_pressed.a = 1.0;
+ Color icon_pressed_color = accent_color * (dark_theme ? 1.15 : 3.5);
+ icon_pressed_color.a = 1.0;
const Color separator_color = Color(mono_color.r, mono_color.g, mono_color.b, 0.1);
@@ -408,8 +409,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_color("axis_z_color", "Editor", Color(0.16, 0.55, 0.96));
theme->set_color("font_color", "Editor", font_color);
- theme->set_color("highlighted_font_color", "Editor", font_color_hl);
- theme->set_color("disabled_font_color", "Editor", font_color_disabled);
+ theme->set_color("highlighted_font_color", "Editor", font_hover_color);
+ theme->set_color("disabled_font_color", "Editor", font_disabled_color);
theme->set_color("mono_color", "Editor", mono_color);
@@ -485,8 +486,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
style_widget->set_border_color(dark_color_2);
Ref<StyleBoxFlat> style_widget_disabled = style_widget->duplicate();
- style_widget_disabled->set_border_color(color_disabled);
- style_widget_disabled->set_bg_color(color_disabled_bg);
+ style_widget_disabled->set_border_color(disabled_color);
+ style_widget_disabled->set_bg_color(disabled_bg_color);
Ref<StyleBoxFlat> style_widget_focus = style_widget->duplicate();
style_widget_focus->set_border_color(accent_color);
@@ -550,8 +551,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
style_tab_unselected->set_border_color(dark_color_2);
Ref<StyleBoxFlat> style_tab_disabled = style_tab_selected->duplicate();
- style_tab_disabled->set_bg_color(color_disabled_bg);
- style_tab_disabled->set_border_color(color_disabled);
+ style_tab_disabled->set_bg_color(disabled_bg_color);
+ style_tab_disabled->set_border_color(disabled_color);
// Editor background
theme->set_stylebox("Background", "EditorStyles", make_flat_stylebox(background_color, default_margin_size, default_margin_size, default_margin_size, default_margin_size));
@@ -600,7 +601,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("disabled", "PopupMenu", style_menu);
theme->set_color("font_color", "MenuButton", font_color);
- theme->set_color("font_color_hover", "MenuButton", font_color_hl);
+ theme->set_color("font_hover_color", "MenuButton", font_hover_color);
theme->set_stylebox("MenuHover", "EditorStyles", style_menu_hover_border);
@@ -612,11 +613,11 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("disabled", "Button", style_widget_disabled);
theme->set_color("font_color", "Button", font_color);
- theme->set_color("font_color_hover", "Button", font_color_hl);
- theme->set_color("font_color_pressed", "Button", accent_color);
- theme->set_color("font_color_disabled", "Button", font_color_disabled);
- theme->set_color("icon_color_hover", "Button", icon_color_hover);
- theme->set_color("icon_color_pressed", "Button", icon_color_pressed);
+ theme->set_color("font_hover_color", "Button", font_hover_color);
+ theme->set_color("font_pressed_color", "Button", accent_color);
+ theme->set_color("font_disabled_color", "Button", font_disabled_color);
+ theme->set_color("icon_hover_color", "Button", icon_hover_color);
+ theme->set_color("icon_pressed_color", "Button", icon_pressed_color);
// OptionButton
theme->set_stylebox("focus", "OptionButton", style_widget_focus);
@@ -632,10 +633,10 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("disabled_mirrored", "OptionButton", style_widget_disabled);
theme->set_color("font_color", "OptionButton", font_color);
- theme->set_color("font_color_hover", "OptionButton", font_color_hl);
- theme->set_color("font_color_pressed", "OptionButton", accent_color);
- theme->set_color("font_color_disabled", "OptionButton", font_color_disabled);
- theme->set_color("icon_color_hover", "OptionButton", icon_color_hover);
+ theme->set_color("font_hover_color", "OptionButton", font_hover_color);
+ theme->set_color("font_pressed_color", "OptionButton", accent_color);
+ theme->set_color("font_disabled_color", "OptionButton", font_disabled_color);
+ theme->set_color("icon_hover_color", "OptionButton", icon_hover_color);
theme->set_icon("arrow", "OptionButton", theme->get_icon("GuiOptionArrow", "EditorIcons"));
theme->set_constant("arrow_margin", "OptionButton", default_margin_size * EDSCALE);
theme->set_constant("modulate_arrow", "OptionButton", true);
@@ -658,10 +659,10 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_icon("off_disabled_mirrored", "CheckButton", theme->get_icon("GuiToggleOffDisabledMirrored", "EditorIcons"));
theme->set_color("font_color", "CheckButton", font_color);
- theme->set_color("font_color_hover", "CheckButton", font_color_hl);
- theme->set_color("font_color_pressed", "CheckButton", accent_color);
- theme->set_color("font_color_disabled", "CheckButton", font_color_disabled);
- theme->set_color("icon_color_hover", "CheckButton", icon_color_hover);
+ theme->set_color("font_hover_color", "CheckButton", font_hover_color);
+ theme->set_color("font_pressed_color", "CheckButton", accent_color);
+ theme->set_color("font_disabled_color", "CheckButton", font_disabled_color);
+ theme->set_color("icon_hover_color", "CheckButton", icon_hover_color);
theme->set_constant("hseparation", "CheckButton", 4 * EDSCALE);
theme->set_constant("check_vadjust", "CheckButton", 0 * EDSCALE);
@@ -683,10 +684,10 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_icon("radio_unchecked", "CheckBox", theme->get_icon("GuiRadioUnchecked", "EditorIcons"));
theme->set_color("font_color", "CheckBox", font_color);
- theme->set_color("font_color_hover", "CheckBox", font_color_hl);
- theme->set_color("font_color_pressed", "CheckBox", accent_color);
- theme->set_color("font_color_disabled", "CheckBox", font_color_disabled);
- theme->set_color("icon_color_hover", "CheckBox", icon_color_hover);
+ theme->set_color("font_hover_color", "CheckBox", font_hover_color);
+ theme->set_color("font_pressed_color", "CheckBox", accent_color);
+ theme->set_color("font_disabled_color", "CheckBox", font_disabled_color);
+ theme->set_color("icon_hover_color", "CheckBox", icon_hover_color);
theme->set_constant("hseparation", "CheckBox", 4 * EDSCALE);
theme->set_constant("check_vadjust", "CheckBox", 0 * EDSCALE);
@@ -708,10 +709,10 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("labeled_separator_right", "PopupMenu", style_popup_labeled_separator_right);
theme->set_color("font_color", "PopupMenu", font_color);
- theme->set_color("font_color_hover", "PopupMenu", font_color_hl);
- theme->set_color("font_color_accel", "PopupMenu", font_color_disabled);
- theme->set_color("font_color_disabled", "PopupMenu", font_color_disabled);
- theme->set_color("font_color_separator", "PopupMenu", font_color_disabled);
+ theme->set_color("font_hover_color", "PopupMenu", font_hover_color);
+ theme->set_color("font_accelerator_color", "PopupMenu", font_disabled_color);
+ theme->set_color("font_disabled_color", "PopupMenu", font_disabled_color);
+ theme->set_color("font_separator_color", "PopupMenu", font_disabled_color);
theme->set_icon("checked", "PopupMenu", theme->get_icon("GuiChecked", "EditorIcons"));
theme->set_icon("unchecked", "PopupMenu", theme->get_icon("GuiUnchecked", "EditorIcons"));
theme->set_icon("radio_checked", "PopupMenu", theme->get_icon("GuiRadioChecked", "EditorIcons"));
@@ -753,9 +754,9 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("custom_button", "Tree", make_empty_stylebox());
theme->set_stylebox("custom_button_pressed", "Tree", make_empty_stylebox());
theme->set_stylebox("custom_button_hover", "Tree", style_widget);
- theme->set_color("custom_button_font_highlight", "Tree", font_color_hl);
+ theme->set_color("custom_button_font_highlight", "Tree", font_hover_color);
theme->set_color("font_color", "Tree", font_color);
- theme->set_color("font_color_selected", "Tree", mono_color);
+ theme->set_color("font_selected_color", "Tree", mono_color);
theme->set_color("title_button_color", "Tree", font_color);
theme->set_color("guide_color", "Tree", guide_color);
theme->set_color("relationship_line_color", "Tree", relationship_line_color);
@@ -826,7 +827,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("bg_focus", "ItemList", style_focus);
theme->set_stylebox("bg", "ItemList", style_itemlist_bg);
theme->set_color("font_color", "ItemList", font_color);
- theme->set_color("font_color_selected", "ItemList", mono_color);
+ theme->set_color("font_selected_color", "ItemList", mono_color);
theme->set_color("guide_color", "ItemList", guide_color);
theme->set_constant("vseparation", "ItemList", 3 * EDSCALE);
theme->set_constant("hseparation", "ItemList", 3 * EDSCALE);
@@ -834,16 +835,16 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_constant("line_separation", "ItemList", 3 * EDSCALE);
// Tabs & TabContainer
- theme->set_stylebox("tab_fg", "TabContainer", style_tab_selected);
- theme->set_stylebox("tab_bg", "TabContainer", style_tab_unselected);
+ theme->set_stylebox("tab_selected", "TabContainer", style_tab_selected);
+ theme->set_stylebox("tab_unselected", "TabContainer", style_tab_unselected);
theme->set_stylebox("tab_disabled", "TabContainer", style_tab_disabled);
- theme->set_stylebox("tab_fg", "Tabs", style_tab_selected);
- theme->set_stylebox("tab_bg", "Tabs", style_tab_unselected);
+ theme->set_stylebox("tab_selected", "Tabs", style_tab_selected);
+ theme->set_stylebox("tab_unselected", "Tabs", style_tab_unselected);
theme->set_stylebox("tab_disabled", "Tabs", style_tab_disabled);
- theme->set_color("font_color_fg", "TabContainer", font_color);
- theme->set_color("font_color_bg", "TabContainer", font_color_disabled);
- theme->set_color("font_color_fg", "Tabs", font_color);
- theme->set_color("font_color_bg", "Tabs", font_color_disabled);
+ theme->set_color("font_selected_color", "TabContainer", font_color);
+ theme->set_color("font_unselected_color", "TabContainer", font_disabled_color);
+ theme->set_color("font_selected_color", "Tabs", font_color);
+ theme->set_color("font_unselected_color", "Tabs", font_disabled_color);
theme->set_icon("menu", "TabContainer", theme->get_icon("GuiTabMenu", "EditorIcons"));
theme->set_icon("menu_highlight", "TabContainer", theme->get_icon("GuiTabMenuHl", "EditorIcons"));
theme->set_stylebox("SceneTabFG", "EditorStyles", style_tab_selected);
@@ -891,7 +892,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("DebuggerPanel", "EditorStyles", style_panel_debugger);
Ref<StyleBoxFlat> style_panel_invisible_top = style_content_panel->duplicate();
- int stylebox_offset = theme->get_font("tab_fg", "TabContainer")->get_height(theme->get_font_size("tab_fg", "TabContainer")) + theme->get_stylebox("tab_fg", "TabContainer")->get_minimum_size().height + theme->get_stylebox("panel", "TabContainer")->get_default_margin(SIDE_TOP);
+ int stylebox_offset = theme->get_font("tab_selected", "TabContainer")->get_height(theme->get_font_size("tab_selected", "TabContainer")) + theme->get_stylebox("tab_selected", "TabContainer")->get_minimum_size().height + theme->get_stylebox("panel", "TabContainer")->get_default_margin(SIDE_TOP);
style_panel_invisible_top->set_expand_margin_size(SIDE_TOP, -stylebox_offset);
style_panel_invisible_top->set_default_margin(SIDE_TOP, 0);
theme->set_stylebox("BottomPanelDebuggerOverride", "EditorStyles", style_panel_invisible_top);
@@ -901,11 +902,11 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("focus", "LineEdit", style_widget_focus);
theme->set_stylebox("read_only", "LineEdit", style_widget_disabled);
theme->set_icon("clear", "LineEdit", theme->get_icon("GuiClose", "EditorIcons"));
- theme->set_color("read_only", "LineEdit", font_color_disabled);
+ theme->set_color("read_only", "LineEdit", font_disabled_color);
theme->set_color("font_color", "LineEdit", font_color);
- theme->set_color("font_color_selected", "LineEdit", mono_color);
+ theme->set_color("font_selected_color", "LineEdit", mono_color);
theme->set_color("cursor_color", "LineEdit", font_color);
- theme->set_color("selection_color", "LineEdit", font_color_selection);
+ theme->set_color("selection_color", "LineEdit", selection_color);
theme->set_color("clear_button_color", "LineEdit", font_color);
theme->set_color("clear_button_color_pressed", "LineEdit", accent_color);
@@ -918,7 +919,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_icon("space", "TextEdit", theme->get_icon("GuiSpace", "EditorIcons"));
theme->set_color("font_color", "TextEdit", font_color);
theme->set_color("caret_color", "TextEdit", font_color);
- theme->set_color("selection_color", "TextEdit", font_color_selection);
+ theme->set_color("selection_color", "TextEdit", selection_color);
// CodeEdit
theme->set_stylebox("normal", "CodeEdit", style_widget);
@@ -932,7 +933,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_icon("executing_line", "CodeEdit", theme->get_icon("MainPlay", "EditorIcons"));
theme->set_color("font_color", "CodeEdit", font_color);
theme->set_color("caret_color", "CodeEdit", font_color);
- theme->set_color("selection_color", "CodeEdit", font_color_selection);
+ theme->set_color("selection_color", "CodeEdit", selection_color);
// H/VSplitContainer
theme->set_stylebox("bg", "VSplitContainer", make_stylebox(theme->get_icon("GuiVsplitBg", "EditorIcons"), 1, 1, 1, 1));
@@ -1023,7 +1024,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
//RichTextLabel
theme->set_color("default_color", "RichTextLabel", font_color);
- theme->set_color("font_color_shadow", "RichTextLabel", Color(0, 0, 0, 0));
+ theme->set_color("font_shadow_color", "RichTextLabel", Color(0, 0, 0, 0));
theme->set_constant("shadow_offset_x", "RichTextLabel", 1 * EDSCALE);
theme->set_constant("shadow_offset_y", "RichTextLabel", 1 * EDSCALE);
theme->set_constant("shadow_as_outline", "RichTextLabel", 0 * EDSCALE);
@@ -1039,7 +1040,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// Label
theme->set_stylebox("normal", "Label", style_empty);
theme->set_color("font_color", "Label", font_color);
- theme->set_color("font_color_shadow", "Label", Color(0, 0, 0, 0));
+ theme->set_color("font_shadow_color", "Label", Color(0, 0, 0, 0));
theme->set_constant("shadow_offset_x", "Label", 1 * EDSCALE);
theme->set_constant("shadow_offset_y", "Label", 1 * EDSCALE);
theme->set_constant("shadow_as_outline", "Label", 0 * EDSCALE);
@@ -1048,9 +1049,9 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// LinkButton
theme->set_stylebox("focus", "LinkButton", style_empty);
theme->set_color("font_color", "LinkButton", font_color);
- theme->set_color("font_color_hover", "LinkButton", font_color_hl);
- theme->set_color("font_color_pressed", "LinkButton", accent_color);
- theme->set_color("font_color_disabled", "LinkButton", font_color_disabled);
+ theme->set_color("font_hover_color", "LinkButton", font_hover_color);
+ theme->set_color("font_pressed_color", "LinkButton", accent_color);
+ theme->set_color("font_disabled_color", "LinkButton", font_disabled_color);
// TooltipPanel
Ref<StyleBoxFlat> style_tooltip = style_popup->duplicate();
@@ -1063,7 +1064,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
style_tooltip->set_border_width_all(border_width);
style_tooltip->set_border_color(mono_color);
theme->set_color("font_color", "TooltipLabel", font_color.inverted());
- theme->set_color("font_color_shadow", "TooltipLabel", mono_color.inverted() * Color(1, 1, 1, 0.1));
+ theme->set_color("font_shadow_color", "TooltipLabel", mono_color.inverted() * Color(1, 1, 1, 0.1));
theme->set_stylebox("panel", "TooltipPanel", style_tooltip);
// PopupPanel
@@ -1098,7 +1099,11 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_constant("bezier_len_neg", "GraphEdit", 160 * EDSCALE);
// GraphEditMinimap
- theme->set_stylebox("bg", "GraphEditMinimap", make_flat_stylebox(dark_color_1, 0, 0, 0, 0));
+ Ref<StyleBoxFlat> style_minimap_bg = make_flat_stylebox(dark_color_1, 0, 0, 0, 0);
+ style_minimap_bg->set_border_color(dark_color_3);
+ style_minimap_bg->set_border_width_all(1);
+ theme->set_stylebox("bg", "GraphEditMinimap", style_minimap_bg);
+
Ref<StyleBoxFlat> style_minimap_camera;
Ref<StyleBoxFlat> style_minimap_node;
if (dark_theme) {
@@ -1115,9 +1120,15 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("camera", "GraphEditMinimap", style_minimap_camera);
theme->set_stylebox("node", "GraphEditMinimap", style_minimap_node);
- Ref<Texture2D> resizer_icon = theme->get_icon("GuiResizer", "EditorIcons");
- theme->set_icon("resizer", "GraphEditMinimap", flip_icon(resizer_icon, true, true));
- theme->set_color("resizer_color", "GraphEditMinimap", Color(1, 1, 1, 0.65));
+ Ref<Texture2D> minimap_resizer_icon = theme->get_icon("GuiResizer", "EditorIcons");
+ Color minimap_resizer_color;
+ if (dark_theme) {
+ minimap_resizer_color = Color(1, 1, 1, 0.65);
+ } else {
+ minimap_resizer_color = Color(0, 0, 0, 0.65);
+ }
+ theme->set_icon("resizer", "GraphEditMinimap", flip_icon(minimap_resizer_icon, true, true));
+ theme->set_color("resizer_color", "GraphEditMinimap", minimap_resizer_color);
// GraphNode
const float mv = dark_theme ? 0.0 : 1.0;
@@ -1198,7 +1209,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// Use a different color for folder icons to make them easier to distinguish from files.
// On a light theme, the icon will be dark, so we need to lighten it before blending it with the accent color.
theme->set_color("folder_icon_modulate", "FileDialog", (dark_theme ? Color(1, 1, 1) : Color(4.25, 4.25, 4.25)).lerp(accent_color, 0.7));
- theme->set_color("files_disabled", "FileDialog", font_color_disabled);
+ theme->set_color("files_disabled", "FileDialog", font_disabled_color);
// color picker
theme->set_constant("margin", "ColorPicker", popup_margin_size);
@@ -1251,7 +1262,6 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
const Color caret_color = mono_color;
const Color caret_background_color = mono_color.inverted();
const Color text_selected_color = dark_color_3;
- const Color selection_color = accent_color * Color(1, 1, 1, 0.35);
const Color brace_mismatch_color = error_color;
const Color current_line_color = alpha1;
const Color line_length_guideline_color = dark_theme ? base_color : background_color;
diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp
index ead1f7c3e9..9944712931 100644
--- a/editor/import/resource_importer_scene.cpp
+++ b/editor/import/resource_importer_scene.cpp
@@ -1129,6 +1129,7 @@ void ResourceImporterScene::get_import_options(List<ImportOption> *r_options, in
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "meshes/ensure_tangents"), true));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "meshes/storage", PROPERTY_HINT_ENUM, "Built-In,Files (.mesh),Files (.tres)"), meshes_out ? 1 : 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "meshes/generate_lods"), true));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "meshes/create_shadow_meshes"), true));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "meshes/light_baking", PROPERTY_HINT_ENUM, "Disabled,Enable,Gen Lightmaps", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::FLOAT, "meshes/lightmap_texel_size", PROPERTY_HINT_RANGE, "0.001,100,0.001"), 0.1));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "skins/use_named_skins"), true));
@@ -1221,7 +1222,7 @@ Ref<Animation> ResourceImporterScene::import_animation_from_other_importer(Edito
return importer->import_animation(p_path, p_flags, p_bake_fps);
}
-void ResourceImporterScene::_generate_meshes(Node *p_node, bool p_generate_lods) {
+void ResourceImporterScene::_generate_meshes(Node *p_node, bool p_generate_lods, bool p_create_shadow_meshes) {
EditorSceneImporterMeshNode3D *src_mesh_node = Object::cast_to<EditorSceneImporterMeshNode3D>(p_node);
if (src_mesh_node) {
//is mesh
@@ -1237,8 +1238,12 @@ void ResourceImporterScene::_generate_meshes(Node *p_node, bool p_generate_lods)
if (p_generate_lods) {
src_mesh_node->get_mesh()->generate_lods();
}
+ if (p_create_shadow_meshes) {
+ src_mesh_node->get_mesh()->create_shadow_mesh();
+ }
}
mesh = src_mesh_node->get_mesh()->get_mesh();
+
if (mesh.is_valid()) {
mesh_node->set_mesh(mesh);
for (int i = 0; i < mesh->get_surface_count(); i++) {
@@ -1252,7 +1257,7 @@ void ResourceImporterScene::_generate_meshes(Node *p_node, bool p_generate_lods)
}
for (int i = 0; i < p_node->get_child_count(); i++) {
- _generate_meshes(p_node->get_child(i), p_generate_lods);
+ _generate_meshes(p_node->get_child(i), p_generate_lods, p_create_shadow_meshes);
}
}
Error ResourceImporterScene::import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files, Variant *r_metadata) {
@@ -1348,8 +1353,9 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
}
bool gen_lods = bool(p_options["meshes/generate_lods"]);
+ bool create_shadow_meshes = bool(p_options["meshes/create_shadow_meshes"]);
- _generate_meshes(scene, gen_lods);
+ _generate_meshes(scene, gen_lods, create_shadow_meshes);
err = OK;
diff --git a/editor/import/resource_importer_scene.h b/editor/import/resource_importer_scene.h
index 66c317f858..aced0226ff 100644
--- a/editor/import/resource_importer_scene.h
+++ b/editor/import/resource_importer_scene.h
@@ -121,7 +121,7 @@ class ResourceImporterScene : public ResourceImporter {
};
void _replace_owner(Node *p_node, Node *p_scene, Node *p_new_owner);
- void _generate_meshes(Node *p_node, bool p_generate_lods);
+ void _generate_meshes(Node *p_node, bool p_generate_lods, bool p_create_shadow_meshes);
public:
static ResourceImporterScene *get_singleton() { return singleton; }
diff --git a/editor/import/scene_importer_mesh.cpp b/editor/import/scene_importer_mesh.cpp
index 620437af0e..78a7cd84f1 100644
--- a/editor/import/scene_importer_mesh.cpp
+++ b/editor/import/scene_importer_mesh.cpp
@@ -250,6 +250,11 @@ Ref<ArrayMesh> EditorSceneImporterMesh::get_mesh() {
mesh->surface_set_name(mesh->get_surface_count() - 1, surfaces[i].name);
}
}
+
+ if (shadow_mesh.is_valid()) {
+ Ref<ArrayMesh> shadow = shadow_mesh->get_mesh();
+ mesh->set_shadow_mesh(shadow);
+ }
}
return mesh;
@@ -261,6 +266,103 @@ void EditorSceneImporterMesh::clear() {
mesh.unref();
}
+void EditorSceneImporterMesh::create_shadow_mesh() {
+ if (shadow_mesh.is_valid()) {
+ shadow_mesh.unref();
+ }
+
+ //no shadow mesh for blendshapes
+ if (blend_shapes.size() > 0) {
+ return;
+ }
+ //no shadow mesh for skeletons
+ for (int i = 0; i < surfaces.size(); i++) {
+ if (surfaces[i].arrays[RS::ARRAY_BONES].get_type() != Variant::NIL) {
+ return;
+ }
+ if (surfaces[i].arrays[RS::ARRAY_WEIGHTS].get_type() != Variant::NIL) {
+ return;
+ }
+ }
+
+ shadow_mesh.instance();
+
+ for (int i = 0; i < surfaces.size(); i++) {
+ LocalVector<int> vertex_remap;
+ Vector<Vector3> new_vertices;
+ Vector<Vector3> vertices = surfaces[i].arrays[RS::ARRAY_VERTEX];
+ int vertex_count = vertices.size();
+ {
+ Map<Vector3, int> unique_vertices;
+ const Vector3 *vptr = vertices.ptr();
+ for (int j = 0; j < vertex_count; j++) {
+ Vector3 v = vptr[j];
+
+ Map<Vector3, int>::Element *E = unique_vertices.find(v);
+
+ if (E) {
+ vertex_remap.push_back(E->get());
+ } else {
+ int vcount = unique_vertices.size();
+ unique_vertices[v] = vcount;
+ vertex_remap.push_back(vcount);
+ new_vertices.push_back(v);
+ }
+ }
+ }
+
+ Array new_surface;
+ new_surface.resize(RS::ARRAY_MAX);
+ Dictionary lods;
+
+ // print_line("original vertex count: " + itos(vertices.size()) + " new vertex count: " + itos(new_vertices.size()));
+
+ new_surface[RS::ARRAY_VERTEX] = new_vertices;
+
+ Vector<int> indices = surfaces[i].arrays[RS::ARRAY_INDEX];
+ if (indices.size()) {
+ int index_count = indices.size();
+ const int *index_rptr = indices.ptr();
+ Vector<int> new_indices;
+ new_indices.resize(indices.size());
+ int *index_wptr = new_indices.ptrw();
+
+ for (int j = 0; j < index_count; j++) {
+ int index = index_rptr[j];
+ ERR_FAIL_INDEX(index, vertex_count);
+ index_wptr[j] = vertex_remap[index];
+ }
+
+ new_surface[RS::ARRAY_INDEX] = new_indices;
+
+ // Make sure the same LODs as the full version are used.
+ // This makes it more coherent between rendered model and its shadows.
+ for (int j = 0; j < surfaces[i].lods.size(); j++) {
+ indices = surfaces[i].lods[j].indices;
+
+ index_count = indices.size();
+ index_rptr = indices.ptr();
+ new_indices.resize(indices.size());
+ index_wptr = new_indices.ptrw();
+
+ for (int k = 0; k < index_count; k++) {
+ int index = index_rptr[j];
+ ERR_FAIL_INDEX(index, vertex_count);
+ index_wptr[j] = vertex_remap[index];
+ }
+
+ lods[surfaces[i].lods[j].distance] = new_indices;
+ }
+ }
+
+ shadow_mesh->add_surface(surfaces[i].primitive, new_surface, Array(), lods, Ref<Material>(), surfaces[i].name);
+ }
+}
+
+Ref<EditorSceneImporterMesh> EditorSceneImporterMesh::get_shadow_mesh() const {
+ return shadow_mesh;
+}
+
void EditorSceneImporterMesh::_set_data(const Dictionary &p_data) {
clear();
if (p_data.has("blend_shape_names")) {
diff --git a/editor/import/scene_importer_mesh.h b/editor/import/scene_importer_mesh.h
index 2adeb76b6c..42507cbe8c 100644
--- a/editor/import/scene_importer_mesh.h
+++ b/editor/import/scene_importer_mesh.h
@@ -61,6 +61,8 @@ class EditorSceneImporterMesh : public Resource {
Ref<ArrayMesh> mesh;
+ Ref<EditorSceneImporterMesh> shadow_mesh;
+
protected:
void _set_data(const Dictionary &p_data);
Dictionary _get_data() const;
@@ -89,6 +91,9 @@ public:
void generate_lods();
+ void create_shadow_mesh();
+ Ref<EditorSceneImporterMesh> get_shadow_mesh() const;
+
bool has_mesh() const;
Ref<ArrayMesh> get_mesh();
void clear();
diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp
index fbfcac3d22..e7e069e8b6 100644
--- a/editor/plugins/animation_blend_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp
@@ -255,6 +255,9 @@ void AnimationNodeBlendTreeEditor::_update_graph() {
graph->connect_node(from, 0, to, to_idx);
}
+
+ float graph_minimap_opacity = EditorSettings::get_singleton()->get("editors/visual_editors/minimap_opacity");
+ graph->set_minimap_opacity(graph_minimap_opacity);
}
void AnimationNodeBlendTreeEditor::_file_opened(const String &p_file) {
@@ -888,6 +891,8 @@ AnimationNodeBlendTreeEditor::AnimationNodeBlendTreeEditor() {
graph->connect("scroll_offset_changed", callable_mp(this, &AnimationNodeBlendTreeEditor::_scroll_changed));
graph->connect("delete_nodes_request", callable_mp(this, &AnimationNodeBlendTreeEditor::_delete_nodes_request));
graph->connect("popup_request", callable_mp(this, &AnimationNodeBlendTreeEditor::_popup_request));
+ float graph_minimap_opacity = EditorSettings::get_singleton()->get("editors/visual_editors/minimap_opacity");
+ graph->set_minimap_opacity(graph_minimap_opacity);
VSeparator *vs = memnew(VSeparator);
graph->get_zoom_hbox()->add_child(vs);
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 49af478307..63f74b5ca9 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -4163,7 +4163,7 @@ void CanvasItemEditor::_notification(int p_what) {
// the icon will be dark, so we need to lighten it before blending it
// with the red color.
const Color key_auto_color = EditorSettings::get_singleton()->is_dark_theme() ? Color(1, 1, 1) : Color(4.25, 4.25, 4.25);
- key_auto_insert_button->add_theme_color_override("icon_color_pressed", key_auto_color.lerp(Color(1, 0, 0), 0.55));
+ key_auto_insert_button->add_theme_color_override("icon_pressed_color", key_auto_color.lerp(Color(1, 0, 0), 0.55));
animation_menu->set_icon(get_theme_icon("GuiTabMenuHl", "EditorIcons"));
zoom_minus->set_icon(get_theme_icon("ZoomLess", "EditorIcons"));
@@ -5779,7 +5779,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
zoom_reset->set_flat(true);
zoom_hb->add_child(zoom_reset);
zoom_reset->add_theme_constant_override("outline_size", 1);
- zoom_reset->add_theme_color_override("font_outline_modulate", Color(0, 0, 0));
+ zoom_reset->add_theme_color_override("font_outline_color", Color(0, 0, 0));
zoom_reset->add_theme_color_override("font_color", Color(1, 1, 1));
zoom_reset->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_zoom_reset));
zoom_reset->set_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_reset", TTR("Zoom Reset"), KEY_MASK_CMD | KEY_0));
@@ -6613,7 +6613,7 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte
}
label = memnew(Label);
- label->add_theme_color_override("font_color_shadow", Color(0, 0, 0, 1));
+ label->add_theme_color_override("font_shadow_color", Color(0, 0, 0, 1));
label->add_theme_constant_override("shadow_as_outline", 1 * EDSCALE);
label->hide();
canvas_item_editor->get_controls_container()->add_child(label);
@@ -6621,7 +6621,7 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte
label_desc = memnew(Label);
label_desc->set_text(TTR("Drag & drop + Shift : Add node as sibling\nDrag & drop + Alt : Change node type"));
label_desc->add_theme_color_override("font_color", Color(0.6f, 0.6f, 0.6f, 1));
- label_desc->add_theme_color_override("font_color_shadow", Color(0.2f, 0.2f, 0.2f, 1));
+ label_desc->add_theme_color_override("font_shadow_color", Color(0.2f, 0.2f, 0.2f, 1));
label_desc->add_theme_constant_override("shadow_as_outline", 1 * EDSCALE);
label_desc->add_theme_constant_override("line_spacing", 0);
label_desc->hide();
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index eda472cc38..4fb0013620 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -2445,12 +2445,14 @@ void Node3DEditorViewport::_notification(int p_what) {
//update shadow atlas if changed
int shadowmap_size = ProjectSettings::get_singleton()->get("rendering/quality/shadow_atlas/size");
+ bool shadowmap_16_bits = ProjectSettings::get_singleton()->get("rendering/quality/shadow_atlas/16_bits");
int atlas_q0 = ProjectSettings::get_singleton()->get("rendering/quality/shadow_atlas/quadrant_0_subdiv");
int atlas_q1 = ProjectSettings::get_singleton()->get("rendering/quality/shadow_atlas/quadrant_1_subdiv");
int atlas_q2 = ProjectSettings::get_singleton()->get("rendering/quality/shadow_atlas/quadrant_2_subdiv");
int atlas_q3 = ProjectSettings::get_singleton()->get("rendering/quality/shadow_atlas/quadrant_3_subdiv");
viewport->set_shadow_atlas_size(shadowmap_size);
+ viewport->set_shadow_atlas_16_bits(shadowmap_16_bits);
viewport->set_shadow_atlas_quadrant_subdiv(0, Viewport::ShadowAtlasQuadrantSubdiv(atlas_q0));
viewport->set_shadow_atlas_quadrant_subdiv(1, Viewport::ShadowAtlasQuadrantSubdiv(atlas_q1));
viewport->set_shadow_atlas_quadrant_subdiv(2, Viewport::ShadowAtlasQuadrantSubdiv(atlas_q2));
@@ -3043,7 +3045,11 @@ void Node3DEditorViewport::_menu_option(int p_option) {
case VIEW_DISPLAY_DEBUG_SDFGI:
case VIEW_DISPLAY_DEBUG_SDFGI_PROBES:
case VIEW_DISPLAY_DEBUG_GI_BUFFER:
- case VIEW_DISPLAY_DEBUG_DISABLE_LOD: {
+ case VIEW_DISPLAY_DEBUG_DISABLE_LOD:
+ case VIEW_DISPLAY_DEBUG_CLUSTER_OMNI_LIGHTS:
+ case VIEW_DISPLAY_DEBUG_CLUSTER_SPOT_LIGHTS:
+ case VIEW_DISPLAY_DEBUG_CLUSTER_DECALS:
+ case VIEW_DISPLAY_DEBUG_CLUSTER_REFLECTION_PROBES: {
static const int display_options[] = {
VIEW_DISPLAY_NORMAL,
VIEW_DISPLAY_WIREFRAME,
@@ -3065,6 +3071,10 @@ void Node3DEditorViewport::_menu_option(int p_option) {
VIEW_DISPLAY_DEBUG_DECAL_ATLAS,
VIEW_DISPLAY_DEBUG_SDFGI,
VIEW_DISPLAY_DEBUG_SDFGI_PROBES,
+ VIEW_DISPLAY_DEBUG_CLUSTER_OMNI_LIGHTS,
+ VIEW_DISPLAY_DEBUG_CLUSTER_SPOT_LIGHTS,
+ VIEW_DISPLAY_DEBUG_CLUSTER_DECALS,
+ VIEW_DISPLAY_DEBUG_CLUSTER_REFLECTION_PROBES,
VIEW_MAX
};
static const Viewport::DebugDraw debug_draw_modes[] = {
@@ -3088,6 +3098,10 @@ void Node3DEditorViewport::_menu_option(int p_option) {
Viewport::DEBUG_DRAW_DECAL_ATLAS,
Viewport::DEBUG_DRAW_SDFGI,
Viewport::DEBUG_DRAW_SDFGI_PROBES,
+ Viewport::DEBUG_DRAW_CLUSTER_OMNI_LIGHTS,
+ Viewport::DEBUG_DRAW_CLUSTER_SPOT_LIGHTS,
+ Viewport::DEBUG_DRAW_CLUSTER_DECALS,
+ Viewport::DEBUG_DRAW_CLUSTER_REFLECTION_PROBES,
};
int idx = 0;
@@ -3991,6 +4005,12 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, Edito
display_submenu->add_radio_check_item(TTR("GI Buffer"), VIEW_DISPLAY_DEBUG_GI_BUFFER);
display_submenu->add_separator();
display_submenu->add_radio_check_item(TTR("Disable LOD"), VIEW_DISPLAY_DEBUG_DISABLE_LOD);
+ display_submenu->add_separator();
+ display_submenu->add_radio_check_item(TTR("Omni Light Cluster"), VIEW_DISPLAY_DEBUG_CLUSTER_OMNI_LIGHTS);
+ display_submenu->add_radio_check_item(TTR("Spot Light Cluster"), VIEW_DISPLAY_DEBUG_CLUSTER_SPOT_LIGHTS);
+ display_submenu->add_radio_check_item(TTR("Decal Cluster"), VIEW_DISPLAY_DEBUG_CLUSTER_DECALS);
+ display_submenu->add_radio_check_item(TTR("Reflection Probe Cluster"), VIEW_DISPLAY_DEBUG_CLUSTER_REFLECTION_PROBES);
+
display_submenu->set_name("display_advanced");
view_menu->get_popup()->add_submenu_item(TTR("Display Advanced..."), "display_advanced", VIEW_DISPLAY_ADVANCED);
view_menu->get_popup()->add_separator();
diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h
index 0cefaa6557..d7a47fa4fa 100644
--- a/editor/plugins/node_3d_editor_plugin.h
+++ b/editor/plugins/node_3d_editor_plugin.h
@@ -213,6 +213,11 @@ class Node3DEditorViewport : public Control {
VIEW_DISPLAY_DEBUG_SDFGI_PROBES,
VIEW_DISPLAY_DEBUG_GI_BUFFER,
VIEW_DISPLAY_DEBUG_DISABLE_LOD,
+ VIEW_DISPLAY_DEBUG_CLUSTER_OMNI_LIGHTS,
+ VIEW_DISPLAY_DEBUG_CLUSTER_SPOT_LIGHTS,
+ VIEW_DISPLAY_DEBUG_CLUSTER_DECALS,
+ VIEW_DISPLAY_DEBUG_CLUSTER_REFLECTION_PROBES,
+
VIEW_LOCK_ROTATION,
VIEW_CINEMATIC_PREVIEW,
VIEW_AUTO_ORTHOGONAL,
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index 1b0e9ec781..f57c8fbd6b 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -214,7 +214,7 @@ void ScriptTextEditor::_load_theme_settings() {
text_edit->add_theme_color_override("line_number_color", line_number_color);
text_edit->add_theme_color_override("caret_color", caret_color);
text_edit->add_theme_color_override("caret_background_color", caret_background_color);
- text_edit->add_theme_color_override("font_color_selected", text_selected_color);
+ text_edit->add_theme_color_override("font_selected_color", text_selected_color);
text_edit->add_theme_color_override("selection_color", selection_color);
text_edit->add_theme_color_override("brace_mismatch_color", brace_mismatch_color);
text_edit->add_theme_color_override("current_line_color", current_line_color);
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index d6a816f606..05a1561f7d 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -117,7 +117,7 @@ void ShaderTextEditor::_load_theme_settings() {
get_text_editor()->add_theme_color_override("line_number_color", line_number_color);
get_text_editor()->add_theme_color_override("caret_color", caret_color);
get_text_editor()->add_theme_color_override("caret_background_color", caret_background_color);
- get_text_editor()->add_theme_color_override("font_color_selected", text_selected_color);
+ get_text_editor()->add_theme_color_override("font_selected_color", text_selected_color);
get_text_editor()->add_theme_color_override("selection_color", selection_color);
get_text_editor()->add_theme_color_override("brace_mismatch_color", brace_mismatch_color);
get_text_editor()->add_theme_color_override("current_line_color", current_line_color);
diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp
index ea58a4535b..e160e6ca0d 100644
--- a/editor/plugins/skeleton_3d_editor_plugin.cpp
+++ b/editor/plugins/skeleton_3d_editor_plugin.cpp
@@ -383,6 +383,10 @@ PhysicalBone3D *Skeleton3DEditor::create_physical_bone(int bone_id, int bone_chi
CollisionShape3D *bone_shape = memnew(CollisionShape3D);
bone_shape->set_shape(bone_shape_capsule);
+ Transform capsule_transform;
+ capsule_transform.basis = Basis(Vector3(1, 0, 0), Vector3(0, 0, 1), Vector3(0, -1, 0));
+ bone_shape->set_transform(capsule_transform);
+
Transform body_transform;
body_transform.set_look_at(Vector3(0, 0, 0), child_rest.origin, Vector3(0, 1, 0));
body_transform.origin = body_transform.basis.xform(Vector3(0, 0, -half_height));
diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp
index 3628a2e4d1..d45011c8aa 100644
--- a/editor/plugins/text_editor.cpp
+++ b/editor/plugins/text_editor.cpp
@@ -96,7 +96,7 @@ void TextEditor::_load_theme_settings() {
text_edit->add_theme_color_override("line_number_color", line_number_color);
text_edit->add_theme_color_override("caret_color", caret_color);
text_edit->add_theme_color_override("caret_background_color", caret_background_color);
- text_edit->add_theme_color_override("font_color_selected", text_selected_color);
+ text_edit->add_theme_color_override("font_selected_color", text_selected_color);
text_edit->add_theme_color_override("selection_color", selection_color);
text_edit->add_theme_color_override("brace_mismatch_color", brace_mismatch_color);
text_edit->add_theme_color_override("current_line_color", current_line_color);
diff --git a/editor/plugins/texture_3d_editor_plugin.cpp b/editor/plugins/texture_3d_editor_plugin.cpp
index 099257daa1..04e6aa6fa8 100644
--- a/editor/plugins/texture_3d_editor_plugin.cpp
+++ b/editor/plugins/texture_3d_editor_plugin.cpp
@@ -173,8 +173,7 @@ Texture3DEditor::Texture3DEditor() {
info->set_h_grow_direction(GROW_DIRECTION_BEGIN);
info->set_v_grow_direction(GROW_DIRECTION_BEGIN);
info->add_theme_color_override("font_color", Color(1, 1, 1, 1));
- info->add_theme_color_override("font_color_shadow", Color(0, 0, 0, 0.5));
- info->add_theme_color_override("font_color_shadow", Color(0, 0, 0, 0.5));
+ info->add_theme_color_override("font_shadow_color", Color(0, 0, 0, 0.5));
info->add_theme_constant_override("shadow_as_outline", 1);
info->add_theme_constant_override("shadow_offset_x", 2);
info->add_theme_constant_override("shadow_offset_y", 2);
diff --git a/editor/plugins/texture_layered_editor_plugin.cpp b/editor/plugins/texture_layered_editor_plugin.cpp
index 3b95ed813f..2be300ad66 100644
--- a/editor/plugins/texture_layered_editor_plugin.cpp
+++ b/editor/plugins/texture_layered_editor_plugin.cpp
@@ -238,8 +238,7 @@ TextureLayeredEditor::TextureLayeredEditor() {
info->set_h_grow_direction(GROW_DIRECTION_BEGIN);
info->set_v_grow_direction(GROW_DIRECTION_BEGIN);
info->add_theme_color_override("font_color", Color(1, 1, 1, 1));
- info->add_theme_color_override("font_color_shadow", Color(0, 0, 0, 0.5));
- info->add_theme_color_override("font_color_shadow", Color(0, 0, 0, 0.5));
+ info->add_theme_color_override("font_shadow_color", Color(0, 0, 0, 0.5));
info->add_theme_constant_override("shadow_as_outline", 1);
info->add_theme_constant_override("shadow_offset_x", 2);
info->add_theme_constant_override("shadow_offset_y", 2);
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index 443e867a9f..fb821a0856 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -619,7 +619,7 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id) {
if (vsnode->get_input_port_default_hint(i) != "" && !port_left_used) {
Label *hint_label = memnew(Label);
hint_label->set_text("[" + vsnode->get_input_port_default_hint(i) + "]");
- hint_label->add_theme_color_override("font_color", VisualShaderEditor::get_singleton()->get_theme_color("font_color_readonly", "TextEdit"));
+ hint_label->add_theme_color_override("font_color", VisualShaderEditor::get_singleton()->get_theme_color("font_readonly_color", "TextEdit"));
hint_label->add_theme_style_override("normal", label_style);
hb->add_child(hint_label);
}
@@ -1282,6 +1282,9 @@ void VisualShaderEditor::_update_graph() {
graph->connect_node(itos(from), from_idx, itos(to), to_idx);
}
+
+ float graph_minimap_opacity = EditorSettings::get_singleton()->get("editors/visual_editors/minimap_opacity");
+ graph->set_minimap_opacity(graph_minimap_opacity);
}
VisualShader::Type VisualShaderEditor::get_current_shader_type() const {
@@ -1880,12 +1883,47 @@ VisualShaderNode *VisualShaderEditor::_add_node(int p_idx, int p_op_idx) {
undo_redo->add_do_method(expr, "set_size", Size2(250 * EDSCALE, 150 * EDSCALE));
}
+ bool created_expression_port = false;
+
if (to_node != -1 && to_slot != -1) {
- if (vsnode->get_output_port_count() > 0) {
+ VisualShaderNode::PortType input_port_type = visual_shader->get_node(type, to_node)->get_input_port_type(to_slot);
+
+ if (expr && expr->is_editable() && input_port_type != VisualShaderNode::PORT_TYPE_SAMPLER) {
+ undo_redo->add_do_method(expr, "add_output_port", 0, input_port_type, "output0");
+ undo_redo->add_undo_method(expr, "remove_output_port", 0);
+
+ String initial_expression_code;
+
+ switch (input_port_type) {
+ case VisualShaderNode::PORT_TYPE_SCALAR:
+ initial_expression_code = "output0 = 1.0;";
+ break;
+ case VisualShaderNode::PORT_TYPE_SCALAR_INT:
+ initial_expression_code = "output0 = 1;";
+ break;
+ case VisualShaderNode::PORT_TYPE_VECTOR:
+ initial_expression_code = "output0 = vec3(1.0, 1.0, 1.0);";
+ break;
+ case VisualShaderNode::PORT_TYPE_BOOLEAN:
+ initial_expression_code = "output0 = true;";
+ break;
+ case VisualShaderNode::PORT_TYPE_TRANSFORM:
+ initial_expression_code = "output0 = mat4(1.0);";
+ break;
+ default:
+ break;
+ }
+
+ undo_redo->add_do_method(expr, "set_expression", initial_expression_code);
+ undo_redo->add_do_method(graph_plugin.ptr(), "update_node", type, id_to_use);
+
+ created_expression_port = true;
+ }
+ if (vsnode->get_output_port_count() > 0 || created_expression_port) {
int _from_node = id_to_use;
int _from_slot = 0;
- if (visual_shader->is_port_types_compatible(vsnode->get_output_port_type(_from_slot), visual_shader->get_node(type, to_node)->get_input_port_type(to_slot))) {
+ if (created_expression_port || visual_shader->is_port_types_compatible(vsnode->get_output_port_type(_from_slot), input_port_type)) {
undo_redo->add_do_method(visual_shader.ptr(), "connect_nodes", type, _from_node, _from_slot, to_node, to_slot);
undo_redo->add_undo_method(visual_shader.ptr(), "disconnect_nodes", type, _from_node, _from_slot, to_node, to_slot);
undo_redo->add_do_method(graph_plugin.ptr(), "connect_nodes", type, _from_node, _from_slot, to_node, to_slot);
@@ -1893,11 +1931,21 @@ VisualShaderNode *VisualShaderEditor::_add_node(int p_idx, int p_op_idx) {
}
}
} else if (from_node != -1 && from_slot != -1) {
- if (vsnode->get_input_port_count() > 0) {
+ VisualShaderNode::PortType output_port_type = visual_shader->get_node(type, from_node)->get_output_port_type(from_slot);
+
+ if (expr && expr->is_editable()) {
+ undo_redo->add_do_method(expr, "add_input_port", 0, output_port_type, "input0");
+ undo_redo->add_undo_method(expr, "remove_input_port", 0);
+ undo_redo->add_do_method(graph_plugin.ptr(), "update_node", type, id_to_use);
+
+ created_expression_port = true;
+ }
+
+ if (vsnode->get_input_port_count() > 0 || created_expression_port) {
int _to_node = id_to_use;
int _to_slot = 0;
- if (visual_shader->is_port_types_compatible(visual_shader->get_node(type, from_node)->get_output_port_type(from_slot), vsnode->get_input_port_type(_to_slot))) {
+ if (created_expression_port || visual_shader->is_port_types_compatible(output_port_type, vsnode->get_input_port_type(_to_slot))) {
undo_redo->add_undo_method(visual_shader.ptr(), "disconnect_nodes", type, from_node, from_slot, _to_node, _to_slot);
undo_redo->add_do_method(visual_shader.ptr(), "connect_nodes", type, from_node, from_slot, _to_node, _to_slot);
undo_redo->add_undo_method(graph_plugin.ptr(), "disconnect_nodes", type, from_node, from_slot, _to_node, _to_slot);
@@ -3161,6 +3209,8 @@ VisualShaderEditor::VisualShaderEditor() {
graph->set_h_size_flags(SIZE_EXPAND_FILL);
add_child(graph);
graph->set_drag_forwarding(this);
+ float graph_minimap_opacity = EditorSettings::get_singleton()->get("editors/visual_editors/minimap_opacity");
+ graph->set_minimap_opacity(graph_minimap_opacity);
graph->add_valid_right_disconnect_type(VisualShaderNode::PORT_TYPE_SCALAR);
graph->add_valid_right_disconnect_type(VisualShaderNode::PORT_TYPE_SCALAR_INT);
graph->add_valid_right_disconnect_type(VisualShaderNode::PORT_TYPE_BOOLEAN);
diff --git a/editor/project_export.cpp b/editor/project_export.cpp
index 4a8990daa9..4bcb616fbd 100644
--- a/editor/project_export.cpp
+++ b/editor/project_export.cpp
@@ -830,6 +830,12 @@ void ProjectExportDialog::_refresh_parent_checks(TreeItem *p_item) {
}
void ProjectExportDialog::_export_pck_zip() {
+ Ref<EditorExportPreset> current = get_current_preset();
+ ERR_FAIL_COND(current.is_null());
+
+ String dir = current->get_export_path().get_base_dir();
+ export_pck_zip->set_current_dir(dir);
+
export_pck_zip->popup_file_dialog();
}