diff options
27 files changed, 234 insertions, 249 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index c376efca34..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(); @@ -2183,14 +2225,19 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { update_menu->get_popup()->set_item_checked(0, true); update_menu->get_popup()->set_item_checked(1, false); OS::get_singleton()->set_low_processor_usage_mode(false); - EditorSettings::get_singleton()->set_project_metadata("editor_options", "update_mode", SETTINGS_UPDATE_ALWAYS); + EditorSettings::get_singleton()->set_project_metadata("editor_options", "update_always", true); + + current_option = -1; + accept->get_ok()->set_text(TTR("I see..")); + accept->set_text(TTR("This option is deprecated. Situations where refresh must be forced are now considered a bug. Please report.")); + accept->popup_centered_minsize(); } break; case SETTINGS_UPDATE_CHANGES: { update_menu->get_popup()->set_item_checked(0, false); update_menu->get_popup()->set_item_checked(1, true); OS::get_singleton()->set_low_processor_usage_mode(true); - EditorSettings::get_singleton()->set_project_metadata("editor_options", "update_mode", SETTINGS_UPDATE_CHANGES); + EditorSettings::get_singleton()->set_project_metadata("editor_options", "update_always", false); } break; case SETTINGS_UPDATE_SPINNER_HIDE: { @@ -2778,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) { @@ -2841,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); @@ -4950,9 +4992,9 @@ EditorNode::EditorNode() { p->add_check_item(TTR("Update Changes"), SETTINGS_UPDATE_CHANGES); p->add_separator(); p->add_check_item(TTR("Disable Update Spinner"), SETTINGS_UPDATE_SPINNER_HIDE); - int update_mode = EditorSettings::get_singleton()->get_project_metadata("editor_options", "update_mode", SETTINGS_UPDATE_CHANGES); + int update_always = EditorSettings::get_singleton()->get_project_metadata("editor_options", "update_always", false); int hide_spinner = EditorSettings::get_singleton()->get_project_metadata("editor_options", "update_spinner_hide", false); - _menu_option(update_mode); + _menu_option(update_always ? SETTINGS_UPDATE_ALWAYS : SETTINGS_UPDATE_CHANGES); if (hide_spinner) { _menu_option(SETTINGS_UPDATE_SPINNER_HIDE); } 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_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_import_collada.cpp b/editor/import/editor_import_collada.cpp index 86482dad5a..b1991d755b 100644 --- a/editor/import/editor_import_collada.cpp +++ b/editor/import/editor_import_collada.cpp @@ -41,6 +41,7 @@ #include "scene/animation/animation_player.h" #include "scene/resources/animation.h" #include "scene/resources/packed_scene.h" +#include "scene/resources/surface_tool.h" #include <iostream> @@ -868,7 +869,6 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me int normal_pos = (normal_src->stride ? normal_src->stride : 3) * p.indices[src + normal_ofs]; ERR_FAIL_INDEX_V(normal_pos, normal_src->array.size(), ERR_INVALID_DATA); vertex.normal = Vector3(normal_src->array[normal_pos + 0], normal_src->array[normal_pos + 1], normal_src->array[normal_pos + 2]); - vertex.normal.snap(Vector3(0.001, 0.001, 0.001)); if (tangent_src && binormal_src) { @@ -991,18 +991,6 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me } } - PoolVector<int> index_array; - index_array.resize(indices_list.size()); - PoolVector<int>::Write index_arrayw = index_array.write(); - - int iidx = 0; - for (List<int>::Element *F = indices_list.front(); F; F = F->next()) { - - index_arrayw[iidx++] = F->get(); - } - - index_arrayw = PoolVector<int>::Write(); - /*****************/ /* MAKE SURFACES */ /*****************/ @@ -1011,9 +999,6 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me Ref<SpatialMaterial> material; - //find material - Mesh::PrimitiveType primitive = Mesh::PRIMITIVE_TRIANGLES; - { if (p_material_map.has(p.material)) { @@ -1031,212 +1016,73 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me } } - PoolVector<Vector3> final_vertex_array; - PoolVector<Vector3> final_normal_array; - PoolVector<float> final_tangent_array; - PoolVector<Color> final_color_array; - PoolVector<Vector3> final_uv_array; - PoolVector<Vector3> final_uv2_array; - PoolVector<int> final_bone_array; - PoolVector<float> final_weight_array; - - uint32_t final_format = 0; + Ref<SurfaceTool> surftool; + surftool.instance(); + surftool->begin(Mesh::PRIMITIVE_TRIANGLES); - //create format - final_format = Mesh::ARRAY_FORMAT_VERTEX | Mesh::ARRAY_FORMAT_INDEX; - - if (normal_src) { - final_format |= Mesh::ARRAY_FORMAT_NORMAL; - if (uv_src && binormal_src && tangent_src) { - final_format |= Mesh::ARRAY_FORMAT_TANGENT; + for (int k = 0; k < vertex_array.size(); k++) { + if (normal_src) { + surftool->add_normal(vertex_array[k].normal); + if (binormal_src && tangent_src) { + surftool->add_tangent(vertex_array[k].tangent); + } } - } - - if (color_src) - final_format |= Mesh::ARRAY_FORMAT_COLOR; - if (uv_src) - final_format |= Mesh::ARRAY_FORMAT_TEX_UV; - if (uv2_src) - final_format |= Mesh::ARRAY_FORMAT_TEX_UV2; - - if (has_weights) { - final_format |= Mesh::ARRAY_FORMAT_WEIGHTS; - final_format |= Mesh::ARRAY_FORMAT_BONES; - } - - //set arrays - - int vlen = vertex_array.size(); - { //vertices - - PoolVector<Vector3> varray; - varray.resize(vertex_array.size()); - - PoolVector<Vector3>::Write varrayw = varray.write(); - - for (int k = 0; k < vlen; k++) - varrayw[k] = vertex_array[k].vertex; - - varrayw = PoolVector<Vector3>::Write(); - final_vertex_array = varray; - } - - if (uv_src) { //compute uv first, may be needed for computing tangent/bionrmal - PoolVector<Vector3> uvarray; - uvarray.resize(vertex_array.size()); - PoolVector<Vector3>::Write uvarrayw = uvarray.write(); - - for (int k = 0; k < vlen; k++) { - uvarrayw[k] = vertex_array[k].uv; + if (uv_src) { + surftool->add_uv(Vector2(vertex_array[k].uv.x, vertex_array[k].uv.y)); } - - uvarrayw = PoolVector<Vector3>::Write(); - final_uv_array = uvarray; - } - - if (uv2_src) { //compute uv first, may be needed for computing tangent/bionrmal - PoolVector<Vector3> uv2array; - uv2array.resize(vertex_array.size()); - PoolVector<Vector3>::Write uv2arrayw = uv2array.write(); - - for (int k = 0; k < vlen; k++) { - uv2arrayw[k] = vertex_array[k].uv2; + if (uv2_src) { + surftool->add_uv2(Vector2(vertex_array[k].uv2.x, vertex_array[k].uv2.y)); } - - uv2arrayw = PoolVector<Vector3>::Write(); - final_uv2_array = uv2array; - } - - if (normal_src) { - PoolVector<Vector3> narray; - narray.resize(vertex_array.size()); - PoolVector<Vector3>::Write narrayw = narray.write(); - - for (int k = 0; k < vlen; k++) { - narrayw[k] = vertex_array[k].normal; + if (color_src) { + surftool->add_color(vertex_array[k].color); } - narrayw = PoolVector<Vector3>::Write(); - final_normal_array = narray; - - /* - PoolVector<Vector3> altnaray; - _generate_normals(index_array,final_vertex_array,altnaray); - - for(int i=0;i<altnaray.size();i++) - print_line(rtos(altnaray[i].dot(final_normal_array[i]))); - */ - - } else if (primitive == Mesh::PRIMITIVE_TRIANGLES) { - //generate normals (even if unused later) - - _generate_normals(index_array, final_vertex_array, final_normal_array); - if (OS::get_singleton()->is_stdout_verbose()) - print_line("Collada: Triangle mesh lacks normals, so normals were generated."); - final_format |= Mesh::ARRAY_FORMAT_NORMAL; - } - - if (final_normal_array.size() && uv_src && binormal_src && tangent_src && !force_make_tangents) { + if (has_weights) { + Vector<float> weights; + Vector<int> bones; + weights.resize(VS::ARRAY_WEIGHTS_SIZE); + bones.resize(VS::ARRAY_WEIGHTS_SIZE); + //float sum=0.0; + for (int l = 0; l < VS::ARRAY_WEIGHTS_SIZE; l++) { + if (l < vertex_array[k].weights.size()) { + weights[l] = vertex_array[k].weights[l].weight; + bones[l] = vertex_array[k].weights[l].bone_idx; + //sum += vertex_array[k].weights[l].weight; + } else { - PoolVector<real_t> tarray; - tarray.resize(vertex_array.size() * 4); - PoolVector<real_t>::Write tarrayw = tarray.write(); + weights[l] = 0; + bones[l] = 0; + } + } - for (int k = 0; k < vlen; k++) { - tarrayw[k * 4 + 0] = vertex_array[k].tangent.normal.x; - tarrayw[k * 4 + 1] = vertex_array[k].tangent.normal.y; - tarrayw[k * 4 + 2] = vertex_array[k].tangent.normal.z; - tarrayw[k * 4 + 3] = vertex_array[k].tangent.d; + surftool->add_bones(bones); + surftool->add_weights(weights); } - tarrayw = PoolVector<real_t>::Write(); - - final_tangent_array = tarray; - } else if (final_normal_array.size() && primitive == Mesh::PRIMITIVE_TRIANGLES && final_uv_array.size() && (force_make_tangents || (material.is_valid()))) { - //if this uses triangles, there are uvs and the material is using a normalmap, generate tangents and binormals, because they WILL be needed - //generate binormals/tangents - _generate_tangents_and_binormals(index_array, final_vertex_array, final_uv_array, final_normal_array, final_tangent_array); - final_format |= Mesh::ARRAY_FORMAT_TANGENT; - if (OS::get_singleton()->is_stdout_verbose()) - print_line("Collada: Triangle mesh lacks tangents (And normalmap was used), so tangents were generated."); + surftool->add_vertex(vertex_array[k].vertex); } - if (color_src) { - PoolVector<Color> colorarray; - colorarray.resize(vertex_array.size()); - PoolVector<Color>::Write colorarrayw = colorarray.write(); - - for (int k = 0; k < vlen; k++) { - colorarrayw[k] = vertex_array[k].color; - } - - colorarrayw = PoolVector<Color>::Write(); - - final_color_array = colorarray; + for (List<int>::Element *E = indices_list.front(); E; E = E->next()) { + surftool->add_index(E->get()); } - if (has_weights) { - PoolVector<float> weightarray; - PoolVector<int> bonearray; - - weightarray.resize(vertex_array.size() * 4); - PoolVector<float>::Write weightarrayw = weightarray.write(); - bonearray.resize(vertex_array.size() * 4); - PoolVector<int>::Write bonearrayw = bonearray.write(); - - for (int k = 0; k < vlen; k++) { - float sum = 0; - - for (int l = 0; l < VS::ARRAY_WEIGHTS_SIZE; l++) { - if (l < vertex_array[k].weights.size()) { - weightarrayw[k * VS::ARRAY_WEIGHTS_SIZE + l] = vertex_array[k].weights[l].weight; - sum += weightarrayw[k * VS::ARRAY_WEIGHTS_SIZE + l]; - bonearrayw[k * VS::ARRAY_WEIGHTS_SIZE + l] = int(vertex_array[k].weights[l].bone_idx); - //COLLADA_PRINT(itos(k)+": "+rtos(bonearrayw[k*VS::ARRAY_WEIGHTS_SIZE+l])+":"+rtos(weightarray[k*VS::ARRAY_WEIGHTS_SIZE+l])); - } else { - - weightarrayw[k * VS::ARRAY_WEIGHTS_SIZE + l] = 0; - bonearrayw[k * VS::ARRAY_WEIGHTS_SIZE + l] = 0; - } - } - /* - if (sum<0.8) - COLLADA_PRINT("ERROR SUMMING INDEX "+itos(k)+" had weights: "+itos(vertex_array[k].weights.size())); - */ - } + if (!normal_src) { + //should always be normals + surftool->generate_normals(); + } - weightarrayw = PoolVector<float>::Write(); - bonearrayw = PoolVector<int>::Write(); + if ((!binormal_src || !tangent_src) && normal_src && uv_src && force_make_tangents) { - final_weight_array = weightarray; - final_bone_array = bonearray; + surftool->generate_tangents(); } //////////////////////////// // FINALLY CREATE SUFRACE // //////////////////////////// - Array d; + Array d = surftool->commit_to_arrays(); d.resize(VS::ARRAY_MAX); - d[Mesh::ARRAY_INDEX] = index_array; - d[Mesh::ARRAY_VERTEX] = final_vertex_array; - - if (final_normal_array.size()) - d[Mesh::ARRAY_NORMAL] = final_normal_array; - if (final_tangent_array.size()) - d[Mesh::ARRAY_TANGENT] = final_tangent_array; - if (final_uv_array.size()) - d[Mesh::ARRAY_TEX_UV] = final_uv_array; - if (final_uv2_array.size()) - d[Mesh::ARRAY_TEX_UV2] = final_uv2_array; - if (final_color_array.size()) - d[Mesh::ARRAY_COLOR] = final_color_array; - if (final_weight_array.size()) - d[Mesh::ARRAY_WEIGHTS] = final_weight_array; - if (final_bone_array.size()) - d[Mesh::ARRAY_BONES] = final_bone_array; - Array mr; //////////////////////////// @@ -1249,10 +1095,10 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me Array a = p_morph_meshes[mi]->surface_get_arrays(surface); //add valid weight and bone arrays if they exist, TODO check if they are unique to shape (generally not) - if (final_weight_array.size()) - a[Mesh::ARRAY_WEIGHTS] = final_weight_array; - if (final_bone_array.size()) - a[Mesh::ARRAY_BONES] = final_bone_array; + if (has_weights) { + a[Mesh::ARRAY_WEIGHTS] = d[Mesh::ARRAY_WEIGHTS]; + a[Mesh::ARRAY_BONES] = d[Mesh::ARRAY_BONES]; + } a[Mesh::ARRAY_INDEX] = Variant(); //a.resize(Mesh::ARRAY_MAX); //no need for index diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp index be30369dfe..722f651959 100644 --- a/editor/spatial_editor_gizmos.cpp +++ b/editor/spatial_editor_gizmos.cpp @@ -176,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; @@ -855,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(); @@ -1145,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()) { @@ -1215,6 +1216,7 @@ void CameraSpatialGizmo::redraw() { add_lines(lines, material); add_collision_segments(lines); + add_unscaled_billboard(icon, 0.05); add_handles(handles); } @@ -2340,6 +2342,7 @@ 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); @@ -2352,6 +2355,7 @@ void ParticlesGizmo::redraw() { } //add_unscaled_billboard(SpatialEditorGizmos::singleton->visi,0.05); + add_unscaled_billboard(icon, 0.05); add_handles(handles); } ParticlesGizmo::ParticlesGizmo(Particles *p_particles) { @@ -2497,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; @@ -2513,6 +2518,7 @@ void ReflectionProbeGizmo::redraw() { } //add_unscaled_billboard(SpatialEditorGizmos::singleton->visi,0.05); + add_unscaled_billboard(icon, 0.05); add_collision_segments(lines); add_handles(handles); } @@ -2586,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); @@ -2671,6 +2678,7 @@ void GIProbeGizmo::redraw() { 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/main/main.cpp b/main/main.cpp index 00cb43b0a8..532b5277b5 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -69,7 +69,6 @@ #include "core/io/file_access_zip.h" #include "core/io/stream_peer_ssl.h" #include "core/io/stream_peer_tcp.h" -#include "core/os/thread.h" #include "main/input_default.h" #include "performance.h" #include "translation.h" @@ -886,7 +885,11 @@ error: return ERR_INVALID_PARAMETER; } -Error Main::setup2() { +Error Main::setup2(Thread::ID p_main_tid_override) { + + if (p_main_tid_override) { + Thread::_main_thread_id = p_main_tid_override; + } OS::get_singleton()->initialize(video_mode, video_driver_idx, audio_driver_idx); if (init_use_custom_pos) { diff --git a/main/main.h b/main/main.h index f8db0225bf..2c1d42a163 100644 --- a/main/main.h +++ b/main/main.h @@ -34,6 +34,7 @@ @author Juan Linietsky <reduzio@gmail.com> */ +#include "core/os/thread.h" #include "error_list.h" #include "typedefs.h" @@ -49,7 +50,7 @@ class Main { public: static Error setup(const char *execpath, int argc, char *argv[], bool p_second_phase = true); - static Error setup2(); + static Error setup2(Thread::ID p_main_tid_override = 0); static bool start(); static bool iteration(); static void cleanup(); diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index 0de2cf80ea..1b932f040e 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -155,7 +155,7 @@ void GridMap::_get_property_list(List<PropertyInfo> *p_list) const { p_list->push_back(PropertyInfo(Variant::OBJECT, "theme", PROPERTY_HINT_RESOURCE_TYPE, "MeshLibrary")); p_list->push_back(PropertyInfo(Variant::NIL, "Cell", PROPERTY_HINT_NONE, "cell_", PROPERTY_USAGE_GROUP)); - p_list->push_back(PropertyInfo(Variant::REAL, "cell_size", PROPERTY_HINT_RANGE, "0.01,16384,0.01")); + p_list->push_back(PropertyInfo(Variant::VECTOR3, "cell_size")); p_list->push_back(PropertyInfo(Variant::INT, "cell_octant_size", PROPERTY_HINT_RANGE, "1,1024,1")); p_list->push_back(PropertyInfo(Variant::BOOL, "cell_center_x")); p_list->push_back(PropertyInfo(Variant::BOOL, "cell_center_y")); @@ -184,6 +184,7 @@ Ref<MeshLibrary> GridMap::get_theme() const { void GridMap::set_cell_size(const Vector3 &p_size) { + ERR_FAIL_COND(p_size.x < 0.001 || p_size.y < 0.001 || p_size.z < 0.001); cell_size = p_size; _recreate_octant_data(); } diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index eff3a7178d..8b3a64bbe6 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -1073,11 +1073,7 @@ public: //export_temp ep.step("Exporting APK", 0); - bool use_adb_over_usb = bool(EDITOR_DEF("export/android/use_remote_debug_over_adb", true)); - - if (use_adb_over_usb) { - p_debug_flags |= DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST; - } + p_debug_flags |= DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST; String export_to = EditorSettings::get_singleton()->get_settings_path() + "/tmp/tmpexport.apk"; Error err = export_project(p_preset, true, export_to, p_debug_flags); @@ -1123,7 +1119,7 @@ public: return ERR_CANT_CREATE; } - if (use_adb_over_usb) { + if (p_debug_flags & DEBUG_FLAG_REMOTE_DEBUG) { args.clear(); args.push_back("-s"); @@ -1142,6 +1138,9 @@ public: OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv); print_line("Reverse result: " + itos(rv)); + } + + if (p_debug_flags & DEBUG_FLAG_DUMB_CLIENT) { int fs_port = EditorSettings::get_singleton()->get("filesystem/file_server/port"); @@ -1294,7 +1293,7 @@ public: bool export_arm = p_preset->get("architecture/arm"); bool export_arm64 = p_preset->get("architecture/arm64"); - bool use_32_fb = p_preset->get("screen/use_32_bits_view"); + bool use_32_fb = p_preset->get("graphics/32_bits_framebuffer"); bool immersive = p_preset->get("screen/immersive_mode"); bool _signed = p_preset->get("package/signed"); @@ -1724,7 +1723,6 @@ void register_android_exporter() { EDITOR_DEF("export/android/force_system_user", false); EDITOR_DEF("export/android/timestamping_authority_url", ""); - EDITOR_DEF("export/android/use_remote_debug_over_adb", false); EDITOR_DEF("export/android/shutdown_adb_on_exit", true); Ref<EditorExportAndroid> exporter = Ref<EditorExportAndroid>(memnew(EditorExportAndroid)); diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp index 9abaae0a75..06abe9d751 100644 --- a/platform/android/java_glue.cpp +++ b/platform/android/java_glue.cpp @@ -1002,7 +1002,9 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv *env, job ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("JavaClassWrapper", java_class_wrapper)); _initialize_java_modules(); - Main::setup2(); + // Since Godot is initialized on the UI thread, _main_thread_id was set to that thread's id, + // but for Godot purposes, the main thread is the one running the game loop + Main::setup2(Thread::get_caller_id()); ++step; suspend_mutex->unlock(); input_mutex->unlock(); diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp index 7342164841..bf89e704bc 100644 --- a/scene/resources/surface_tool.cpp +++ b/scene/resources/surface_tool.cpp @@ -691,6 +691,17 @@ void SurfaceTool::mikktGetTexCoord(const SMikkTSpaceContext *pContext, float fvT fvTexcOut[1] = v.y; //fvTexcOut[1]=1.0-v.y; } + +void SurfaceTool::mikktSetTSpaceDefault(const SMikkTSpaceContext *pContext, const float fvTangent[], const float fvBiTangent[], const float fMagS, const float fMagT, + const tbool bIsOrientationPreserving, const int iFace, const int iVert) { + + Vector<List<Vertex>::Element *> &varr = *((Vector<List<Vertex>::Element *> *)pContext->m_pUserData); + Vertex *vtx = &varr[iFace * 3 + iVert]->get(); + + vtx->tangent = Vector3(fvTangent[0], fvTangent[1], fvTangent[2]); + vtx->binormal = Vector3(fvBiTangent[0], fvBiTangent[1], fvBiTangent[2]); +} + void SurfaceTool::mikktSetTSpaceBasic(const SMikkTSpaceContext *pContext, const float fvTangent[], const float fSign, const int iFace, const int iVert) { Vector<List<Vertex>::Element *> &varr = *((Vector<List<Vertex>::Element *> *)pContext->m_pUserData); @@ -715,8 +726,8 @@ void SurfaceTool::generate_tangents() { mkif.m_getNumVerticesOfFace = mikktGetNumVerticesOfFace; mkif.m_getPosition = mikktGetPosition; mkif.m_getTexCoord = mikktGetTexCoord; - mkif.m_setTSpaceBasic = mikktSetTSpaceBasic; - mkif.m_setTSpace = NULL; + mkif.m_setTSpace = mikktSetTSpaceDefault; + mkif.m_setTSpaceBasic = NULL; SMikkTSpaceContext msc; msc.m_pInterface = &mkif; diff --git a/scene/resources/surface_tool.h b/scene/resources/surface_tool.h index 2a90c2743d..cdaac643de 100644 --- a/scene/resources/surface_tool.h +++ b/scene/resources/surface_tool.h @@ -90,6 +90,8 @@ private: static void mikktGetNormal(const SMikkTSpaceContext *pContext, float fvNormOut[], const int iFace, const int iVert); static void mikktGetTexCoord(const SMikkTSpaceContext *pContext, float fvTexcOut[], const int iFace, const int iVert); static void mikktSetTSpaceBasic(const SMikkTSpaceContext *pContext, const float fvTangent[], const float fSign, const int iFace, const int iVert); + static void mikktSetTSpaceDefault(const SMikkTSpaceContext *pContext, const float fvTangent[], const float fvBiTangent[], const float fMagS, const float fMagT, + const tbool bIsOrientationPreserving, const int iFace, const int iVert); protected: static void _bind_methods(); diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index 95ac876ec0..cd68c14de8 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -1473,9 +1473,10 @@ void VisualServerScene::_render_scene(const Transform p_cam_transform, const Cam //check shadow.. - if (light && p_shadow_atlas.is_valid() && VSG::storage->light_has_shadow(E->get()->base)) { - lights_with_shadow[directional_shadow_count++] = E->get(); - + if (light) { + if (p_shadow_atlas.is_valid() && VSG::storage->light_has_shadow(E->get()->base)) { + lights_with_shadow[directional_shadow_count++] = E->get(); + } //add to list directional_light_ptr[directional_light_count++] = light->instance; } |