1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-09 12:50:35 +00:00

Merge pull request #103986 from CrayolaEater/improved-blend-tree-state-machine-display

Improve State Machine BlendTree node to properly display conditions
This commit is contained in:
Thaddeus Crews
2025-05-19 08:01:31 -05:00

View File

@@ -196,11 +196,18 @@ void AnimationNodeBlendTreeEditor::update_graph() {
} }
String base_path = AnimationTreeEditor::get_singleton()->get_base_path() + String(E) + "/" + F.name; String base_path = AnimationTreeEditor::get_singleton()->get_base_path() + String(E) + "/" + F.name;
EditorProperty *prop = EditorInspector::instantiate_property_editor(tree, F.type, base_path, F.hint, F.hint_string, F.usage); EditorProperty *prop = EditorInspector::instantiate_property_editor(tree, F.type, base_path, F.hint, F.hint_string, F.usage);
Vector<String> path = F.name.split("/");
float ratio = 0.0f;
if (prop) { if (prop) {
prop->set_read_only(read_only || (F.usage & PROPERTY_USAGE_READ_ONLY)); prop->set_read_only(read_only || (F.usage & PROPERTY_USAGE_READ_ONLY));
prop->set_object_and_property(tree, base_path); prop->set_object_and_property(tree, base_path);
if (path.size() >= 2 && path[0] == "conditions") {
prop->set_draw_label(true);
prop->set_label(path[1]);
ratio = 0.9;
}
prop->set_name_split_ratio(ratio);
prop->update_property(); prop->update_property();
prop->set_name_split_ratio(0);
prop->connect("property_changed", callable_mp(this, &AnimationNodeBlendTreeEditor::_property_changed)); prop->connect("property_changed", callable_mp(this, &AnimationNodeBlendTreeEditor::_property_changed));
if (F.hint == PROPERTY_HINT_RESOURCE_TYPE) { if (F.hint == PROPERTY_HINT_RESOURCE_TYPE) {