From fa9f23b3ebad2a02dbbf0fb3dc85e3c5dc98fd95 Mon Sep 17 00:00:00 2001 From: luboslenco Date: Sun, 19 Jan 2025 20:35:39 +0100 Subject: [PATCH] Cleanup --- armorsculpt/sources/import_mesh.ts | 4 ++-- base/sources/box_export.ts | 2 +- base/sources/file.ts | 4 ++-- base/sources/import_arm.ts | 2 +- base/sources/import_asset.ts | 2 +- base/sources/import_font.ts | 2 +- base/sources/import_keymap.ts | 2 +- base/sources/import_mesh.ts | 4 ++-- base/sources/import_plugin.ts | 2 +- base/sources/import_texture.ts | 4 ++-- base/sources/import_theme.ts | 2 +- base/sources/project.ts | 2 +- base/sources/strings.ts | 12 ++++++------ base/tools/pad/sources/main.ts | 2 +- 14 files changed, 23 insertions(+), 23 deletions(-) diff --git a/armorsculpt/sources/import_mesh.ts b/armorsculpt/sources/import_mesh.ts index 26b5dd55..974657fe 100644 --- a/armorsculpt/sources/import_mesh.ts +++ b/armorsculpt/sources/import_mesh.ts @@ -4,7 +4,7 @@ let import_mesh_clear_layers: bool = true; function import_mesh_run(path: string, _clear_layers: bool = true, replace_existing: bool = true) { if (!path_is_mesh(path)) { if (!context_enable_import_plugin(path)) { - console_error(strings_error1()); + console_error(strings_unknown_asset_format()); return; } } @@ -133,7 +133,7 @@ function _import_mesh_make_mesh(mesh: raw_mesh_t) { function import_mesh_make_mesh(mesh: raw_mesh_t) { if (mesh == null || mesh.posa == null || mesh.nora == null || mesh.inda == null || mesh.posa.length == 0) { - console_error(strings_error3()); + console_error(strings_failed_to_read_mesh_data()); return; } diff --git a/base/sources/box_export.ts b/base/sources/box_export.ts index 0fe724c6..d103ab77 100644 --- a/base/sources/box_export.ts +++ b/base/sources/box_export.ts @@ -239,7 +239,7 @@ function box_export_tab_presets(ui: ui_t) { console_info(tr("Preset imported:") + " " + filename); } else { - console_error(strings_error1()); + console_error(strings_unknown_asset_format()); } }); } diff --git a/base/sources/file.ts b/base/sources/file.ts index e9bc4c23..2972c64e 100644 --- a/base/sources/file.ts +++ b/base/sources/file.ts @@ -194,7 +194,7 @@ function file_cache_cloud(path: string, done: (s: string)=>void) { file_download(url, dest, function (url: string) { let fccd: file_cache_cloud_data_t = map_get(_file_cache_cloud_map, url); if (!file_exists(fccd.dest)) { - console_error(strings_error5()); + console_error(strings_check_internet_connection()); fccd.done(null); return; } @@ -220,7 +220,7 @@ function file_init_cloud_bytes(done: ()=>void, append: string = "") { if (buffer == null) { let empty: string[] = []; map_set(file_cloud, "cloud", empty); - console_error(strings_error5()); + console_error(strings_check_internet_connection()); return; } let files: string[] = []; diff --git a/base/sources/import_arm.ts b/base/sources/import_arm.ts index 885846c6..61ae2452 100644 --- a/base/sources/import_arm.ts +++ b/base/sources/import_arm.ts @@ -627,7 +627,7 @@ function import_arm_run_swatches_from_project(project: project_format_t, path: s } function import_arm_make_pink(abs: string) { - console_error(strings_error2() + " " + abs); + console_error(strings_could_not_locate_texture() + " " + abs); let b: u8_array_t = u8_array_create(4); b[0] = 255; b[1] = 0; diff --git a/base/sources/import_asset.ts b/base/sources/import_asset.ts index 4b049fc8..2a6eab93 100644 --- a/base/sources/import_asset.ts +++ b/base/sources/import_asset.ts @@ -81,7 +81,7 @@ function import_asset_run(path: string, drop_x: f32 = -1.0, drop_y: f32 = -1.0, import_asset_run(path, drop_x, drop_y, show_box); } else { - console_error(strings_error1()); + console_error(strings_unknown_asset_format()); } } diff --git a/base/sources/import_font.ts b/base/sources/import_font.ts index 65dcccc7..3bf2fc96 100644 --- a/base/sources/import_font.ts +++ b/base/sources/import_font.ts @@ -3,7 +3,7 @@ function import_font_run(path: string) { for (let i: i32 = 0; i < project_fonts.length; ++i) { let f: slot_font_t = project_fonts[i]; if (f.file == path) { - console_info(strings_info0()); + console_info(strings_asset_already_imported()); return; } } diff --git a/base/sources/import_keymap.ts b/base/sources/import_keymap.ts index 6ec01452..86c39dba 100644 --- a/base/sources/import_keymap.ts +++ b/base/sources/import_keymap.ts @@ -1,7 +1,7 @@ function import_keymap_run(path: string) { if (!path_is_json(path)) { - console_error(strings_error1()); + console_error(strings_unknown_asset_format()); return; } diff --git a/base/sources/import_mesh.ts b/base/sources/import_mesh.ts index 1c88911b..193d6cd7 100644 --- a/base/sources/import_mesh.ts +++ b/base/sources/import_mesh.ts @@ -12,7 +12,7 @@ function import_mesh_run(path: string, replace_existing: bool = true) { if (!path_is_mesh(path)) { if (!context_enable_import_plugin(path)) { - console_error(strings_error1()); + console_error(strings_unknown_asset_format()); return; } } @@ -181,7 +181,7 @@ function import_mesh_first_unwrap_done(mesh: raw_mesh_t) { function import_mesh_make_mesh(mesh: raw_mesh_t) { if (mesh == null || mesh.posa == null || mesh.nora == null || mesh.inda == null || mesh.posa.length == 0) { - console_error(strings_error3()); + console_error(strings_failed_to_read_mesh_data()); return; } diff --git a/base/sources/import_plugin.ts b/base/sources/import_plugin.ts index 4a4eff99..6bbbab91 100644 --- a/base/sources/import_plugin.ts +++ b/base/sources/import_plugin.ts @@ -1,7 +1,7 @@ function import_plugin_run(path: string) { if (!path_is_plugin(path)) { - console_error(strings_error1()); + console_error(strings_unknown_asset_format()); return; } diff --git a/base/sources/import_texture.ts b/base/sources/import_texture.ts index 6e20ab0f..5dbfdf4c 100644 --- a/base/sources/import_texture.ts +++ b/base/sources/import_texture.ts @@ -7,7 +7,7 @@ type import_texture_data_t = { function import_texture_run(path: string, hdr_as_envmap: bool = true) { if (!path_is_texture(path)) { if (!context_enable_import_plugin(path)) { - console_error(strings_error1()); + console_error(strings_unknown_asset_format()); return; } } @@ -24,7 +24,7 @@ function import_texture_run(path: string, hdr_as_envmap: bool = true) { import_envmap_run(itd.path, itd.image); }, itd); } - console_info(strings_info0()); + console_info(strings_asset_already_imported()); return; } } diff --git a/base/sources/import_theme.ts b/base/sources/import_theme.ts index 60ca29ce..bbcd1eda 100644 --- a/base/sources/import_theme.ts +++ b/base/sources/import_theme.ts @@ -1,7 +1,7 @@ function import_theme_run(path: string) { if (!path_is_json(path)) { - console_error(strings_error1()); + console_error(strings_unknown_asset_format()); return; } diff --git a/base/sources/project.ts b/base/sources/project.ts index a7dba6af..87b0721b 100644 --- a/base/sources/project.ts +++ b/base/sources/project.ts @@ -41,7 +41,7 @@ let _project_scene_mesh_gc: scene_t; function project_open() { ui_files_show("arm", false, false, function (path: string) { if (!ends_with(path, ".arm")) { - console_error(strings_error0()); + console_error(strings_arm_file_expected()); return; } diff --git a/base/sources/strings.ts b/base/sources/strings.ts index 5ec30376..e5650456 100644 --- a/base/sources/strings.ts +++ b/base/sources/strings.ts @@ -1,25 +1,25 @@ -function strings_error0(): string { +function strings_arm_file_expected(): string { return tr("Error: .arm file expected"); } -function strings_error1(): string { +function strings_unknown_asset_format(): string { return tr("Error: Unknown asset format"); } -function strings_error2(): string { +function strings_could_not_locate_texture(): string { return tr("Error: Could not locate texture"); } -function strings_error3(): string { +function strings_failed_to_read_mesh_data(): string { return tr("Error: Failed to read mesh data"); } -function strings_error5(): string { +function strings_check_internet_connection(): string { return tr("Error: Check internet connection to access the cloud"); } -function strings_info0(): string { +function strings_asset_already_imported(): string { return tr("Info: Asset already imported"); } diff --git a/base/tools/pad/sources/main.ts b/base/tools/pad/sources/main.ts index 631cb70c..6f868e11 100644 --- a/base/tools/pad/sources/main.ts +++ b/base/tools/pad/sources/main.ts @@ -380,5 +380,5 @@ function on_text_hover() { //// type config_t = { server: string; }; let config_raw: config_t; -function strings_error5(): string { return ""; }; +function strings_check_internet_connection(): string { return ""; }; function console_error(s: string) { };