diff options
Diffstat (limited to 'editor')
24 files changed, 231 insertions, 51 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index e9e6cc9ea0..112d94dc3b 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -559,7 +559,7 @@ void EditorNode::_menu_confirm_current() { _menu_option_confirm(current_option, true); } -void EditorNode::_dialog_display_file_error(String p_file, Error p_error) { +void EditorNode::_dialog_display_save_error(String p_file, Error p_error) { if (p_error) { @@ -586,6 +586,41 @@ void EditorNode::_dialog_display_file_error(String p_file, Error p_error) { } } +void EditorNode::_dialog_display_load_error(String p_file, Error p_error) { + + if (p_error) { + + current_option = -1; + accept->get_ok()->set_text(TTR("I see..")); + + switch (p_error) { + + case ERR_CANT_OPEN: { + + accept->set_text(vformat(TTR("Can't open '%s'."), p_file.get_file())); + } break; + case ERR_PARSE_ERROR: { + + accept->set_text(vformat(TTR("Error while parsing '%s'."), p_file.get_file())); + } break; + case ERR_FILE_CORRUPT: { + + accept->set_text(vformat(TTR("Unexpected end of file '%s'."), p_file.get_file())); + } break; + case ERR_FILE_NOT_FOUND: { + + accept->set_text(vformat(TTR("Missing '%s' or its dependencies."), p_file.get_file())); + } break; + default: { + + accept->set_text(vformat(TTR("Error while loading '%s'."), p_file.get_file())); + } break; + } + + accept->popup_centered_minsize(); + } +} + void EditorNode::_get_scene_metadata(const String &p_file) { Node *scene = editor_data.get_edited_scene_root(); @@ -899,7 +934,7 @@ void EditorNode::_save_scene(String p_file, int idx) { _update_scene_tabs(); } else { - _dialog_display_file_error(p_file, err); + _dialog_display_save_error(p_file, err); } } @@ -908,8 +943,10 @@ void EditorNode::_save_all_scenes() { for (int i = 0; i < editor_data.get_edited_scene_count(); i++) { Node *scene = editor_data.get_edited_scene_root(i); if (scene && scene->get_filename() != "") { - // save in background if in the script editor - _save_scene_with_preview(scene->get_filename()); + if (i != editor_data.get_edited_scene()) + _save_scene(scene->get_filename(), i); + else + _save_scene_with_preview(scene->get_filename()); } // else: ignore new scenes } @@ -983,7 +1020,10 @@ void EditorNode::_dialog_action(String p_file) { if (file->get_mode() == EditorFileDialog::MODE_SAVE_FILE) { _save_default_environment(); - _save_scene_with_preview(p_file); + if (scene_idx != editor_data.get_edited_scene()) + _save_scene(p_file, scene_idx); + else + _save_scene_with_preview(p_file); if (scene_idx != -1) _discard_changes(); @@ -1660,8 +1700,10 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { Node *scene = editor_data.get_edited_scene_root(scene_idx); if (scene && scene->get_filename() != "") { - // save in background if in the script editor - _save_scene_with_preview(scene->get_filename()); + if (scene_idx != editor_data.get_edited_scene()) + _save_scene(scene->get_filename(), scene_idx); + else + _save_scene_with_preview(scene->get_filename()); if (scene_idx != -1) _discard_changes(); @@ -2783,13 +2825,11 @@ Error EditorNode::load_scene(const String &p_scene, bool p_ignore_broken_deps, b dependency_errors.clear(); - Ref<PackedScene> sdata = ResourceLoader::load(lpath, "", true); + Error err; + Ref<PackedScene> sdata = ResourceLoader::load(lpath, "", true, &err); if (!sdata.is_valid()) { - current_option = -1; - accept->get_ok()->set_text(TTR("Ugh")); - accept->set_text(TTR("Error loading scene.")); - accept->popup_centered_minsize(); + _dialog_display_load_error(lpath, err); opening_prev = false; if (prev != -1) { @@ -2846,10 +2886,7 @@ Error EditorNode::load_scene(const String &p_scene, bool p_ignore_broken_deps, b if (!new_scene) { sdata.unref(); - current_option = -1; - accept->get_ok()->set_text(TTR("Ugh")); - accept->set_text(TTR("Error loading scene.")); - accept->popup_centered_minsize(); + _dialog_display_load_error(lpath, ERR_FILE_NOT_FOUND); opening_prev = false; if (prev != -1) { set_current_scene(prev); diff --git a/editor/editor_node.h b/editor/editor_node.h index 08c7e11c85..60c0609e33 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -404,7 +404,8 @@ private: void _dialog_action(String p_file); void _edit_current(); - void _dialog_display_file_error(String p_file, Error p_error); + void _dialog_display_save_error(String p_file, Error p_error); + void _dialog_display_load_error(String p_file, Error p_error); int current_option; void _resource_created(); diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index b9a6414b08..6398bd1623 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -694,6 +694,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { set("editors/2d/pan_speed", 20); set("editors/poly_editor/point_grab_radius", 8); + set("editors/poly_editor/show_previous_outline", true); set("run/window_placement/rect", 1); hints["run/window_placement/rect"] = PropertyInfo(Variant::INT, "run/window_placement/rect", PROPERTY_HINT_ENUM, "Top Left,Centered,Custom Position,Force Maximized,Force Fullscreen"); diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index a527701563..aa2b8913df 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -93,8 +93,11 @@ Ref<ImageTexture> editor_generate_icon(int p_index, bool dark_theme = true) { Ref<ImageTexture> icon = memnew(ImageTexture); Ref<Image> img = memnew(Image); + // dumb gizmo check + bool is_gizmo = String(editor_icons_names[p_index]).begins_with("Gizmo"); + ImageLoaderSVG::create_image_from_string(img, dark_theme ? editor_icons_sources[p_index] : editor_icons_sources_dark[p_index], EDSCALE, true); - if ((EDSCALE - (float)((int)EDSCALE)) > 0.0) + if ((EDSCALE - (float)((int)EDSCALE)) > 0.0 || is_gizmo) icon->create_from_image(img); // in this case filter really helps else icon->create_from_image(img, 0); diff --git a/editor/icons/dark/icon_gizmo_camera.svg b/editor/icons/dark/icon_gizmo_camera.svg new file mode 100644 index 0000000000..f6e5f885e7 --- /dev/null +++ b/editor/icons/dark/icon_gizmo_camera.svg @@ -0,0 +1,5 @@ +<svg width="128" height="128" version="1.1" viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg"> +<g transform="translate(0 -924.36)"> +<path d="m76 944.36a24 24 0 0 0 -23.906 22.219 24 24 0 0 0 -16.094 -6.2192 24 24 0 0 0 -24 24 24 24 0 0 0 16 22.594v17.406c0 4.432 3.5679 8 8 8h48c4.4321 0 8-3.568 8-8v-8l24 16v-48l-24 16v-14.156a24 24 0 0 0 8 -17.844 24 24 0 0 0 -24 -24z" fill="#f7f5cf"/> +</g> +</svg> diff --git a/editor/icons/dark/icon_gizmo_directional_light.svg b/editor/icons/dark/icon_gizmo_directional_light.svg index a8739a5a78..f7fa732501 100644 --- a/editor/icons/dark/icon_gizmo_directional_light.svg +++ b/editor/icons/dark/icon_gizmo_directional_light.svg @@ -1,5 +1,5 @@ <svg width="128" height="128" version="1.1" viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg"> <g transform="translate(0 -924.36)"> -<path transform="translate(0 924.36)" d="m64 4a8 8 0 0 0 -8 8v12a8 8 0 0 0 8 8 8 8 0 0 0 8 -8v-12a8 8 0 0 0 -8 -8zm-36.887 15.23a8 8 0 0 0 -5.5391 2.3438 8 8 0 0 0 0 11.312l8.4844 8.4863a8 8 0 0 0 11.314 0 8 8 0 0 0 0 -11.314l-8.4863-8.4844a8 8 0 0 0 -5.7734 -2.3438zm73.539 0a8 8 0 0 0 -5.5391 2.3438l-8.4863 8.4844a8 8 0 0 0 0 11.314 8 8 0 0 0 11.314 0l8.4844-8.4863a8 8 0 0 0 0 -11.312 8 8 0 0 0 -5.7734 -2.3438zm-36.652 20.77a24 24 0 0 0 -24 24 24 24 0 0 0 24 24 24 24 0 0 0 24 -24 24 24 0 0 0 -24 -24zm-52 16a8 8 0 0 0 -8 8 8 8 0 0 0 8 8h12a8 8 0 0 0 8 -8 8 8 0 0 0 -8 -8h-12zm92 0a8 8 0 0 0 -8 8 8 8 0 0 0 8 8h12a8 8 0 0 0 8 -8 8 8 0 0 0 -8 -8h-12zm-68.4 28.285a8 8 0 0 0 -5.541 2.3418l-8.4844 8.4863a8 8 0 0 0 0 11.312 8 8 0 0 0 11.312 0l8.4863-8.4844a8 8 0 0 0 0 -11.314 8 8 0 0 0 -5.7734 -2.3418zm56.568 0a8 8 0 0 0 -5.541 2.3418 8 8 0 0 0 0 11.314l8.4863 8.4844a8 8 0 0 0 11.312 0 8 8 0 0 0 0 -11.312l-8.4844-8.4863a8 8 0 0 0 -5.7734 -2.3418zm-28.168 11.715a8 8 0 0 0 -8 8v12a8 8 0 0 0 8 8 8 8 0 0 0 8 -8v-12a8 8 0 0 0 -8 -8z" fill="#f7f5cf"/> +<path transform="translate(0 924.36)" d="m64 8c-2.216 0-4 1.784-4 4v16c0 2.216 1.784 4 4 4s4-1.784 4-4v-16c0-2.216-1.784-4-4-4zm-36.77 15.227c-1.0225 0-2.0447 0.39231-2.8281 1.1758-1.5669 1.5669-1.5669 4.0893 0 5.6562l11.312 11.314c1.5669 1.5669 4.0913 1.5669 5.6582 0s1.5669-4.0913 0-5.6582l-11.314-11.312c-0.78348-0.78348-1.8056-1.1758-2.8281-1.1758zm73.539 0c-1.0225 0-2.0446 0.39231-2.8281 1.1758l-11.314 11.312c-1.5669 1.5669-1.5669 4.0913 0 5.6582s4.0913 1.5669 5.6582 0l11.313-11.314c1.5669-1.5669 1.5669-4.0893 0-5.6562-0.78348-0.78348-1.8056-1.1758-2.8281-1.1758zm-36.77 20.773c-11.046 1e-5 -20 8.9543-20 20 7e-6 11.046 8.9543 20 20 20s20-8.9543 20-20c-8e-6 -11.046-8.9543-20-20-20zm-52 16c-2.216 0-4 1.784-4 4s1.784 4 4 4h16c2.216 0 4-1.784 4-4s-1.784-4-4-4h-16zm88 0c-2.216 0-4 1.784-4 4s1.784 4 4 4h16c2.216 0 4-1.784 4-4s-1.784-4-4-4h-16zm-61.455 25.453c-1.0225 0-2.0466 0.39035-2.8301 1.1738l-11.312 11.314c-1.5669 1.5669-1.5669 4.0893 0 5.6563 1.5669 1.5669 4.0893 1.5669 5.6562 0l11.314-11.313c1.5669-1.5669 1.5669-4.0913 0-5.6582-0.78347-0.78347-1.8056-1.1738-2.8281-1.1738zm50.91 0c-1.0225 0-2.0447 0.39035-2.8281 1.1738-1.5669 1.5669-1.5669 4.0913 0 5.6582l11.314 11.313c1.5669 1.5669 4.0893 1.5669 5.6563 0 1.5669-1.567 1.5669-4.0893 0-5.6563l-11.313-11.314c-0.78347-0.78347-1.8076-1.1738-2.8301-1.1738zm-25.455 10.547c-2.216 0-4 1.784-4 4v16c0 2.216 1.784 4 4 4s4-1.784 4-4v-16c0-2.216-1.784-4-4-4z" fill="#f7f5cf"/> </g> </svg> diff --git a/editor/icons/dark/icon_gizmo_g_i_probe.svg b/editor/icons/dark/icon_gizmo_g_i_probe.svg new file mode 100644 index 0000000000..7d3adf4196 --- /dev/null +++ b/editor/icons/dark/icon_gizmo_g_i_probe.svg @@ -0,0 +1,5 @@ +<svg width="128" height="128" version="1.1" viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg"> +<g transform="translate(0 -924.36)"> +<path transform="translate(0 924.36)" d="m12 8a4.0004 4.0004 0 0 0 -4 4v104a4.0004 4.0004 0 0 0 4 4h60v-8h-56v-96h96v8h8v-12a4.0004 4.0004 0 0 0 -4 -4h-104zm27.715 17.951c-1.2324 0.086154-2.3996 0.76492-3.0664 1.9199l-0.14844 0.25781c-1.0669 1.848-0.43784 4.1948 1.4102 5.2617l10.648 6.1484c1.848 1.0669 4.1948 0.43784 5.2617-1.4102l0.14844-0.25781c1.0669-1.848 0.43784-4.1948-1.4102-5.2617l-10.648-6.1484c-0.693-0.4001-1.4558-0.56146-2.1953-0.50977zm52.285 2.0488a32 32 0 0 0 -32 32 32 32 0 0 0 16 27.668v8.332c0 4.432 3.568 8 8 8h16c4.432 0 8-3.568 8-8v-8.3223a32 32 0 0 0 16 -27.678 32 32 0 0 0 -32 -32zm0 12a20 20 0 0 1 20 20 20 20 0 0 1 -20 20 20 20 0 0 1 -20 -20 20 20 0 0 1 20 -20zm-60.148 16c-2.1339 0-3.8516 1.7177-3.8516 3.8516v0.29688c0 2.1339 1.7177 3.8516 3.8516 3.8516h12.297c2.1339 0 3.8516-1.7177 3.8516-3.8516v-0.29688c0-2.1339-1.7177-3.8516-3.8516-3.8516h-12.297zm18.902 23.951c-0.73947-0.051693-1.5023 0.10966-2.1953 0.50977l-10.648 6.1484c-1.848 1.0669-2.4771 3.4137-1.4102 5.2617l0.14844 0.25781c1.0669 1.848 3.4137 2.4771 5.2617 1.4102l10.648-6.1484c1.848-1.0669 2.4771-3.4137 1.4102-5.2617l-0.14844-0.25781c-0.66684-1.155-1.834-1.8338-3.0664-1.9199zm33.246 32.049v8h16v-8h-16z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#f7f5cf" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="filter-blend-mode:normal;filter-gaussianBlur-deviation:0;font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/> +</g> +</svg> diff --git a/editor/icons/dark/icon_gizmo_particles.svg b/editor/icons/dark/icon_gizmo_particles.svg new file mode 100644 index 0000000000..cc88a76cd4 --- /dev/null +++ b/editor/icons/dark/icon_gizmo_particles.svg @@ -0,0 +1,13 @@ +<svg width="128" height="128" version="1.1" viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg"> +<g transform="translate(0 -924.36)"> +<g transform="matrix(8 0 0 8 0 -7366.5)" fill="#f7f5cf"> +<circle cx="4" cy="1044.4" r="3"/> +<ellipse cx="8" cy="1042.4" rx="4.5" ry="5"/> +<path d="m4 1047.4h8v-4h-8z" fill-rule="evenodd"/> +<circle cx="12" cy="1044.4" r="3"/> +<circle cx="4" cy="1049.4" r="1"/> +<circle cx="12" cy="1049.4" r="1"/> +<circle cx="8" cy="1050.4" r="1"/> +</g> +</g> +</svg> diff --git a/editor/icons/dark/icon_gizmo_reflection_probe.svg b/editor/icons/dark/icon_gizmo_reflection_probe.svg new file mode 100644 index 0000000000..6d80e73b8c --- /dev/null +++ b/editor/icons/dark/icon_gizmo_reflection_probe.svg @@ -0,0 +1,5 @@ +<svg width="128" height="128" version="1.1" viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg"> +<g transform="translate(0 -924.36)"> +<path transform="translate(0 924.36)" d="m12 8a4.0004 4.0004 0 0 0 -4 4v24h8v-20h96v8h8v-12a4.0004 4.0004 0 0 0 -4 -4h-104zm76 28a4 4 0 0 0 -4 4 4 4 0 0 0 4 4h18.732l-42.957 50.119-44.947-44.947-5.6562 5.6582 48 48a4.0004 4.0004 0 0 0 5.8652 -0.22656l44.963-52.457v17.854a4 4 0 0 0 4 4 4 4 0 0 0 4 -4v-28a4.0004 4.0004 0 0 0 -4 -4h-28zm-80 52v28a4.0004 4.0004 0 0 0 4 4h104a4.0004 4.0004 0 0 0 4 -4v-28h-8v24h-96v-24h-8z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#f7f5cf" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="filter-blend-mode:normal;filter-gaussianBlur-deviation:0;font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/> +</g> +</svg> diff --git a/editor/icons/dark/icon_gizmo_spatial_sample_player.svg b/editor/icons/dark/icon_gizmo_spatial_sample_player.svg index d40fe230ac..7dbb4744be 100644 --- a/editor/icons/dark/icon_gizmo_spatial_sample_player.svg +++ b/editor/icons/dark/icon_gizmo_spatial_sample_player.svg @@ -1,5 +1,5 @@ <svg width="128" height="128" version="1.1" viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg"> <g transform="translate(0 -924.36)"> -<path transform="translate(0 924.36)" d="m63.883 12.004a4.0004 4.0004 0 0 0 -2.7109 1.168l-30.828 30.83h-14.344a4.0004 4.0004 0 0 0 -4 4v32a4.0004 4.0004 0 0 0 4 4h14.344l30.828 30.828a4.0004 4.0004 0 0 0 6.8281 -2.8281v-96.002a4.0004 4.0004 0 0 0 -4.1172 -3.9961zm46.117 5.9961a6 6 0 0 0 -6 6v80a6 6 0 0 0 6 6 6 6 0 0 0 6 -6v-80a6 6 0 0 0 -6 -6zm-24 24a6 6 0 0 0 -6 6v32h0.34961a6 6 0 0 0 5.6504 4 6 6 0 0 0 5.6484 -4h0.35156v-32a6 6 0 0 0 -6 -6z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#f7f5cf" fill-rule="evenodd" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/> +<path transform="translate(0 924.36)" d="m63.883 12.004c-1.0195 0.0295-1.9892 0.4473-2.7109 1.168l-30.828 30.83h-14.344c-2.209 2.21e-4 -3.9998 1.791-4 4v32c2.21e-4 2.209 1.791 3.9998 4 4h14.344l30.828 30.828c2.52 2.5182 6.8267 0.73442 6.8281-2.8281v-96.002c-0.0015-2.2541-1.8641-4.0619-4.1172-3.9961zm48.117 3.9961a4 4 0 0 0 -4 4v88a4 4 0 0 0 4 4 4 4 0 0 0 4 -4v-88a4 4 0 0 0 -4 -4zm-24 24a4 4 0 0 0 -4 4v40a4 4 0 0 0 4 4 4 4 0 0 0 4 -4v-40a4 4 0 0 0 -4 -4z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#f7f5cf" fill-rule="evenodd" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/> </g> </svg> diff --git a/editor/icons/dark/icon_gizmo_spot_light.svg b/editor/icons/dark/icon_gizmo_spot_light.svg new file mode 100644 index 0000000000..9b4ddadd17 --- /dev/null +++ b/editor/icons/dark/icon_gizmo_spot_light.svg @@ -0,0 +1,5 @@ +<svg width="128" height="128" version="1.1" viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg"> +<g transform="translate(0 -924.36)"> +<path transform="translate(0 924.36)" d="m52 8c-4.432 0-8 3.568-8 8v12 16.875a40 36 0 0 0 -20 31.125h28a12 12 0 0 0 12 12 12 12 0 0 0 12 -12h28a40 36 0 0 0 -20 -31.141v-20.859-8c0-4.432-3.568-8-8-8h-24zm-11.969 78.006c-0.76793-0.053681-1.5596 0.1138-2.2793 0.5293l-10.393 6c-1.9191 1.108-2.5728 3.5457-1.4648 5.4648s3.5457 2.5728 5.4648 1.4648l10.393-6c1.9191-1.108 2.5709-3.5457 1.4629-5.4648-0.6925-1.1994-1.9037-1.9047-3.1836-1.9941zm47.938 0c-1.2799 0.08947-2.4911 0.7947-3.1836 1.9941-1.108 1.9191-0.45622 4.3568 1.4629 5.4648l10.393 6c1.9191 1.108 4.3568 0.45427 5.4648-1.4648s0.45427-4.3568-1.4648-5.4648l-10.393-6c-0.71967-0.4155-1.5114-0.58298-2.2793-0.5293zm-23.969 13.994c-2.216 0-4 1.784-4 4v12c0 2.216 1.784 4 4 4s4-1.784 4-4v-12c0-2.216-1.784-4-4-4z" fill="#f7f5cf" stroke-linecap="round" stroke-linejoin="round" stroke-width="2.1082"/> +</g> +</svg> diff --git a/editor/icons/icon_gizmo_camera.svg b/editor/icons/icon_gizmo_camera.svg new file mode 100644 index 0000000000..f6e5f885e7 --- /dev/null +++ b/editor/icons/icon_gizmo_camera.svg @@ -0,0 +1,5 @@ +<svg width="128" height="128" version="1.1" viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg"> +<g transform="translate(0 -924.36)"> +<path d="m76 944.36a24 24 0 0 0 -23.906 22.219 24 24 0 0 0 -16.094 -6.2192 24 24 0 0 0 -24 24 24 24 0 0 0 16 22.594v17.406c0 4.432 3.5679 8 8 8h48c4.4321 0 8-3.568 8-8v-8l24 16v-48l-24 16v-14.156a24 24 0 0 0 8 -17.844 24 24 0 0 0 -24 -24z" fill="#f7f5cf"/> +</g> +</svg> diff --git a/editor/icons/icon_gizmo_directional_light.svg b/editor/icons/icon_gizmo_directional_light.svg index a8739a5a78..f7fa732501 100644 --- a/editor/icons/icon_gizmo_directional_light.svg +++ b/editor/icons/icon_gizmo_directional_light.svg @@ -1,5 +1,5 @@ <svg width="128" height="128" version="1.1" viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg"> <g transform="translate(0 -924.36)"> -<path transform="translate(0 924.36)" d="m64 4a8 8 0 0 0 -8 8v12a8 8 0 0 0 8 8 8 8 0 0 0 8 -8v-12a8 8 0 0 0 -8 -8zm-36.887 15.23a8 8 0 0 0 -5.5391 2.3438 8 8 0 0 0 0 11.312l8.4844 8.4863a8 8 0 0 0 11.314 0 8 8 0 0 0 0 -11.314l-8.4863-8.4844a8 8 0 0 0 -5.7734 -2.3438zm73.539 0a8 8 0 0 0 -5.5391 2.3438l-8.4863 8.4844a8 8 0 0 0 0 11.314 8 8 0 0 0 11.314 0l8.4844-8.4863a8 8 0 0 0 0 -11.312 8 8 0 0 0 -5.7734 -2.3438zm-36.652 20.77a24 24 0 0 0 -24 24 24 24 0 0 0 24 24 24 24 0 0 0 24 -24 24 24 0 0 0 -24 -24zm-52 16a8 8 0 0 0 -8 8 8 8 0 0 0 8 8h12a8 8 0 0 0 8 -8 8 8 0 0 0 -8 -8h-12zm92 0a8 8 0 0 0 -8 8 8 8 0 0 0 8 8h12a8 8 0 0 0 8 -8 8 8 0 0 0 -8 -8h-12zm-68.4 28.285a8 8 0 0 0 -5.541 2.3418l-8.4844 8.4863a8 8 0 0 0 0 11.312 8 8 0 0 0 11.312 0l8.4863-8.4844a8 8 0 0 0 0 -11.314 8 8 0 0 0 -5.7734 -2.3418zm56.568 0a8 8 0 0 0 -5.541 2.3418 8 8 0 0 0 0 11.314l8.4863 8.4844a8 8 0 0 0 11.312 0 8 8 0 0 0 0 -11.312l-8.4844-8.4863a8 8 0 0 0 -5.7734 -2.3418zm-28.168 11.715a8 8 0 0 0 -8 8v12a8 8 0 0 0 8 8 8 8 0 0 0 8 -8v-12a8 8 0 0 0 -8 -8z" fill="#f7f5cf"/> +<path transform="translate(0 924.36)" d="m64 8c-2.216 0-4 1.784-4 4v16c0 2.216 1.784 4 4 4s4-1.784 4-4v-16c0-2.216-1.784-4-4-4zm-36.77 15.227c-1.0225 0-2.0447 0.39231-2.8281 1.1758-1.5669 1.5669-1.5669 4.0893 0 5.6562l11.312 11.314c1.5669 1.5669 4.0913 1.5669 5.6582 0s1.5669-4.0913 0-5.6582l-11.314-11.312c-0.78348-0.78348-1.8056-1.1758-2.8281-1.1758zm73.539 0c-1.0225 0-2.0446 0.39231-2.8281 1.1758l-11.314 11.312c-1.5669 1.5669-1.5669 4.0913 0 5.6582s4.0913 1.5669 5.6582 0l11.313-11.314c1.5669-1.5669 1.5669-4.0893 0-5.6562-0.78348-0.78348-1.8056-1.1758-2.8281-1.1758zm-36.77 20.773c-11.046 1e-5 -20 8.9543-20 20 7e-6 11.046 8.9543 20 20 20s20-8.9543 20-20c-8e-6 -11.046-8.9543-20-20-20zm-52 16c-2.216 0-4 1.784-4 4s1.784 4 4 4h16c2.216 0 4-1.784 4-4s-1.784-4-4-4h-16zm88 0c-2.216 0-4 1.784-4 4s1.784 4 4 4h16c2.216 0 4-1.784 4-4s-1.784-4-4-4h-16zm-61.455 25.453c-1.0225 0-2.0466 0.39035-2.8301 1.1738l-11.312 11.314c-1.5669 1.5669-1.5669 4.0893 0 5.6563 1.5669 1.5669 4.0893 1.5669 5.6562 0l11.314-11.313c1.5669-1.5669 1.5669-4.0913 0-5.6582-0.78347-0.78347-1.8056-1.1738-2.8281-1.1738zm50.91 0c-1.0225 0-2.0447 0.39035-2.8281 1.1738-1.5669 1.5669-1.5669 4.0913 0 5.6582l11.314 11.313c1.5669 1.5669 4.0893 1.5669 5.6563 0 1.5669-1.567 1.5669-4.0893 0-5.6563l-11.313-11.314c-0.78347-0.78347-1.8076-1.1738-2.8301-1.1738zm-25.455 10.547c-2.216 0-4 1.784-4 4v16c0 2.216 1.784 4 4 4s4-1.784 4-4v-16c0-2.216-1.784-4-4-4z" fill="#f7f5cf"/> </g> </svg> diff --git a/editor/icons/icon_gizmo_g_i_probe.svg b/editor/icons/icon_gizmo_g_i_probe.svg new file mode 100644 index 0000000000..7d3adf4196 --- /dev/null +++ b/editor/icons/icon_gizmo_g_i_probe.svg @@ -0,0 +1,5 @@ +<svg width="128" height="128" version="1.1" viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg"> +<g transform="translate(0 -924.36)"> +<path transform="translate(0 924.36)" d="m12 8a4.0004 4.0004 0 0 0 -4 4v104a4.0004 4.0004 0 0 0 4 4h60v-8h-56v-96h96v8h8v-12a4.0004 4.0004 0 0 0 -4 -4h-104zm27.715 17.951c-1.2324 0.086154-2.3996 0.76492-3.0664 1.9199l-0.14844 0.25781c-1.0669 1.848-0.43784 4.1948 1.4102 5.2617l10.648 6.1484c1.848 1.0669 4.1948 0.43784 5.2617-1.4102l0.14844-0.25781c1.0669-1.848 0.43784-4.1948-1.4102-5.2617l-10.648-6.1484c-0.693-0.4001-1.4558-0.56146-2.1953-0.50977zm52.285 2.0488a32 32 0 0 0 -32 32 32 32 0 0 0 16 27.668v8.332c0 4.432 3.568 8 8 8h16c4.432 0 8-3.568 8-8v-8.3223a32 32 0 0 0 16 -27.678 32 32 0 0 0 -32 -32zm0 12a20 20 0 0 1 20 20 20 20 0 0 1 -20 20 20 20 0 0 1 -20 -20 20 20 0 0 1 20 -20zm-60.148 16c-2.1339 0-3.8516 1.7177-3.8516 3.8516v0.29688c0 2.1339 1.7177 3.8516 3.8516 3.8516h12.297c2.1339 0 3.8516-1.7177 3.8516-3.8516v-0.29688c0-2.1339-1.7177-3.8516-3.8516-3.8516h-12.297zm18.902 23.951c-0.73947-0.051693-1.5023 0.10966-2.1953 0.50977l-10.648 6.1484c-1.848 1.0669-2.4771 3.4137-1.4102 5.2617l0.14844 0.25781c1.0669 1.848 3.4137 2.4771 5.2617 1.4102l10.648-6.1484c1.848-1.0669 2.4771-3.4137 1.4102-5.2617l-0.14844-0.25781c-0.66684-1.155-1.834-1.8338-3.0664-1.9199zm33.246 32.049v8h16v-8h-16z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#f7f5cf" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="filter-blend-mode:normal;filter-gaussianBlur-deviation:0;font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/> +</g> +</svg> diff --git a/editor/icons/icon_gizmo_particles.svg b/editor/icons/icon_gizmo_particles.svg new file mode 100644 index 0000000000..cc88a76cd4 --- /dev/null +++ b/editor/icons/icon_gizmo_particles.svg @@ -0,0 +1,13 @@ +<svg width="128" height="128" version="1.1" viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg"> +<g transform="translate(0 -924.36)"> +<g transform="matrix(8 0 0 8 0 -7366.5)" fill="#f7f5cf"> +<circle cx="4" cy="1044.4" r="3"/> +<ellipse cx="8" cy="1042.4" rx="4.5" ry="5"/> +<path d="m4 1047.4h8v-4h-8z" fill-rule="evenodd"/> +<circle cx="12" cy="1044.4" r="3"/> +<circle cx="4" cy="1049.4" r="1"/> +<circle cx="12" cy="1049.4" r="1"/> +<circle cx="8" cy="1050.4" r="1"/> +</g> +</g> +</svg> diff --git a/editor/icons/icon_gizmo_reflection_probe.svg b/editor/icons/icon_gizmo_reflection_probe.svg new file mode 100644 index 0000000000..6d80e73b8c --- /dev/null +++ b/editor/icons/icon_gizmo_reflection_probe.svg @@ -0,0 +1,5 @@ +<svg width="128" height="128" version="1.1" viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg"> +<g transform="translate(0 -924.36)"> +<path transform="translate(0 924.36)" d="m12 8a4.0004 4.0004 0 0 0 -4 4v24h8v-20h96v8h8v-12a4.0004 4.0004 0 0 0 -4 -4h-104zm76 28a4 4 0 0 0 -4 4 4 4 0 0 0 4 4h18.732l-42.957 50.119-44.947-44.947-5.6562 5.6582 48 48a4.0004 4.0004 0 0 0 5.8652 -0.22656l44.963-52.457v17.854a4 4 0 0 0 4 4 4 4 0 0 0 4 -4v-28a4.0004 4.0004 0 0 0 -4 -4h-28zm-80 52v28a4.0004 4.0004 0 0 0 4 4h104a4.0004 4.0004 0 0 0 4 -4v-28h-8v24h-96v-24h-8z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#f7f5cf" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="filter-blend-mode:normal;filter-gaussianBlur-deviation:0;font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/> +</g> +</svg> diff --git a/editor/icons/icon_gizmo_spatial_sample_player.svg b/editor/icons/icon_gizmo_spatial_sample_player.svg index d40fe230ac..7dbb4744be 100644 --- a/editor/icons/icon_gizmo_spatial_sample_player.svg +++ b/editor/icons/icon_gizmo_spatial_sample_player.svg @@ -1,5 +1,5 @@ <svg width="128" height="128" version="1.1" viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg"> <g transform="translate(0 -924.36)"> -<path transform="translate(0 924.36)" d="m63.883 12.004a4.0004 4.0004 0 0 0 -2.7109 1.168l-30.828 30.83h-14.344a4.0004 4.0004 0 0 0 -4 4v32a4.0004 4.0004 0 0 0 4 4h14.344l30.828 30.828a4.0004 4.0004 0 0 0 6.8281 -2.8281v-96.002a4.0004 4.0004 0 0 0 -4.1172 -3.9961zm46.117 5.9961a6 6 0 0 0 -6 6v80a6 6 0 0 0 6 6 6 6 0 0 0 6 -6v-80a6 6 0 0 0 -6 -6zm-24 24a6 6 0 0 0 -6 6v32h0.34961a6 6 0 0 0 5.6504 4 6 6 0 0 0 5.6484 -4h0.35156v-32a6 6 0 0 0 -6 -6z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#f7f5cf" fill-rule="evenodd" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/> +<path transform="translate(0 924.36)" d="m63.883 12.004c-1.0195 0.0295-1.9892 0.4473-2.7109 1.168l-30.828 30.83h-14.344c-2.209 2.21e-4 -3.9998 1.791-4 4v32c2.21e-4 2.209 1.791 3.9998 4 4h14.344l30.828 30.828c2.52 2.5182 6.8267 0.73442 6.8281-2.8281v-96.002c-0.0015-2.2541-1.8641-4.0619-4.1172-3.9961zm48.117 3.9961a4 4 0 0 0 -4 4v88a4 4 0 0 0 4 4 4 4 0 0 0 4 -4v-88a4 4 0 0 0 -4 -4zm-24 24a4 4 0 0 0 -4 4v40a4 4 0 0 0 4 4 4 4 0 0 0 4 -4v-40a4 4 0 0 0 -4 -4z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#f7f5cf" fill-rule="evenodd" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/> </g> </svg> diff --git a/editor/icons/icon_gizmo_spot_light.svg b/editor/icons/icon_gizmo_spot_light.svg new file mode 100644 index 0000000000..9b4ddadd17 --- /dev/null +++ b/editor/icons/icon_gizmo_spot_light.svg @@ -0,0 +1,5 @@ +<svg width="128" height="128" version="1.1" viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg"> +<g transform="translate(0 -924.36)"> +<path transform="translate(0 924.36)" d="m52 8c-4.432 0-8 3.568-8 8v12 16.875a40 36 0 0 0 -20 31.125h28a12 12 0 0 0 12 12 12 12 0 0 0 12 -12h28a40 36 0 0 0 -20 -31.141v-20.859-8c0-4.432-3.568-8-8-8h-24zm-11.969 78.006c-0.76793-0.053681-1.5596 0.1138-2.2793 0.5293l-10.393 6c-1.9191 1.108-2.5728 3.5457-1.4648 5.4648s3.5457 2.5728 5.4648 1.4648l10.393-6c1.9191-1.108 2.5709-3.5457 1.4629-5.4648-0.6925-1.1994-1.9037-1.9047-3.1836-1.9941zm47.938 0c-1.2799 0.08947-2.4911 0.7947-3.1836 1.9941-1.108 1.9191-0.45622 4.3568 1.4629 5.4648l10.393 6c1.9191 1.108 4.3568 0.45427 5.4648-1.4648s0.45427-4.3568-1.4648-5.4648l-10.393-6c-0.71967-0.4155-1.5114-0.58298-2.2793-0.5293zm-23.969 13.994c-2.216 0-4 1.784-4 4v12c0 2.216 1.784 4 4 4s4-1.784 4-4v-12c0-2.216-1.784-4-4-4z" fill="#f7f5cf" stroke-linecap="round" stroke-linejoin="round" stroke-width="2.1082"/> +</g> +</svg> diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp index 1c42bcef8a..2f03e72851 100644 --- a/editor/import/editor_scene_importer_gltf.cpp +++ b/editor/import/editor_scene_importer_gltf.cpp @@ -1216,7 +1216,7 @@ Error EditorSceneImporterGLTF::_parse_materials(GLTFState &state) { if (bct.has("index")) { Ref<Texture> t = _get_texture(state, bct["index"]); material->set_texture(SpatialMaterial::TEXTURE_METALLIC, t); - material->set_metallic_texture_channel(SpatialMaterial::TEXTURE_CHANNEL_RED); + material->set_metallic_texture_channel(SpatialMaterial::TEXTURE_CHANNEL_BLUE); material->set_texture(SpatialMaterial::TEXTURE_ROUGHNESS, t); material->set_roughness_texture_channel(SpatialMaterial::TEXTURE_CHANNEL_GREEN); if (!mr.has("metallicFactor")) { @@ -1243,6 +1243,7 @@ Error EditorSceneImporterGLTF::_parse_materials(GLTFState &state) { Dictionary bct = d["occlusionTexture"]; if (bct.has("index")) { material->set_texture(SpatialMaterial::TEXTURE_AMBIENT_OCCLUSION, _get_texture(state, bct["index"])); + material->set_ao_texture_channel(SpatialMaterial::TEXTURE_CHANNEL_RED); material->set_feature(SpatialMaterial::FEATURE_AMBIENT_OCCLUSION, true); } } diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index 88158d4b20..d04184f055 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -402,6 +402,11 @@ bool Polygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) { cpoint = canvas_item_editor->snap_point(cpoint); edited_point_pos = node->get_global_transform().affine_inverse().xform(cpoint); + Vector<Vector2> poly = Variant(node->get_polygon()); + ERR_FAIL_INDEX_V(edited_point, poly.size(), false); + poly[edited_point] = edited_point_pos - node->get_offset(); + node->set_polygon(Variant(poly)); + canvas_item_editor->get_viewport_control()->update(); } } @@ -425,6 +430,23 @@ void Polygon2DEditor::_canvas_draw() { Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); Ref<Texture> handle = get_icon("EditorHandle", "EditorIcons"); + if (edited_point >= 0 && EDITOR_DEF("editors/poly_editor/show_previous_outline", true)) { + + const Color col = node->get_color().contrasted(); + const int n = pre_move_edit.size(); + for (int i = 0; i < n; i++) { + + Vector2 p, p2; + p = pre_move_edit[i] + node->get_offset(); + p2 = pre_move_edit[(i + 1) % n] + node->get_offset(); + + Vector2 point = xform.xform(p); + Vector2 next_point = xform.xform(p2); + + vpc->draw_line(point, next_point, col, 2); + } + } + for (int i = 0; i < poly.size(); i++) { Vector2 p, p2; diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index 58ac5bc561..94fce45733 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -866,6 +866,12 @@ void ProjectSettingsEditor::_save() { message->popup_centered(Size2(300, 100) * EDSCALE); } +void ProjectSettingsEditor::_settings_prop_edited(const String &p_name) { + + // Method needed to discard the mandatory argument of the property_edited signal + _settings_changed(); +} + void ProjectSettingsEditor::_settings_changed() { timer->start(); @@ -1334,6 +1340,7 @@ void ProjectSettingsEditor::_bind_methods() { ClassDB::bind_method(D_METHOD("_add_item"), &ProjectSettingsEditor::_add_item, DEFVAL(Variant())); ClassDB::bind_method(D_METHOD("_device_input_add"), &ProjectSettingsEditor::_device_input_add); ClassDB::bind_method(D_METHOD("_press_a_key_confirm"), &ProjectSettingsEditor::_press_a_key_confirm); + ClassDB::bind_method(D_METHOD("_settings_prop_edited"), &ProjectSettingsEditor::_settings_prop_edited); ClassDB::bind_method(D_METHOD("_copy_to_platform"), &ProjectSettingsEditor::_copy_to_platform); ClassDB::bind_method(D_METHOD("_update_translations"), &ProjectSettingsEditor::_update_translations); ClassDB::bind_method(D_METHOD("_translation_delete"), &ProjectSettingsEditor::_translation_delete); @@ -1448,7 +1455,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { globals_editor->register_search_box(search_box); globals_editor->get_property_editor()->get_scene_tree()->connect("cell_selected", this, "_item_selected"); globals_editor->get_property_editor()->connect("property_toggled", this, "_item_checked", varray(), CONNECT_DEFERRED); - globals_editor->get_property_editor()->connect("property_edited", this, "_settings_changed"); + globals_editor->get_property_editor()->connect("property_edited", this, "_settings_prop_edited"); Button *del = memnew(Button); hbc->add_child(del); diff --git a/editor/project_settings_editor.h b/editor/project_settings_editor.h index c8c5e3265b..e4e2345692 100644 --- a/editor/project_settings_editor.h +++ b/editor/project_settings_editor.h @@ -121,6 +121,7 @@ class ProjectSettingsEditor : public AcceptDialog { void _press_a_key_confirm(); void _show_last_added(const Ref<InputEvent> &p_event, const String &p_name); + void _settings_prop_edited(const String &p_name); void _settings_changed(); void _copy_to_platform(int p_which); diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp index fb5143b486..722f651959 100644 --- a/editor/spatial_editor_gizmos.cpp +++ b/editor/spatial_editor_gizmos.cpp @@ -36,6 +36,7 @@ #include "scene/resources/capsule_shape.h" #include "scene/resources/convex_polygon_shape.h" #include "scene/resources/plane_shape.h" +#include "scene/resources/primitive_meshes.h" #include "scene/resources/ray_shape.h" #include "scene/resources/sphere_shape.h" #include "scene/resources/surface_tool.h" @@ -130,9 +131,9 @@ void EditorSpatialGizmo::add_lines(const Vector<Vector3> &p_lines, const Ref<Mat PoolVector<Color>::Write w = color.write(); for (int i = 0; i < p_lines.size(); i++) { if (is_selected()) - w[i] = Color(1, 1, 1, 0.6); + w[i] = Color(1, 1, 1, 0.8); else - w[i] = Color(1, 1, 1, 0.25); + w[i] = Color(1, 1, 1, 0.2); } } @@ -175,10 +176,10 @@ void EditorSpatialGizmo::add_unscaled_billboard(const Ref<Material> &p_material, vs.push_back(Vector3(p_scale, -p_scale, 0)); vs.push_back(Vector3(-p_scale, -p_scale, 0)); - uv.push_back(Vector2(1, 0)); uv.push_back(Vector2(0, 0)); - uv.push_back(Vector2(0, 1)); + uv.push_back(Vector2(1, 0)); uv.push_back(Vector2(1, 1)); + uv.push_back(Vector2(0, 1)); Ref<ArrayMesh> mesh = memnew(ArrayMesh); Array a; @@ -296,6 +297,15 @@ void EditorSpatialGizmo::add_handles(const Vector<Vector3> &p_handles, bool p_bi } } +void EditorSpatialGizmo::add_solid_box(Ref<Material> &p_material, Vector3 size) { + CubeMesh cubem; + cubem.set_size(size); + Ref<ArrayMesh> m = memnew(ArrayMesh); + m->add_surface_from_arrays(cubem.surface_get_primitive_type(0), cubem.surface_get_arrays(0)); + m->surface_set_material(0, p_material); + add_mesh(m); +} + void EditorSpatialGizmo::set_spatial_node(Spatial *p_node) { ERR_FAIL_NULL(p_node); @@ -540,8 +550,9 @@ Ref<SpatialMaterial> EditorSpatialGizmo::create_material(const String &p_name, c if (!is_editable()) { color = EDITOR_GET("editors/3d_gizmos/gizmo_colors/instanced"); - } else if (!is_selected()) { - color.a *= 0.5; + } + if (!is_selected()) { + color.a *= 0.3; } Ref<SpatialMaterial> line_material; @@ -587,7 +598,7 @@ Ref<SpatialMaterial> EditorSpatialGizmo::create_icon_material(const String &p_na if (!is_editable()) { color = EDITOR_GET("editors/3d_gizmos/gizmo_colors/instanced"); } else if (!is_selected()) { - color.a *= 0.5; + color.a *= 0.3; } Ref<SpatialMaterial> icon; @@ -770,34 +781,32 @@ void LightSpatialGizmo::redraw() { Ref<Material> material = create_material("light_directional_material", gizmo_color); Ref<Material> icon = create_icon_material("light_directional_icon", SpatialEditor::get_singleton()->get_icon("GizmoDirectionalLight", "EditorIcons")); - const int arrow_points = 5; + const int arrow_points = 7; + const float arrow_length = 1.5; + Vector3 arrow[arrow_points] = { - Vector3(0, 0, 2), - Vector3(1, 1, 2), - Vector3(1, 1, -1), - Vector3(2, 2, -1), - Vector3(0, 0, -3) + Vector3(0, 0, -1), + Vector3(0, 0.8, 0), + Vector3(0, 0.3, 0), + Vector3(0, 0.3, arrow_length), + Vector3(0, -0.3, arrow_length), + Vector3(0, -0.3, 0), + Vector3(0, -0.8, 0) }; - int arrow_sides = 4; + int arrow_sides = 2; Vector<Vector3> lines; for (int i = 0; i < arrow_sides; i++) { + for (int j = 0; j < arrow_points; j++) { + Basis ma(Vector3(0, 0, 1), Math_PI * i / arrow_sides); - Basis ma(Vector3(0, 0, 1), Math_PI * 2 * float(i) / arrow_sides); - Basis mb(Vector3(0, 0, 1), Math_PI * 2 * float(i + 1) / arrow_sides); - - for (int j = 1; j < arrow_points - 1; j++) { + Vector3 v1 = arrow[j] - Vector3(0, 0, arrow_length); + Vector3 v2 = arrow[(j + 1) % arrow_points] - Vector3(0, 0, arrow_length); - if (j != 2) { - lines.push_back(ma.xform(arrow[j])); - lines.push_back(ma.xform(arrow[j + 1])); - } - if (j < arrow_points - 1) { - lines.push_back(ma.xform(arrow[j])); - lines.push_back(mb.xform(arrow[j])); - } + lines.push_back(ma.xform(v1)); + lines.push_back(ma.xform(v2)); } } @@ -846,7 +855,7 @@ void LightSpatialGizmo::redraw() { if (Object::cast_to<SpotLight>(light)) { Ref<Material> material = create_material("light_spot_material", gizmo_color, true); - Ref<Material> icon = create_icon_material("light_spot_icon", SpatialEditor::get_singleton()->get_icon("GizmoLight", "EditorIcons")); + Ref<Material> icon = create_icon_material("light_spot_icon", SpatialEditor::get_singleton()->get_icon("GizmoSpotLight", "EditorIcons")); clear(); @@ -1136,6 +1145,7 @@ void CameraSpatialGizmo::redraw() { Color gizmo_color = EDITOR_GET("editors/3d_gizmos/gizmo_colors/camera"); Ref<Material> material = create_material("camera_material", gizmo_color); + Ref<Material> icon = create_icon_material("camera_icon", SpatialEditor::get_singleton()->get_icon("GizmoCamera", "EditorIcons")); switch (camera->get_projection()) { @@ -1206,6 +1216,7 @@ void CameraSpatialGizmo::redraw() { add_lines(lines, material); add_collision_segments(lines); + add_unscaled_billboard(icon, 0.05); add_handles(handles); } @@ -2331,10 +2342,20 @@ void ParticlesGizmo::redraw() { Color gizmo_color = EDITOR_GET("editors/3d_gizmos/gizmo_colors/particles"); Ref<Material> material = create_material("particles_material", gizmo_color); + Ref<Material> icon = create_icon_material("particles_icon", SpatialEditor::get_singleton()->get_icon("GizmoParticles", "EditorIcons")); add_lines(lines, material); add_collision_segments(lines); + + if (is_selected()) { + + gizmo_color.a = 0.1; + Ref<Material> solid_material = create_material("particles_solid_material", gizmo_color); + add_solid_box(solid_material, aabb.get_size()); + } + //add_unscaled_billboard(SpatialEditorGizmos::singleton->visi,0.05); + add_unscaled_billboard(icon, 0.05); add_handles(handles); } ParticlesGizmo::ParticlesGizmo(Particles *p_particles) { @@ -2480,6 +2501,7 @@ void ReflectionProbeGizmo::redraw() { Color gizmo_color = EDITOR_GET("editors/3d_gizmos/gizmo_colors/reflection_probe"); Ref<Material> material = create_material("reflection_probe_material", gizmo_color); + Ref<Material> icon = create_icon_material("reflection_probe_icon", SpatialEditor::get_singleton()->get_icon("GizmoReflectionProbe", "EditorIcons")); Color gizmo_color_internal = gizmo_color; gizmo_color_internal.a = 0.5; @@ -2487,7 +2509,16 @@ void ReflectionProbeGizmo::redraw() { add_lines(lines, material); add_lines(internal_lines, material_internal); + + if (is_selected()) { + + gizmo_color.a = 0.1; + Ref<Material> solid_material = create_material("reflection_probe_solid_material", gizmo_color); + add_solid_box(solid_material, probe->get_extents() * 2.0); + } + //add_unscaled_billboard(SpatialEditorGizmos::singleton->visi,0.05); + add_unscaled_billboard(icon, 0.05); add_collision_segments(lines); add_handles(handles); } @@ -2561,6 +2592,7 @@ void GIProbeGizmo::redraw() { Color gizmo_color = EDITOR_GET("editors/3d_gizmos/gizmo_colors/gi_probe"); Ref<Material> material = create_material("gi_probe_material", gizmo_color); + Ref<Material> icon = create_icon_material("gi_probe_icon", SpatialEditor::get_singleton()->get_icon("GizmoGIProbe", "EditorIcons")); Color gizmo_color_internal = gizmo_color; gizmo_color_internal.a = 0.1; Ref<Material> material_internal = create_material("gi_probe_internal_material", gizmo_color_internal); @@ -2639,6 +2671,14 @@ void GIProbeGizmo::redraw() { handles.push_back(ax); } + if (is_selected()) { + + gizmo_color.a = 0.1; + Ref<Material> solid_material = create_material("gi_probe_solid_material", gizmo_color); + add_solid_box(solid_material, aabb.get_size()); + } + + add_unscaled_billboard(icon, 0.05); add_handles(handles); } GIProbeGizmo::GIProbeGizmo(GIProbe *p_probe) { diff --git a/editor/spatial_editor_gizmos.h b/editor/spatial_editor_gizmos.h index a7c7497763..d63a804055 100644 --- a/editor/spatial_editor_gizmos.h +++ b/editor/spatial_editor_gizmos.h @@ -102,6 +102,7 @@ protected: void add_collision_triangles(const Ref<TriangleMesh> &p_tmesh); void add_unscaled_billboard(const Ref<Material> &p_material, float p_scale = 1); void add_handles(const Vector<Vector3> &p_handles, bool p_billboard = false, bool p_secondary = false); + void add_solid_box(Ref<Material> &p_material, Vector3 size); void set_spatial_node(Spatial *p_node); |