Skip to content

Commit

Permalink
Simplify graph architecture (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrea-c committed Dec 14, 2023
1 parent fd476bd commit 0540950
Show file tree
Hide file tree
Showing 25 changed files with 1,440 additions and 2,165 deletions.
37 changes: 17 additions & 20 deletions assets/animation_graphs/locomotion.animgraph.ron
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
(
nodes: [
(name: "Walk Clip", node: Clip("animations/walk.anim.ron", Some(1.))),
(name: "Walk Clip 2", node: Clip("animations/walk.anim.ron", Some(1.))),
(name: "Run Clip", node: Clip("animations/run.anim.ron", Some(1.))),
(name: "Run Clip 2", node: Clip("animations/run.anim.ron", Some(1.))),
(name: "Walk Flip LR", node: FlipLR),
(name: "Run Flip LR", node: FlipLR),
(name: "Walk Chain", node: Chain),
Expand All @@ -15,30 +17,25 @@
input_parameters: {
"Target Speed": F32(1.5),
},
output_time_dependent_spec: {
"Pose": PoseFrame,
},
input_edges: [
// Alpha parameters
output_pose_spec: true,
input_parameter_edges: [
("Target Speed", ("Param graph", "Target Speed")),
],
edges: [
output_pose_edge: Some("Speed"),
parameter_edges: [
(("Param graph", "blend_fac"),("Blend", "Factor")),
(("Param graph", "speed_fac"),("Speed", "Speed")),

(("Walk Clip", "Pose Out"), ("Walk Flip LR", "Pose In")),
(("Walk Clip", "Pose Out"), ("Walk Chain", "Pose In 1")),
(("Walk Flip LR", "Pose Out"), ("Walk Chain", "Pose In 2")),
(("Run Clip", "Pose Out"), ("Run Chain", "Pose In 1")),
(("Run Clip", "Pose Out"), ("Run Flip LR", "Pose In")),
(("Run Flip LR", "Pose Out"), ("Run Chain", "Pose In 2")),
(("Walk Chain", "Pose Out"), ("Blend", "Pose In 1")),
(("Run Chain", "Pose Out"), ("Blend", "Pose In 2")),
(("Blend", "Pose Out"), ("Loop", "Pose In")),
(("Loop", "Pose Out"), ("Speed", "Pose In")),
],
output_edges: [
(("Speed", "Pose Out"), "Pose"),
pose_edges: [
("Walk Clip", ("Walk Chain", "Pose In 1")),
("Walk Clip 2", ("Walk Flip LR", "Pose In")),
("Walk Flip LR", ("Walk Chain", "Pose In 2")),
("Run Clip", ("Run Chain", "Pose In 1")),
("Run Clip 2", ("Run Flip LR", "Pose In")),
("Run Flip LR", ("Run Chain", "Pose In 2")),
("Walk Chain", ("Blend", "Pose In 1")),
("Run Chain", ("Blend", "Pose In 2")),
("Blend", ("Loop", "Pose In")),
("Loop", ("Speed", "Pose In")),
],
default_output: Some("Pose"),
)
7 changes: 3 additions & 4 deletions assets/animation_graphs/velocity_to_params.animgraph.ron
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@
"Blend End": F32(3.0),

// Constant values
// TODO: Maybe there should be a better way to handle constant/defaults?
"ZERO": F32(0.),
"ONE": F32(1.),
},
output_parameter_spec: {
"speed_fac": F32,
"blend_fac": F32,
},
input_edges: [
input_parameter_edges: [
// Alpha clamp range
("ZERO", ("Alpha", "Min")),
("ONE", ("Alpha", "Max")),
Expand All @@ -44,7 +43,7 @@
("Run Base Speed", ("Factored run speed", "F32 In 1")),
("Target Speed", ("Speed factor", "F32 In 1")),
],
edges: [
parameter_edges: [
// Blend alpha computation
// ((target_speed - blend_start) / (blend_end - blend_start)).clamp(0., 1.);
(("Alpha Tmp 1", "F32 Out"), ("Alpha Tmp 3", "F32 In 1")),
Expand All @@ -60,7 +59,7 @@
(("Factored run speed", "F32 Out"), ("Blended base speed", "F32 In 2")),
(("Blended base speed", "F32 Out"),("Speed factor", "F32 In 2")),
],
output_edges: [
output_parameter_edges: [
(("Alpha", "F32 Out"), "blend_fac"),
(("Speed factor", "F32 Out"), "speed_fac"),
],
Expand Down
6 changes: 2 additions & 4 deletions src/bin/show_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,12 @@ fn show_graph(
.get(target_graph.handle.as_ref().unwrap())
.unwrap();

let mut context_tmp = GraphContextTmp {
let context_tmp = GraphContextTmp {
graph_clip_assets: &graph_clip_assets,
animation_graph_assets: &animation_graph_assets,
};

graph
.dot_to_tmp_file_and_open(None, &mut context_tmp)
.unwrap();
graph.dot_to_tmp_file_and_open(None, context_tmp).unwrap();

exit.send(AppExit);
}
Expand Down

0 comments on commit 0540950

Please sign in to comment.