- Added input box to animation sample node to receive animation assets

- AssetSelect not gets shown or hidden depending on if the box has a connection
- Animation asset reference box now overrides asset picker
This commit is contained in:
Nils Hausfeld
2023-10-06 15:23:43 +02:00
parent a698095bdd
commit e07ae33040
2 changed files with 34 additions and 2 deletions

View File

@@ -749,7 +749,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
// Animation
case 2:
{
const auto anim = node->Assets[0].As<Animation>();
auto anim = node->Assets[0].As<Animation>();
auto& bucket = context.Data->State[node->BucketIndex].Animation;
switch (box->ID)
@@ -761,6 +761,18 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
const float speed = (float)tryGetValue(node->GetBox(5), node->Values[1]);
const bool loop = (bool)tryGetValue(node->GetBox(6), node->Values[2]);
const float startTimePos = (float)tryGetValue(node->GetBox(7), node->Values[3]);
// Override animation when animation reference box is connected
auto animationAssetBox = node->GetBox(8);
if(animationAssetBox->HasConnection())
{
const Value assetBoxValue = tryGetValue(animationAssetBox, Value::Null);
if(assetBoxValue != Value::Null)
anim = (Animation*)assetBoxValue.AsAsset;
else
anim = nullptr;
}
const float length = anim ? anim->GetLength() : 0.0f;
// Calculate new time position