Пример #1
0
        /// <summary>
        /// Imports the corresponding asset.
        /// </summary>
        public override void Import()
        {
            var isImporterDirty = false;

            var clip = (ShouldImportAsOriginalWorkflow)
                    ? AssetDatabase.LoadAssetAtPath <AnimationClip>(AssetPath.Replace(".motion3.json", ".anim"))
                    : null;

            // Convert motion.
            var animationClip = (clip == null)
                                ? Motion3Json.ToAnimationClip(ShouldImportAsOriginalWorkflow, ShouldClearAnimationCurves)
                                : Motion3Json.ToAnimationClip(clip, ShouldImportAsOriginalWorkflow, ShouldClearAnimationCurves);


            // Create animation clip.
            if (AnimationClip == null)
            {
                AssetDatabase.CreateAsset(animationClip, AssetPath.Replace(".motion3.json", ".anim"));


                AnimationClip = animationClip;


                isImporterDirty = true;
            }

            // Update animation clip.
            else
            {
                EditorUtility.CopySerialized(animationClip, AnimationClip);
                EditorUtility.SetDirty(AnimationClip);


                // Log event.
                CubismImporter.LogReimport(AssetPath, AssetDatabase.GUIDToAssetPath(_animationClipGuid));
            }


            // Trigger event.
            CubismImporter.SendMotionImportEvent(this, AnimationClip);


            // Apply changes.
            if (isImporterDirty)
            {
                Save();
            }
            else
            {
                AssetDatabase.SaveAssets();
                AssetDatabase.Refresh();
            }
        }
        /// <summary>
        /// Imports the corresponding asset.
        /// </summary>
        public override void Import()
        {
            var isImporterDirty = false;


            // Convert motion.
            var animationClip = Motion3Json.ToAnimationClip();


            // Create animation clip.
            if (AnimationClip == null)
            {
                AssetDatabase.CreateAsset(animationClip, AssetPath.Replace(".motion3.json", ".anim"));


                AnimationClip = animationClip;


                isImporterDirty = true;
            }

            // Update animation clip.
            else
            {
                EditorUtility.CopySerialized(animationClip, AnimationClip);
                EditorUtility.SetDirty(AnimationClip);


                // Log event.
                CubismImporter.LogReimport(AssetPath, AssetDatabase.GUIDToAssetPath(_animationClipGuid));
            }


            // Trigger event.
            CubismImporter.SendMotionImportEvent(this, animationClip);


            // Apply changes.
            if (isImporterDirty)
            {
                Save();
            }
            else
            {
                AssetDatabase.SaveAssets();
                AssetDatabase.Refresh();
            }
        }