internal void Setup(Transform transform, ILookAtEyeDirectionProvider eyeDirectionProvider, ILookAtEyeDirectionApplicable eyeDirectionApplicable) { if (ExpressionAvatar == null) { #if VRM_DEVELOP if (m_debugCount++ == 0) { Debug.LogWarning($"{nameof(VRM10ControllerExpression)}.{nameof(ExpressionAvatar)} is null."); } #endif return; } Restore(); _merger = new ExpressionMerger(ExpressionAvatar.Clips, transform); _keys = ExpressionAvatar.Clips.Select(ExpressionKey.CreateFromClip).ToList(); var oldInputWeights = _inputWeights; _inputWeights = _keys.ToDictionary(x => x, x => 0f); foreach (var key in _keys) { // remain user input weights. if (oldInputWeights.ContainsKey(key)) { _inputWeights[key] = oldInputWeights[key]; } } _actualWeights = _keys.ToDictionary(x => x, x => 0f); _validator = ExpressionValidatorFactory.Create(ExpressionAvatar); _eyeDirectionProvider = eyeDirectionProvider; _eyeDirectionApplicable = eyeDirectionApplicable; }
internal void Restore() { _merger?.RestoreMaterialInitialValues(); _merger = null; _eyeDirectionApplicable?.Restore(); _eyeDirectionApplicable = null; }
internal Vrm10RuntimeExpression(Vrm10Instance target, ILookAtEyeDirectionProvider eyeDirectionProvider, ILookAtEyeDirectionApplicable eyeDirectionApplicable) { Restore(); _merger = new ExpressionMerger(target.Vrm.Expression, target.transform); _keys = target.Vrm.Expression.Clips.Select(x => target.Vrm.Expression.CreateKey(x.Clip)).ToList(); var oldInputWeights = _inputWeights; _inputWeights = _keys.ToDictionary(x => x, x => 0f); foreach (var key in _keys) { // remain user input weights. if (oldInputWeights.ContainsKey(key)) { _inputWeights[key] = oldInputWeights[key]; } } _actualWeights = _keys.ToDictionary(x => x, x => 0f); _validator = ExpressionValidatorFactory.Create(target.Vrm.Expression); _eyeDirectionProvider = eyeDirectionProvider; _eyeDirectionApplicable = eyeDirectionApplicable; }
internal void Setup(VRM10Controller target, ILookAtEyeDirectionProvider eyeDirectionProvider, ILookAtEyeDirectionApplicable eyeDirectionApplicable) { Restore(); _merger = new ExpressionMerger(Clips, target.transform); _keys = Clips.Select(ExpressionKey.CreateFromClip).ToList(); var oldInputWeights = _inputWeights; _inputWeights = _keys.ToDictionary(x => x, x => 0f); foreach (var key in _keys) { // remain user input weights. if (oldInputWeights.ContainsKey(key)) { _inputWeights[key] = oldInputWeights[key]; } } _actualWeights = _keys.ToDictionary(x => x, x => 0f); _validator = ExpressionValidatorFactory.Create(this); _eyeDirectionProvider = eyeDirectionProvider; _eyeDirectionApplicable = eyeDirectionApplicable; }