Esempio n. 1
0
        public static void CreateGestureController(VRCAvatar originalAvatar, VRCAvatar editAvatar)
        {
            if (!originalAvatar.Descriptor.customizeAnimationLayers)
            {
                EnableCustomPlayableLayers(originalAvatar);
                EnableCustomPlayableLayers(editAvatar);
            }

            if (originalAvatar.GestureController is null)
            {
                string saveFolderPath;
                if (originalAvatar.FxController != null)
                {
                    saveFolderPath = Path.GetDirectoryName(AssetDatabase.GetAssetPath(originalAvatar.FxController));
                }
                else
                {
                    saveFolderPath = "Assets/" + originalAvatar.Animator.gameObject.name + "/";
                }

                var fileName = $"Gesture_HandsLayer_{ originalAvatar.Animator.gameObject.name}.controller";
                var createdGestureController = InstantiateFxController(Path.Combine(saveFolderPath, fileName));

                originalAvatar.Descriptor.baseAnimationLayers[2].isDefault          = false;
                editAvatar.Descriptor.baseAnimationLayers[2].isDefault              = false;
                originalAvatar.Descriptor.baseAnimationLayers[2].animatorController = createdGestureController;
                editAvatar.Descriptor.baseAnimationLayers[2].animatorController     = createdGestureController;
            }

            originalAvatar.LoadAvatarInfo();
            editAvatar.LoadAvatarInfo();
        }
Esempio n. 2
0
        public void Initialize(VRCAvatar editAvatar,
                               VRCAvatar originalAvatar,
                               string saveFolderPath,
                               VRCAvatarEditorGUI vrcAvatarEditorGUI,
                               FaceEmotionGUI3 faceEmotionGUI)
        {
            this.editAvatar         = editAvatar;
            this.originalAvatar     = originalAvatar;
            this.vrcAvatarEditorGUI = vrcAvatarEditorGUI;
            this.faceEmotionGUI     = faceEmotionGUI;

            Initialize(saveFolderPath);

            if (editAvatar != null && editAvatar.FxController != null)
            {
                // TODO: AnimationClipのバリデーション機能
            }
        }
Esempio n. 3
0
        public static void CreatePlayableLayerController(VRCAvatar originalAvatar, VRCAvatar editAvatar)
        {
            var fileName       = $"Fx_HandsLayer_{ originalAvatar.Animator.gameObject.name}.controller";
            var saveFolderPath = "Assets/" + originalAvatar.Animator.gameObject.name + "/";
            var fullFolderPath = Path.GetFullPath(saveFolderPath);

            if (!Directory.Exists(fullFolderPath))
            {
                Directory.CreateDirectory(fullFolderPath);
                AssetDatabase.Refresh();
            }
            var createdFxController = InstantiateFxController(Path.Combine(saveFolderPath, fileName));

            // まばたき防止機構をつける
            SetNoBlink(createdFxController);

            if (!originalAvatar.Descriptor.customizeAnimationLayers)
            {
                EnableCustomPlayableLayers(originalAvatar);
                EnableCustomPlayableLayers(editAvatar);
            }
            originalAvatar.Descriptor.baseAnimationLayers[4].isDefault          = false;
            originalAvatar.Descriptor.baseAnimationLayers[4].animatorController = createdFxController;
            editAvatar.Descriptor.baseAnimationLayers[4].isDefault          = false;
            editAvatar.Descriptor.baseAnimationLayers[4].animatorController = createdFxController;

            if (originalAvatar.GestureController is null)
            {
                fileName = $"Gesture_HandsLayer_{ originalAvatar.Animator.gameObject.name}.controller";
                var createdGestureController = InstantiateFxController(Path.Combine(saveFolderPath, fileName));

                originalAvatar.Descriptor.baseAnimationLayers[2].isDefault          = false;
                originalAvatar.Descriptor.baseAnimationLayers[2].animatorController = createdGestureController;
                editAvatar.Descriptor.baseAnimationLayers[2].isDefault          = false;
                editAvatar.Descriptor.baseAnimationLayers[2].animatorController = createdGestureController;
            }

            originalAvatar.LoadAvatarInfo();
            editAvatar.LoadAvatarInfo();
        }
Esempio n. 4
0
 private static void EnableCustomPlayableLayers(VRCAvatar avatar)
 {
     avatar.Descriptor.customizeAnimationLayers = true;
 }