Table of Contents

Interface IPlatformAnimatorBindings

Namespace
nadena.dev.ndmf.animator

The IPlatformAnimatorBindings interface is used to provide platform-specific bindings for the animator service. This is used, for example, to identify which animator controllers are referenced by the avatar's platform-specific components, and to process platform-specific state behaviours.

public interface IPlatformAnimatorBindings

Methods

CommitControllers(GameObject, IDictionary<object, RuntimeAnimatorController>)

Updates any innate controllers to reference new animator controllers.

void CommitControllers(GameObject root, IDictionary<object, RuntimeAnimatorController> controllers)

Parameters

root GameObject
controllers IDictionary<object, RuntimeAnimatorController>

CommitStateBehaviour(CommitContext, StateMachineBehaviour)

Invoked when a StateMachineBehavior is being committed, to allow for any platform-specific modifications. For example, in VRChat, this is used to replace the virtual layer indexes with the actual layer indexes in the VRChatAnimatorLayerControl behavior.

bool CommitStateBehaviour(CommitContext context, StateMachineBehaviour behaviour)

Parameters

context CommitContext
behaviour StateMachineBehaviour

Returns

bool

True to retain this state behavior, false to remove it on commit

GetInnateControllers(GameObject)

Returns any animator controllers that are referenced by platform-specific assets (e.g. VRCAvatarDescriptor). The bool flag indicates whether the controller is overridden (true) or left as default (false).

IEnumerable<(object, RuntimeAnimatorController, bool)> GetInnateControllers(GameObject root)

Parameters

root GameObject

Returns

IEnumerable<(object, RuntimeAnimatorController, bool)>

IsSpecialMotion(Motion)

If true, the motion asset should be maintained as-is without replacement or modification.

bool IsSpecialMotion(Motion m)

Parameters

m Motion

Returns

bool

OnParameterTypeChanges(VirtualAnimatorController, IEnumerable<(string, AnimatorControllerParameterType, AnimatorControllerParameterType)>)

Invoked when the type of an existing parameter is changed. This is used in the VRChat bindings to adjust parameter drivers when a parameter is changed from bool to float, in order to preserve behavior.

void OnParameterTypeChanges(VirtualAnimatorController controller, IEnumerable<(string, AnimatorControllerParameterType, AnimatorControllerParameterType)> changes)

Parameters

controller VirtualAnimatorController

The controller that was modified

changes IEnumerable<(string, AnimatorControllerParameterType, AnimatorControllerParameterType)>

A map of (parameter name, old type, new type)

PreCommitController(VirtualAnimatorController)

Invoked just before committing an animator controller. This callback can be used, for example, to ensure that any synthetic parameters are added to the controller. Note that, if multiple controllers share animation clips or other objects, changes to those objects may not be reflected in the final animator controller assets, as they may have already been committed to unity objects.

void PreCommitController(VirtualAnimatorController controller)

Parameters

controller VirtualAnimatorController

RemapPathsInStateBehaviour(StateMachineBehaviour, Func<string, string?>)

Invoked when path remappings are being processed to apply any changed mappings to state behaviors. In VRChat, this is used to remap object paths in VRCAnimatorPlayAudio

void RemapPathsInStateBehaviour(StateMachineBehaviour behaviour, Func<string, string?> remapPath)

Parameters

behaviour StateMachineBehaviour

The behaviour to remap

remapPath Func<string, string>

A function which remaps old paths to new paths (or to null, if the corresponding object was deleted)

VirtualizeStateBehaviour(CloneContext, StateMachineBehaviour)

Invoked after a StateMachineBehavior is cloned, to allow for any platform-specific modifications. For example, in VRChat, this is used to replace the layer indexes with virtual layer indexes in the VRChatAnimatorLayerControl behavior.

Note that, if we're re-activating the virtual animator controller after committing, this will be re-invoked with the same behaviour it had previously cloned. This allows for again converting between virtual and physical layer indexes.

void VirtualizeStateBehaviour(CloneContext context, StateMachineBehaviour behaviour)

Parameters

context CloneContext
behaviour StateMachineBehaviour