av3-animator-as-code icon indicating copy to clipboard operation
av3-animator-as-code copied to clipboard

Feature Request: Add ability to enter a name for new blend trees

Open Saberpeep opened this issue 5 months ago • 2 comments

In acc.cs NewBlendTree() and NewBlendTreeAsRaw() call AacInternals.NewBlendTreeAsRaw(AacConfiguration component, string suffix) which has a parameter for specifying a name for the blend tree as suffix, but they both just pass in a GUID. I'm not sure if its important to the operation that it uses a GUID? But it seems like overloads could be added to those methods to allow setting a name for the created blend tree. I tried adding those overloads myself and it seems to work just fine, but I don't know if there's some unintended consequences that might cause down the line.

Having custom names for blend trees would help greatly for debugging and general readability of the result.

Saberpeep avatar Jul 05 '25 22:07 Saberpeep

In your use case, do you use AssetContainers?

In the meantime you can get the original BlendTree by using the (AacFlBlendTree).BlendTree getter, such as aac.NewBlendTree().BlendTree and set the name here.

I believe the historical reason the overload only allows specifying a suffix was because:

  • early on, AAC used to always require an asset container,
  • the prefix needs to be retained in order to make ClearPreviousAssets() work when AAC is executed multiple times in different sessions, and
  • we need to prevent the creation of multiple trees or blend trees having the same name otherwise they can't be saved at all

There's a good chance I'll modify the behaviour of AAC to use the non-empty suffix parameter as the actual blend tree name without a prefix or suffix if the ContainerMode of the AacConfiguration is set to OnlyWhenPersistenceRequired or Never

hai-vr avatar Jul 10 '25 17:07 hai-vr

I think you might be overthinking it a little bit. NewClip() has a version where you can enter a name: NewClip(string name), so why not just expose the same for NewBlendTree()? Both of them end up in Internal_GenerateAnimationName() regardless, which adds the appropriate prefix and even a random number to avoid collisions.

Saberpeep avatar Jul 10 '25 23:07 Saberpeep