public AvatarDefinition(VRCAvatarDescriptor descriptor) { Name = descriptor.name; AvatarDescriptor = descriptor; VrcExpressionParameters = AvatarDescriptor.expressionParameters; if (VrcExpressionParameters != null) { foreach (var parameter in VrcExpressionParameters.parameters) { AddParameter(parameter); } } if (descriptor.expressionsMenu != null) { AddMenu(descriptor.expressionsMenu); } var animators = descriptor.baseAnimationLayers; for (var i = 0; i < animators.Length; i++) { VRCAvatarDescriptor.CustomAnimLayer animLayer = animators[i]; if (animLayer.isDefault) { continue; } AnimatorDefinition.AnimatorType type = AnimatorDefinition.AnimatorType.Action; switch (i) { case 0: type = AnimatorDefinition.AnimatorType.Action; break; case 1: type = AnimatorDefinition.AnimatorType.Additive; break; case 2: type = AnimatorDefinition.AnimatorType.Base; break; case 3: type = AnimatorDefinition.AnimatorType.Gesture; break; case 4: type = AnimatorDefinition.AnimatorType.FX; break; } AddAnimator(animLayer.animatorController as AnimatorController, type); } }
private AnimatorDefinition AddAnimator(AnimatorController animator, AnimatorDefinition.AnimatorType type) { return(Children.AddChild(new AnimatorDefinition(this, animator, type))); }