Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wrong usage of parameters_base_path StringName #91944

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion editor/plugins/animation_state_machine_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ String AnimationNodeStateMachineEditor::_get_root_playback_path(String &r_node_d
if (node_directory_path.size()) {
r_node_directory += "/";
}
base_path = !edited_path.size() ? String(SceneStringName(parameters_base_path)) + "playback" : String(SceneStringName(parameters_base_path)) + base_path + "/playback";
base_path = !edited_path.size() ? Animation::PARAMETERS_BASE_PATH + "playback" : Animation::PARAMETERS_BASE_PATH + base_path + "/playback";
} else {
// Hmmm, we have to return Grouped state machine playback...
// It will give the user the error that Root/Nested state machine should be retrieved, that would be kind :-)
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/animation_tree_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ void AnimationTreeEditor::remove_plugin(AnimationTreeNodeEditorPlugin *p_editor)
}

String AnimationTreeEditor::get_base_path() {
String path = SceneStringName(parameters_base_path);
String path = Animation::PARAMETERS_BASE_PATH;
for (int i = 0; i < edited_path.size(); i++) {
path += edited_path[i] + "/";
}
Expand Down
4 changes: 2 additions & 2 deletions scene/animation/animation_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ bool AnimationTree::_blend_pre_process(double p_delta, int p_track_count, const
for (int i = 0; i < p_track_count; i++) {
src_blendsw[i] = 1.0; // By default all go to 1 for the root input.
}
root_animation_node->node_state.base_path = SceneStringName(parameters_base_path);
root_animation_node->node_state.base_path = SNAME(Animation::PARAMETERS_BASE_PATH.ascii().get_data());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be working correctly, but it would be nice if someone can confirm that this doesn't break anything. SNAME creates a static object, so .ascii().get_data() is done only once.

root_animation_node->node_state.parent = nullptr;
}

Expand Down Expand Up @@ -787,7 +787,7 @@ void AnimationTree::_update_properties() {
input_activity_map_get.clear();

if (root_animation_node.is_valid()) {
_update_properties_for_node(SceneStringName(parameters_base_path), root_animation_node);
_update_properties_for_node(Animation::PARAMETERS_BASE_PATH, root_animation_node);
}

properties_dirty = false;
Expand Down
2 changes: 2 additions & 0 deletions scene/resources/animation.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ class Animation : public Resource {
public:
typedef uint32_t TypeHash;

static inline String PARAMETERS_BASE_PATH = "parameters/";

enum TrackType {
TYPE_VALUE, // Set a value in a property, can be interpolated.
TYPE_POSITION_3D, // Position 3D track, can be compressed.
Expand Down
1 change: 0 additions & 1 deletion scene/scene_string_names.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ SceneStringNames::SceneStringNames() {
window_input = StaticCString::create("window_input");

theme_changed = StaticCString::create("theme_changed");
parameters_base_path = "parameters/";

shader_overrides_group = StaticCString::create("_shader_overrides_group_");
shader_overrides_group_active = StaticCString::create("_shader_overrides_group_active_");
Expand Down
1 change: 0 additions & 1 deletion scene/scene_string_names.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ class SceneStringNames {

StringName Master;

StringName parameters_base_path;
StringName window_input;

StringName theme_changed;
Expand Down
Loading