summaryrefslogtreecommitdiffstats
path: root/editor/import/scene_import_settings.cpp
diff options
context:
space:
mode:
authorkobewi <kobewi4e@gmail.com>2023-08-13 02:33:39 +0200
committerkobewi <kobewi4e@gmail.com>2023-09-03 19:58:18 +0200
commit6de34fde27f650f738a1e46992f1b783f2cf9e76 (patch)
treea1c1785f2c20e8874d622aae75ff70be43192ece /editor/import/scene_import_settings.cpp
parentfa3428ff25bc577d2a3433090478a6d615567056 (diff)
downloadredot-engine-6de34fde27f650f738a1e46992f1b783f2cf9e76.tar.gz
Add EditorStringNames singleton
Diffstat (limited to 'editor/import/scene_import_settings.cpp')
-rw-r--r--editor/import/scene_import_settings.cpp65
1 files changed, 33 insertions, 32 deletions
diff --git a/editor/import/scene_import_settings.cpp b/editor/import/scene_import_settings.cpp
index 2142ee3c10..6b42417296 100644
--- a/editor/import/scene_import_settings.cpp
+++ b/editor/import/scene_import_settings.cpp
@@ -36,6 +36,7 @@
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
+#include "editor/editor_string_names.h"
#include "editor/gui/editor_file_dialog.h"
#include "scene/3d/importer_mesh_instance_3d.h"
#include "scene/animation/animation_player.h"
@@ -170,7 +171,7 @@ void SceneImportSettings::_fill_material(Tree *p_tree, const Ref<Material> &p_ma
MaterialData &material_data = material_map[import_id];
ERR_FAIL_COND(p_material != material_data.material);
- Ref<Texture2D> icon = get_theme_icon(SNAME("StandardMaterial3D"), SNAME("EditorIcons"));
+ Ref<Texture2D> icon = get_editor_theme_icon(SNAME("StandardMaterial3D"));
TreeItem *item = p_tree->create_item(p_parent);
if (p_material->get_name().is_empty()) {
@@ -224,7 +225,7 @@ void SceneImportSettings::_fill_mesh(Tree *p_tree, const Ref<Mesh> &p_mesh, Tree
MeshData &mesh_data = mesh_map[import_id];
- Ref<Texture2D> icon = get_theme_icon(SNAME("Mesh"), SNAME("EditorIcons"));
+ Ref<Texture2D> icon = get_editor_theme_icon(SNAME("Mesh"));
TreeItem *item = p_tree->create_item(p_parent);
item->set_text(0, p_mesh->get_name());
@@ -274,7 +275,7 @@ void SceneImportSettings::_fill_animation(Tree *p_tree, const Ref<Animation> &p_
AnimationData &animation_data = animation_map[p_name];
- Ref<Texture2D> icon = get_theme_icon(SNAME("Animation"), SNAME("EditorIcons"));
+ Ref<Texture2D> icon = get_editor_theme_icon(SNAME("Animation"));
TreeItem *item = p_tree->create_item(p_parent);
item->set_text(0, p_name);
@@ -318,17 +319,17 @@ void SceneImportSettings::_fill_scene(Node *p_node, TreeItem *p_parent_item) {
String type = p_node->get_class();
- if (!has_theme_icon(type, SNAME("EditorIcons"))) {
+ if (!has_theme_icon(type, EditorStringName(EditorIcons))) {
type = "Node3D";
}
- Ref<Texture2D> icon = get_theme_icon(type, SNAME("EditorIcons"));
+ Ref<Texture2D> icon = get_editor_theme_icon(type);
TreeItem *item = scene_tree->create_item(p_parent_item);
item->set_text(0, p_node->get_name());
if (p_node == scene) {
- icon = get_theme_icon(SNAME("PackedScene"), SNAME("EditorIcons"));
+ icon = get_editor_theme_icon(SNAME("PackedScene"));
item->set_text(0, TTR("Scene"));
}
@@ -886,11 +887,11 @@ void SceneImportSettings::_play_animation() {
if (animation_player->has_animation(id)) {
if (animation_player->is_playing()) {
animation_player->pause();
- animation_play_button->set_icon(get_theme_icon(SNAME("MainPlay"), SNAME("EditorIcons")));
+ animation_play_button->set_icon(get_editor_theme_icon(SNAME("MainPlay")));
set_process(false);
} else {
animation_player->play(id);
- animation_play_button->set_icon(get_theme_icon(SNAME("Pause"), SNAME("EditorIcons")));
+ animation_play_button->set_icon(get_editor_theme_icon(SNAME("Pause")));
set_process(true);
}
}
@@ -899,7 +900,7 @@ void SceneImportSettings::_play_animation() {
void SceneImportSettings::_stop_current_animation() {
animation_pingpong = false;
animation_player->stop();
- animation_play_button->set_icon(get_theme_icon(SNAME("MainPlay"), SNAME("EditorIcons")));
+ animation_play_button->set_icon(get_editor_theme_icon(SNAME("MainPlay")));
animation_slider->set_value_no_signal(0.0);
set_process(false);
}
@@ -911,7 +912,7 @@ void SceneImportSettings::_reset_animation(const String &p_animation_name) {
if (animation_player != nullptr && animation_player->is_playing()) {
animation_player->stop();
}
- animation_play_button->set_icon(get_theme_icon(SNAME("MainPlay"), SNAME("EditorIcons")));
+ animation_play_button->set_icon(get_editor_theme_icon(SNAME("MainPlay")));
_reset_bone_transforms();
set_process(false);
@@ -933,7 +934,7 @@ void SceneImportSettings::_reset_animation(const String &p_animation_name) {
animation_player->play(p_animation_name);
} else {
animation_player->stop(true);
- animation_play_button->set_icon(get_theme_icon(SNAME("MainPlay"), SNAME("EditorIcons")));
+ animation_play_button->set_icon(get_editor_theme_icon(SNAME("MainPlay")));
animation_player->set_assigned_animation(p_animation_name);
animation_player->seek(0.0, true);
animation_slider->set_value_no_signal(0.0);
@@ -948,7 +949,7 @@ void SceneImportSettings::_animation_slider_value_changed(double p_value) {
}
if (animation_player->is_playing()) {
animation_player->stop();
- animation_play_button->set_icon(get_theme_icon(SNAME("MainPlay"), SNAME("EditorIcons")));
+ animation_play_button->set_icon(get_editor_theme_icon(SNAME("MainPlay")));
set_process(false);
}
animation_player->seek(p_value * animation_map[selected_id].animation->get_length(), true);
@@ -959,7 +960,7 @@ void SceneImportSettings::_animation_finished(const StringName &p_name) {
switch (loop_mode) {
case Animation::LOOP_NONE: {
- animation_play_button->set_icon(get_theme_icon(SNAME("MainPlay"), SNAME("EditorIcons")));
+ animation_play_button->set_icon(get_editor_theme_icon(SNAME("MainPlay")));
animation_slider->set_value_no_signal(1.0);
set_process(false);
} break;
@@ -1145,11 +1146,11 @@ void SceneImportSettings::_notification(int p_what) {
action_menu->add_theme_style_override("pressed", get_theme_stylebox("pressed", "Button"));
if (animation_player != nullptr && animation_player->is_playing()) {
- animation_play_button->set_icon(get_theme_icon(SNAME("Pause"), SNAME("EditorIcons")));
+ animation_play_button->set_icon(get_editor_theme_icon(SNAME("Pause")));
} else {
- animation_play_button->set_icon(get_theme_icon(SNAME("MainPlay"), SNAME("EditorIcons")));
+ animation_play_button->set_icon(get_editor_theme_icon(SNAME("MainPlay")));
}
- animation_stop_button->set_icon(get_theme_icon(SNAME("Stop"), SNAME("EditorIcons")));
+ animation_stop_button->set_icon(get_editor_theme_icon(SNAME("Stop")));
} break;
case NOTIFICATION_PROCESS: {
@@ -1193,11 +1194,11 @@ void SceneImportSettings::_save_path_changed(const String &p_path) {
if (FileAccess::exists(p_path)) {
save_path_item->set_text(2, TTR("Warning: File exists"));
save_path_item->set_tooltip_text(2, TTR("Existing file with the same name will be replaced."));
- save_path_item->set_icon(2, get_theme_icon(SNAME("StatusWarning"), SNAME("EditorIcons")));
+ save_path_item->set_icon(2, get_editor_theme_icon(SNAME("StatusWarning")));
} else {
save_path_item->set_text(2, TTR("Will create new file"));
- save_path_item->set_icon(2, get_theme_icon(SNAME("StatusSuccess"), SNAME("EditorIcons")));
+ save_path_item->set_icon(2, get_editor_theme_icon(SNAME("StatusSuccess")));
}
}
@@ -1231,7 +1232,7 @@ void SceneImportSettings::_save_dir_callback(const String &p_path) {
String name = md.material_node->get_text(0);
item->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
- item->set_icon(0, get_theme_icon(SNAME("StandardMaterial3D"), SNAME("EditorIcons")));
+ item->set_icon(0, get_editor_theme_icon(SNAME("StandardMaterial3D")));
item->set_text(0, name);
if (md.has_import_id) {
@@ -1253,20 +1254,20 @@ void SceneImportSettings::_save_dir_callback(const String &p_path) {
if (FileAccess::exists(path)) {
item->set_text(2, TTR("Warning: File exists"));
item->set_tooltip_text(2, TTR("Existing file with the same name will be replaced."));
- item->set_icon(2, get_theme_icon(SNAME("StatusWarning"), SNAME("EditorIcons")));
+ item->set_icon(2, get_editor_theme_icon(SNAME("StatusWarning")));
} else {
item->set_text(2, TTR("Will create new file"));
- item->set_icon(2, get_theme_icon(SNAME("StatusSuccess"), SNAME("EditorIcons")));
+ item->set_icon(2, get_editor_theme_icon(SNAME("StatusSuccess")));
}
- item->add_button(1, get_theme_icon(SNAME("Folder"), SNAME("EditorIcons")));
+ item->add_button(1, get_editor_theme_icon(SNAME("Folder")));
}
} else {
item->set_text(2, TTR("No import ID"));
item->set_tooltip_text(2, TTR("Material has no name nor any other way to identify on re-import.\nPlease name it or ensure it is exported with an unique ID."));
- item->set_icon(2, get_theme_icon(SNAME("StatusError"), SNAME("EditorIcons")));
+ item->set_icon(2, get_editor_theme_icon(SNAME("StatusError")));
}
save_path_items.push_back(item);
@@ -1284,7 +1285,7 @@ void SceneImportSettings::_save_dir_callback(const String &p_path) {
String name = md.mesh_node->get_text(0);
item->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
- item->set_icon(0, get_theme_icon(SNAME("Mesh"), SNAME("EditorIcons")));
+ item->set_icon(0, get_editor_theme_icon(SNAME("Mesh")));
item->set_text(0, name);
if (md.has_import_id) {
@@ -1306,20 +1307,20 @@ void SceneImportSettings::_save_dir_callback(const String &p_path) {
if (FileAccess::exists(path)) {
item->set_text(2, TTR("Warning: File exists"));
item->set_tooltip_text(2, TTR("Existing file with the same name will be replaced on import."));
- item->set_icon(2, get_theme_icon(SNAME("StatusWarning"), SNAME("EditorIcons")));
+ item->set_icon(2, get_editor_theme_icon(SNAME("StatusWarning")));
} else {
item->set_text(2, TTR("Will save to new file"));
- item->set_icon(2, get_theme_icon(SNAME("StatusSuccess"), SNAME("EditorIcons")));
+ item->set_icon(2, get_editor_theme_icon(SNAME("StatusSuccess")));
}
- item->add_button(1, get_theme_icon(SNAME("Folder"), SNAME("EditorIcons")));
+ item->add_button(1, get_editor_theme_icon(SNAME("Folder")));
}
} else {
item->set_text(2, TTR("No import ID"));
item->set_tooltip_text(2, TTR("Mesh has no name nor any other way to identify on re-import.\nPlease name it or ensure it is exported with an unique ID."));
- item->set_icon(2, get_theme_icon(SNAME("StatusError"), SNAME("EditorIcons")));
+ item->set_icon(2, get_editor_theme_icon(SNAME("StatusError")));
}
save_path_items.push_back(item);
@@ -1337,7 +1338,7 @@ void SceneImportSettings::_save_dir_callback(const String &p_path) {
String name = ad.scene_node->get_text(0);
item->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
- item->set_icon(0, get_theme_icon(SNAME("Animation"), SNAME("EditorIcons")));
+ item->set_icon(0, get_editor_theme_icon(SNAME("Animation")));
item->set_text(0, name);
if (ad.settings.has("save_to_file/enabled") && bool(ad.settings["save_to_file/enabled"])) {
@@ -1358,14 +1359,14 @@ void SceneImportSettings::_save_dir_callback(const String &p_path) {
if (FileAccess::exists(path)) {
item->set_text(2, TTR("Warning: File exists"));
item->set_tooltip_text(2, TTR("Existing file with the same name will be replaced on import."));
- item->set_icon(2, get_theme_icon(SNAME("StatusWarning"), SNAME("EditorIcons")));
+ item->set_icon(2, get_editor_theme_icon(SNAME("StatusWarning")));
} else {
item->set_text(2, TTR("Will save to new file"));
- item->set_icon(2, get_theme_icon(SNAME("StatusSuccess"), SNAME("EditorIcons")));
+ item->set_icon(2, get_editor_theme_icon(SNAME("StatusSuccess")));
}
- item->add_button(1, get_theme_icon(SNAME("Folder"), SNAME("EditorIcons")));
+ item->add_button(1, get_editor_theme_icon(SNAME("Folder")));
}
save_path_items.push_back(item);