// Copyright Epic Games, Inc. All Rights Reserved. #include "Dataflow/ChaosFleshVertexConstraintNode.h" #include "GeometryCollection/Facades/CollectionKinematicBindingFacade.h" #include UE_INLINE_GENERATED_CPP_BY_NAME(ChaosFleshVertexConstraintNode) void FSetVerticesKinematicDataflowNode::Evaluate(UE::Dataflow::FContext& Context, const FDataflowOutput* Out) const { if (Out->IsA(&Collection)) { DataType InCollection = GetValue(Context, &Collection); TArray BoundVerts; TArray BoundWeights; if (FindInput(&VertexIndicesIn) && FindInput(&VertexIndicesIn)->GetConnection()) { if (TManagedArray* Vertices = InCollection.FindAttribute("Vertex", FGeometryCollection::VerticesGroup)) { for (int32 SelectionIndex : GetValue>(Context, &VertexIndicesIn)) { if (0 <= SelectionIndex && SelectionIndex < Vertices->Num()) { BoundVerts.Add(SelectionIndex); } } BoundWeights.Init(1.0, BoundVerts.Num()); } } if (BoundVerts.Num() > 0) { GeometryCollection::Facades::FKinematicBindingFacade Kinematics(InCollection); Kinematics.AddKinematicBinding(Kinematics.SetBoneBindings(INDEX_NONE, BoundVerts, BoundWeights)); } SetValue(Context, MoveTemp(InCollection), &Collection); } }