Add Set Parameter node to Anim Graph

#2162
This commit is contained in:
Wojtek Figat
2026-02-03 15:42:26 +01:00
parent f725f4c0b9
commit c828c90161
2 changed files with 36 additions and 0 deletions

View File

@@ -1100,6 +1100,27 @@ namespace FlaxEditor.Surface.Archetypes
NodeElementArchetype.Factory.ComboBox(2 + 20, 0, 116)
}
},
new NodeArchetype
{
TypeID = 5,
Create = (id, context, arch, groupArch) => new SurfaceNodeParamsSet(id, context, arch, groupArch),
Title = "Set Parameter",
Description = "Parameter value setter invoked when the animation pose is evaluated (output pose comes from input)",
Flags = NodeFlags.AnimGraph,
Size = new Float2(140, 40),
DefaultValues = new object[]
{
Guid.Empty,
null
},
Elements = new[]
{
NodeElementArchetype.Factory.Output(0, string.Empty, typeof(void), 0),
NodeElementArchetype.Factory.Input(0, string.Empty, true, typeof(void), 2),
NodeElementArchetype.Factory.Input(1, string.Empty, true, ScriptType.Null, 1, 1),
NodeElementArchetype.Factory.ComboBox(2 + 20, 0, 116)
}
},
};
}
}

View File

@@ -958,6 +958,21 @@ void AnimGraphExecutor::ProcessGroupParameters(Box* box, Node* node, Value& valu
}
break;
}
// Set Parameter
case 5:
{
// Set parameter value
int32 paramIndex;
const auto param = _graph.GetParameter((Guid)node->Values[0], paramIndex);
if (param)
{
context.Data->Parameters[paramIndex].Value = tryGetValue(node->GetBox(1), 1, Value::Null);
}
// Pass over the pose
value = tryGetValue(node->GetBox(2), Value::Null);
break;
}
default:
break;
}