summaryrefslogtreecommitdiff
path: root/editor/import
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2022-04-19 13:27:18 +0300
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2022-04-22 12:08:46 +0300
commitbe611c1c0592d4aaa9c58f227a9c33301acd544b (patch)
treec304cf5c4fe0ebd33a4f361f3c1b10c5b74f1da1 /editor/import
parentf4b0c7a1ea8d86c1dfd96478ca12ad1360903d9d (diff)
Implement Label3D node.
Add "generate_mipmap" font import option. Add some missing features to the Sprite3D. Move BiDi override code from Control to TextServer. Add functions to access TextServer font cache textures. Add MSDF related flags and shader to the standard material. Change standard material cache to use HashMap instead of Vector.
Diffstat (limited to 'editor/import')
-rw-r--r--editor/import/dynamic_font_import_settings.cpp6
-rw-r--r--editor/import/resource_importer_dynamic_font.cpp3
-rw-r--r--editor/import/resource_importer_imagefont.cpp1
3 files changed, 10 insertions, 0 deletions
diff --git a/editor/import/dynamic_font_import_settings.cpp b/editor/import/dynamic_font_import_settings.cpp
index 20349e8ccb..b72530f1e8 100644
--- a/editor/import/dynamic_font_import_settings.cpp
+++ b/editor/import/dynamic_font_import_settings.cpp
@@ -458,6 +458,10 @@ void DynamicFontImportSettings::_main_prop_changed(const String &p_edited_proper
if (font_preview->get_data_count() > 0) {
font_preview->get_data(0)->set_antialiased(import_settings_data->get("antialiased"));
}
+ } else if (p_edited_property == "generate_mipmaps") {
+ if (font_preview->get_data_count() > 0) {
+ font_preview->get_data(0)->set_generate_mipmaps(import_settings_data->get("generate_mipmaps"));
+ }
} else if (p_edited_property == "multichannel_signed_distance_field") {
if (font_preview->get_data_count() > 0) {
font_preview->get_data(0)->set_multichannel_signed_distance_field(import_settings_data->get("multichannel_signed_distance_field"));
@@ -926,6 +930,7 @@ void DynamicFontImportSettings::_re_import() {
Map<StringName, Variant> main_settings;
main_settings["antialiased"] = import_settings_data->get("antialiased");
+ main_settings["generate_mipmaps"] = import_settings_data->get("generate_mipmaps");
main_settings["multichannel_signed_distance_field"] = import_settings_data->get("multichannel_signed_distance_field");
main_settings["msdf_pixel_range"] = import_settings_data->get("msdf_pixel_range");
main_settings["msdf_size"] = import_settings_data->get("msdf_size");
@@ -1340,6 +1345,7 @@ DynamicFontImportSettings::DynamicFontImportSettings() {
singleton = this;
options_general.push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::BOOL, "antialiased"), true));
+ options_general.push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::BOOL, "generate_mipmaps"), false));
options_general.push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::BOOL, "multichannel_signed_distance_field", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), true));
options_general.push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::INT, "msdf_pixel_range", PROPERTY_HINT_RANGE, "1,100,1"), 8));
options_general.push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::INT, "msdf_size", PROPERTY_HINT_RANGE, "1,250,1"), 48));
diff --git a/editor/import/resource_importer_dynamic_font.cpp b/editor/import/resource_importer_dynamic_font.cpp
index a7f6d09aed..2dc24c9d44 100644
--- a/editor/import/resource_importer_dynamic_font.cpp
+++ b/editor/import/resource_importer_dynamic_font.cpp
@@ -102,6 +102,7 @@ void ResourceImporterDynamicFont::get_import_options(const String &p_path, List<
bool msdf = p_preset == PRESET_MSDF;
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "antialiased"), true));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "generate_mipmaps"), false));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "multichannel_signed_distance_field", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), (msdf) ? true : false));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "msdf_pixel_range", PROPERTY_HINT_RANGE, "1,100,1"), 8));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "msdf_size", PROPERTY_HINT_RANGE, "1,250,1"), 48));
@@ -179,6 +180,7 @@ Error ResourceImporterDynamicFont::import(const String &p_source_file, const Str
print_verbose("Importing dynamic font from: " + p_source_file);
bool antialiased = p_options["antialiased"];
+ bool generate_mipmaps = p_options["generate_mipmaps"];
bool msdf = p_options["multichannel_signed_distance_field"];
int px_range = p_options["msdf_pixel_range"];
int px_size = p_options["msdf_size"];
@@ -199,6 +201,7 @@ Error ResourceImporterDynamicFont::import(const String &p_source_file, const Str
font.instantiate();
font->set_data(data);
font->set_antialiased(antialiased);
+ font->set_generate_mipmaps(generate_mipmaps);
font->set_multichannel_signed_distance_field(msdf);
font->set_msdf_pixel_range(px_range);
font->set_msdf_size(px_size);
diff --git a/editor/import/resource_importer_imagefont.cpp b/editor/import/resource_importer_imagefont.cpp
index 1338cf03a8..2b67a171cc 100644
--- a/editor/import/resource_importer_imagefont.cpp
+++ b/editor/import/resource_importer_imagefont.cpp
@@ -96,6 +96,7 @@ Error ResourceImporterImageFont::import(const String &p_source_file, const Strin
Ref<FontData> font;
font.instantiate();
font->set_antialiased(false);
+ font->set_generate_mipmaps(false);
font->set_multichannel_signed_distance_field(false);
font->set_fixed_size(base_size);
font->set_subpixel_positioning(TextServer::SUBPIXEL_POSITIONING_DISABLED);