Table of Contents

Class VirtualControllerContext

Namespace
nadena.dev.ndmf.animator

This extension context converts all "innate" animator controllers bound to the avatar into virtual controllers. By "innate", we mean controllers which are understood by the underlying platform (e.g. VRChat). As part of this, the controllers and animations are cloned, so that changes to them do not affect the original assets. This context acts as a key-value map from arbitrary context keys to virtual controllers. For VRChat controllers, the context will be a VRCAvatarDescriptor.AnimLayerType enum value. For other sub-components which have animator controllers (e.g. the unity Animator component), the context key will be that controller. Otherwise, it's up to the IPlatformAnimatorBindings implementation to define the context key. Upon deactivation, any changes to virtual controllers will be written back to their sources. You may also add arbitrary virtual controllers to the context, by setting the value for a given key. These controllers will be generally ignored, unless you choose to do something with them. Note that these controllers will not be preserved across a context deactivation.

Limitations

When this context is active, you must not modify the original controllers or their animations. This is because certain virtual objects may reference the original assets, and thus changes to them may result in undefined behavior. After deactivating this context, you must not modify the virtual controllers or their animations. This is because subsequent NDMF processing steps may directly modify the serialized animator controllers; conversely, when the virtual controller context is reactivated, it may or may not reuse the same virtual nodes as before.

public sealed class VirtualControllerContext : IExtensionContext
Inheritance
VirtualControllerContext
Implements
Inherited Members

Properties

CacheInvalidationToken

This value is updated every time the set of virtual controllers changes.

public long CacheInvalidationToken { get; }

Property Value

long

CloneContext

public CloneContext CloneContext { get; }

Property Value

CloneContext

this[object]

public VirtualAnimatorController? this[object key] { get; set; }

Parameters

key object

Property Value

VirtualAnimatorController

PlatformBindings

public IPlatformAnimatorBindings PlatformBindings { get; }

Property Value

IPlatformAnimatorBindings

Methods

Clone(AnimationClip?)

public VirtualClip? Clone(AnimationClip? clip)

Parameters

clip AnimationClip?

Returns

VirtualClip

Clone(AnimatorControllerLayer?, int)

public VirtualLayer? Clone(AnimatorControllerLayer? layer, int index)

Parameters

layer AnimatorControllerLayer?
index int

Returns

VirtualLayer

Clone(AnimatorStateMachine?)

public VirtualStateMachine? Clone(AnimatorStateMachine? stateMachine)

Parameters

stateMachine AnimatorStateMachine?

Returns

VirtualStateMachine

Clone(AnimatorStateTransition?)

public VirtualStateTransition? Clone(AnimatorStateTransition? transition)

Parameters

transition AnimatorStateTransition?

Returns

VirtualStateTransition

Clone(AnimatorState?)

public VirtualState? Clone(AnimatorState? state)

Parameters

state AnimatorState?

Returns

VirtualState

Clone(AnimatorTransition?)

public VirtualTransition? Clone(AnimatorTransition? transition)

Parameters

transition AnimatorTransition?

Returns

VirtualTransition

Clone(Motion?)

public VirtualMotion? Clone(Motion? m)

Parameters

m Motion?

Returns

VirtualMotion

Clone(RuntimeAnimatorController?)

public VirtualAnimatorController? Clone(RuntimeAnimatorController? controller)

Parameters

controller RuntimeAnimatorController?

Returns

VirtualAnimatorController

ForgetController(object)

"Forgets" a specific controller. This should usually only be done for controllers which are no longer relevant, e.g. if the corresponding component has been removed.

public void ForgetController(object key)

Parameters

key object

GetAllControllers()

public IEnumerable<VirtualAnimatorController> GetAllControllers()

Returns

IEnumerable<VirtualAnimatorController>

OnActivate(BuildContext)

Invoked when the extension is activated.

public void OnActivate(BuildContext context)

Parameters

context BuildContext

OnDeactivate(BuildContext)

Invoked when the extension is deactivated.

public void OnDeactivate(BuildContext context)

Parameters

context BuildContext