Updated demo project.

This commit is contained in:
Martin Felis 2026-01-11 22:20:39 +01:00
parent 75b4df8c65
commit c6f37c8ef1
7 changed files with 177 additions and 41 deletions

19
demo/main.gd Normal file
View File

@ -0,0 +1,19 @@
extends Node3D
@onready var synced_animation_graph: SyncedAnimationGraph = %SyncedAnimationGraph
@onready var animation_tree: AnimationTree = %AnimationTree
@onready var blend_weight_slider: HSlider = %BlendWeightSlider
@onready var blend_weight_label: Label = %BlendWeightLabel
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
blend_weight_slider.value = 0.0
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func _on_blend_weight_slider_value_changed(value: float) -> void:
animation_tree.set("parameters/Blend2/blend_amount", value)
synced_animation_graph.set("parameters/AnimationBlend2Node/blend_amount", value)
blend_weight_label.text = str(value)

1
demo/main.gd.uid Normal file
View File

@ -0,0 +1 @@
uid://bjvgqujpqumj7

View File

@ -1,33 +1,132 @@
[gd_scene load_steps=5 format=3 uid="uid://svj53e2xoio"]
[gd_scene load_steps=14 format=3 uid="uid://svj53e2xoio"]
[ext_resource type="PackedScene" uid="uid://d1xcqdqr1qeu6" path="res://assets/MixamoAmy.glb" id="1_0xm2m"]
[ext_resource type="AnimationNodeBlendTree" uid="uid://dbkgln7hoxxc8" path="res://embedded_statemachine.tres" id="2_h2yge"]
[ext_resource type="AnimationLibrary" uid="uid://bjyfy6m2sr2kp" path="res://animation_library.tres" id="3_1bvp3"]
[ext_resource type="Script" uid="uid://bjvgqujpqumj7" path="res://main.gd" id="1_1bvp3"]
[ext_resource type="AnimationLibrary" uid="uid://dwubn740aqx51" path="res://animation_library.res" id="3_1bvp3"]
[ext_resource type="SyncedBlendTree" uid="uid://bijslmj4wd7ap" path="res://synced_blend_tree_node_limping.tres" id="4_1bvp3"]
[node name="Node3D" type="Node3D"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_h2yge"]
albedo_color = Color(0.427493, 0.42749307, 0.42749307, 1)
[node name="MixamoAmy" parent="." instance=ExtResource("1_0xm2m")]
[sub_resource type="PlaneMesh" id="PlaneMesh_h2yge"]
material = SubResource("StandardMaterial3D_h2yge")
size = Vector2(20, 20)
[node name="AnimationTree" type="AnimationTree" parent="."]
active = false
root_node = NodePath("../MixamoAmy")
tree_root = ExtResource("2_h2yge")
anim_player = NodePath("../MixamoAmy/AnimationPlayer")
parameters/Blend2/blend_amount = 0.44
"parameters/Embedded StateMachine/conditions/is_healthy" = false
"parameters/Embedded StateMachine/conditions/is_limping" = false
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_h2yge"]
sky_horizon_color = Color(0.66224277, 0.6717428, 0.6867428, 1)
ground_horizon_color = Color(0.66224277, 0.6717428, 0.6867428, 1)
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
root_node = NodePath("../MixamoAmy")
[sub_resource type="Sky" id="Sky_1bvp3"]
sky_material = SubResource("ProceduralSkyMaterial_h2yge")
[sub_resource type="Environment" id="Environment_lquwl"]
background_mode = 2
sky = SubResource("Sky_1bvp3")
tonemap_mode = 2
glow_enabled = true
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_h2yge"]
animation = &"Limping-InPlace"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_1bvp3"]
animation = &"Walk-InPlace"
[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_lquwl"]
[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_7mycd"]
nodes/output/position = Vector2(540, 140)
nodes/Animation/node = SubResource("AnimationNodeAnimation_1bvp3")
nodes/Animation/position = Vector2(120, 80)
"nodes/Animation 2/node" = SubResource("AnimationNodeAnimation_h2yge")
"nodes/Animation 2/position" = Vector2(80, 320)
nodes/Blend2/node = SubResource("AnimationNodeBlend2_lquwl")
nodes/Blend2/position = Vector2(360, 180)
node_connections = [&"output", 0, &"Blend2", &"Blend2", 0, &"Animation", &"Blend2", 1, &"Animation 2"]
[node name="Main" type="Node3D"]
script = ExtResource("1_1bvp3")
[node name="UI" type="CanvasLayer" parent="."]
[node name="MarginContainer" type="MarginContainer" parent="UI"]
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -153.5
offset_top = -40.0
offset_right = 153.5
grow_horizontal = 2
grow_vertical = 0
size_flags_horizontal = 4
size_flags_vertical = 8
[node name="HBoxContainer" type="HBoxContainer" parent="UI/MarginContainer"]
layout_mode = 2
theme_override_constants/separation = 14
[node name="Label" type="Label" parent="UI/MarginContainer/HBoxContainer"]
layout_mode = 2
text = "Blend Weight"
[node name="BlendWeightSlider" type="HSlider" parent="UI/MarginContainer/HBoxContainer"]
unique_name_in_owner = true
custom_minimum_size = Vector2(200, 0)
layout_mode = 2
size_flags_vertical = 4
max_value = 1.0
step = 0.001
[node name="BlendWeightLabel" type="Label" parent="UI/MarginContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "0.0"
[node name="Level" type="Node3D" parent="."]
[node name="MeshInstance3D" type="MeshInstance3D" parent="Level"]
mesh = SubResource("PlaneMesh_h2yge")
skeleton = NodePath("../..")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="Level"]
transform = Transform3D(1, 0, 0, 0, 0.14081486, 0.99003595, 0, -0.99003595, 0.14081486, 0, 2.0531263, 4.9494514)
shadow_enabled = true
[node name="WorldEnvironment" type="WorldEnvironment" parent="Level"]
environment = SubResource("Environment_lquwl")
[node name="Camera3D" type="Camera3D" parent="Level"]
transform = Transform3D(1, 0, 0, 0, 0.9897887, 0.14254257, 0, -0.14254257, 0.9897887, 0, 0.89188766, 1.4517534)
[node name="Characters" type="Node3D" parent="."]
[node name="MixamoAmy" parent="Characters" instance=ExtResource("1_0xm2m")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.5, 0, 0)
[node name="AnimationTree" type="AnimationTree" parent="Characters/MixamoAmy"]
unique_name_in_owner = true
root_node = NodePath("%AnimationTree/..")
tree_root = SubResource("AnimationNodeBlendTree_7mycd")
anim_player = NodePath("../AnimationPlayer")
parameters/Blend2/blend_amount = 0.5
[node name="MixamoAmySynced" parent="Characters" instance=ExtResource("1_0xm2m")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.5, 0, 0)
[node name="AnimationPlayer2" type="AnimationPlayer" parent="Characters/MixamoAmySynced"]
libraries = {
&"animation_library": ExtResource("3_1bvp3")
}
[node name="SyncedAnimationGraph" type="SyncedAnimationGraph" parent="."]
animation_player = NodePath("../AnimationPlayer")
[node name="SyncedAnimationGraph" type="SyncedAnimationGraph" parent="Characters/MixamoAmySynced"]
unique_name_in_owner = true
animation_player = NodePath("../AnimationPlayer2")
tree_root = ExtResource("4_1bvp3")
skeleton = NodePath("../MixamoAmy/Armature/Skeleton3D")
parameters/AnimationBlend2Node/blend_amount = 0.0
skeleton = NodePath("../Armature/Skeleton3D")
parameters/AnimationBlend2Node/blend_amount = 0.5
[editable path="MixamoAmy"]
[connection signal="value_changed" from="UI/MarginContainer/HBoxContainer/BlendWeightSlider" to="." method="_on_blend_weight_slider_value_changed"]
[editable path="Characters/MixamoAmy"]
[editable path="Characters/MixamoAmySynced"]

View File

@ -11,6 +11,7 @@ config_version=5
[application]
config/name="Synced Blend Tree Test"
run/main_scene="uid://svj53e2xoio"
config/features=PackedStringArray("4.5", "Forward Plus")
config/icon="res://icon.svg"

View File

@ -0,0 +1,18 @@
[gd_resource type="SyncedBlendTree" load_steps=4 format=3 uid="uid://de41u8rkjnjyk"]
[sub_resource type="AnimationSamplerNode" id="AnimationSamplerNode_bvt3d"]
animation = &"animation_library/Run-InPlace"
[sub_resource type="AnimationSamplerNode" id="AnimationSamplerNode_sntl5"]
animation = &"animation_library/Walk-InPlace"
[sub_resource type="AnimationBlend2Node" id="AnimationBlend2Node_n4m28"]
[resource]
nodes/Blend2/node = SubResource("AnimationBlend2Node_n4m28")
nodes/Blend2/position = Vector2(0, 0)
"nodes/AnimationSamplerNode 1/node" = SubResource("AnimationSamplerNode_bvt3d")
"nodes/AnimationSamplerNode 1/position" = Vector2(0, 0)
nodes/AnimationSamplerNode/node = SubResource("AnimationSamplerNode_sntl5")
nodes/AnimationSamplerNode/position = Vector2(0, 0)
node_connections = [&"Blend2", 0, &"AnimationSamplerNode", &"Blend2", 1, &"AnimationSamplerNode 1", &"Output", 0, &"Blend2"]

View File

@ -0,0 +1,19 @@
[gd_resource type="SyncedBlendTree" load_steps=4 format=3 uid="uid://bijslmj4wd7ap"]
[sub_resource type="AnimationBlend2Node" id="AnimationBlend2Node_bvt3d"]
blend_amount = 0.5
[sub_resource type="AnimationSamplerNode" id="AnimationSamplerNode_sntl5"]
animation = &"animation_library/Limping-InPlace"
[sub_resource type="AnimationSamplerNode" id="AnimationSamplerNode_n4m28"]
animation = &"animation_library/Walk-InPlace"
[resource]
nodes/AnimationBlend2Node/node = SubResource("AnimationBlend2Node_bvt3d")
nodes/AnimationBlend2Node/position = Vector2(0, 0)
"nodes/AnimationSamplerNode 1/node" = SubResource("AnimationSamplerNode_sntl5")
"nodes/AnimationSamplerNode 1/position" = Vector2(0, 0)
nodes/AnimationSamplerNode/node = SubResource("AnimationSamplerNode_n4m28")
nodes/AnimationSamplerNode/position = Vector2(0, 0)
node_connections = [&"AnimationBlend2Node", 0, &"AnimationSamplerNode", &"AnimationBlend2Node", 1, &"AnimationSamplerNode 1", &"Output", 0, &"AnimationBlend2Node"]

View File

@ -1,21 +0,0 @@
[gd_resource type="AnimationNodeBlendTree" load_steps=4 format=3 uid="uid://c7o0gt3li5p4b"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_fpiwu"]
animation = &"animation_library/Limping-InPlace"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_4sffn"]
animation = &"animation_library/Walk-InPlace"
[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_w6plo"]
sync = true
blend_amount = 0.5
[resource]
nodes/output/position = Vector2(860, 160)
nodes/Animation/node = SubResource("AnimationNodeAnimation_4sffn")
nodes/Animation/position = Vector2(280, 100)
"nodes/Animation 2/node" = SubResource("AnimationNodeAnimation_fpiwu")
"nodes/Animation 2/position" = Vector2(280, 300)
nodes/Blend2/node = SubResource("AnimationNodeBlend2_w6plo")
nodes/Blend2/position = Vector2(640, 160)
node_connections = [&"output", 0, &"Blend2", &"Blend2", 0, &"Animation", &"Blend2", 1, &"Animation 2"]