From 9d9271b51888aafa0764202f5d332f962574c903 Mon Sep 17 00:00:00 2001 From: Relintai Date: Thu, 11 Aug 2022 20:22:51 +0200 Subject: [PATCH] Removed the SNAME macro, I'll probably keep static counting support for StringNames though. --- core/string_name.h | 2 +- .../skeleton_editor/skeleton_editor_plugin.cpp | 12 ++++++------ scene/3d/bone_attachment.cpp | 16 ++++++++-------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/core/string_name.h b/core/string_name.h index 23be1d954..4a11f3052 100644 --- a/core/string_name.h +++ b/core/string_name.h @@ -217,7 +217,7 @@ StringName _scs_create(const char *p_chr, bool p_static = false); * Use in places that can be called hundreds of times per frame (or more) is recommended, but this situation is very rare. If in doubt, do not use. */ -#define SNAME(m_arg) ([]() -> const StringName & { static StringName sname = _scs_create(m_arg, true); return sname; })() +//#define SNAME(m_arg) ([]() -> const StringName & { static StringName sname = _scs_create(m_arg, true); return sname; })() #endif // STRING_NAME_H diff --git a/modules/skeleton_editor/skeleton_editor_plugin.cpp b/modules/skeleton_editor/skeleton_editor_plugin.cpp index cec682c5b..afe3ee3ac 100644 --- a/modules/skeleton_editor/skeleton_editor_plugin.cpp +++ b/modules/skeleton_editor/skeleton_editor_plugin.cpp @@ -597,7 +597,7 @@ void SkeletonEditor::update_joint_tree() { items.insert(-1, root); - Ref bone_icon = get_icon(SNAME("Bone"), SNAME("EditorIcons")); + Ref bone_icon = get_icon("Bone", "EditorIcons"); Vector bones_to_process = skeleton->get_parentless_bones(); while (bones_to_process.size() > 0) { @@ -688,7 +688,7 @@ void SkeletonEditor::create_editors() { ne->add_control_to_menu_panel(skeleton_options); skeleton_options->set_text(TTR("Skeleton")); - skeleton_options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon(SNAME("Skeleton"), SNAME("EditorIcons"))); + skeleton_options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Skeleton", "EditorIcons")); skeleton_options->get_popup()->add_item(TTR("Init pose"), SKELETON_OPTION_INIT_POSE); skeleton_options->get_popup()->add_item(TTR("Insert key of all bone poses"), SKELETON_OPTION_INSERT_KEYS); @@ -704,7 +704,7 @@ void SkeletonEditor::create_editors() { ne->add_control_to_menu_panel(rest_options); rest_options->set_text(TTR("Edit Rest")); - rest_options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon(SNAME("BoneAttachment"), SNAME("EditorIcons"))); + rest_options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("BoneAttachment", "EditorIcons")); rest_options->get_popup()->add_item(TTR("Apply current pose to rest"), REST_OPTION_POSE_TO_REST); rest_options->get_popup()->connect("id_pressed", this, "_on_click_rest_option"); @@ -1444,9 +1444,9 @@ void SkeletonGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { int bone_shape = EditorSettings::get_singleton()->get("editors/3d_gizmos/gizmo_settings/bone_shape"); LocalVector axis_colors; - axis_colors.push_back(SpatialEditor::get_singleton()->get_color(SNAME("axis_x_color"), SNAME("Editor"))); - axis_colors.push_back(SpatialEditor::get_singleton()->get_color(SNAME("axis_y_color"), SNAME("Editor"))); - axis_colors.push_back(SpatialEditor::get_singleton()->get_color(SNAME("axis_z_color"), SNAME("Editor"))); + axis_colors.push_back(SpatialEditor::get_singleton()->get_color("axis_x_color", "Editor")); + axis_colors.push_back(SpatialEditor::get_singleton()->get_color("axis_y_color", "Editor")); + axis_colors.push_back(SpatialEditor::get_singleton()->get_color("axis_z_color", "Editor")); Ref surface_tool(memnew(SurfaceTool)); surface_tool->begin(Mesh::PRIMITIVE_LINES); diff --git a/scene/3d/bone_attachment.cpp b/scene/3d/bone_attachment.cpp index f3bf84fd9..662bf682e 100644 --- a/scene/3d/bone_attachment.cpp +++ b/scene/3d/bone_attachment.cpp @@ -250,13 +250,13 @@ void BoneAttachment::_validate_property(PropertyInfo &property) const { } bool BoneAttachment::_set(const StringName &p_path, const Variant &p_value) { - if (p_path == SNAME("override_pose")) { + if (p_path == "override_pose") { set_override_pose(p_value); - } else if (p_path == SNAME("override_mode")) { + } else if (p_path == "override_mode") { set_override_mode(p_value); - } else if (p_path == SNAME("use_external_skeleton")) { + } else if (p_path == "use_external_skeleton") { set_use_external_skeleton(p_value); - } else if (p_path == SNAME("external_skeleton")) { + } else if (p_path == "external_skeleton") { set_external_skeleton(p_value); } @@ -264,13 +264,13 @@ bool BoneAttachment::_set(const StringName &p_path, const Variant &p_value) { } bool BoneAttachment::_get(const StringName &p_path, Variant &r_ret) const { - if (p_path == SNAME("override_pose")) { + if (p_path == "override_pose") { r_ret = get_override_pose(); - } else if (p_path == SNAME("override_mode")) { + } else if (p_path == "override_mode") { r_ret = get_override_mode(); - } else if (p_path == SNAME("use_external_skeleton")) { + } else if (p_path == "use_external_skeleton") { r_ret = get_use_external_skeleton(); - } else if (p_path == SNAME("external_skeleton")) { + } else if (p_path == "external_skeleton") { r_ret = get_external_skeleton(); }