Beispiel #1
0
        void OnEnable()
        {
            System.IO.DirectoryInfo directoyInfo = new System.IO.DirectoryInfo(LipsyncFileUtility.unigayoPath + folderPath);
            Debug.Log(directoyInfo.FullName);

            LipsyncFileUtility.WalkDirectoryRecursively(directoyInfo, ".asset", fileInfo =>
            {
                string path = fileInfo.FullName.Replace("\\", "/");

                string relativePath = "Assets" + path.Replace(Application.dataPath, "");
                Debug.Log("Rel path " + relativePath);

                LipsyncMouthSetCreatorSettings settings;
                settings = (LipsyncMouthSetCreatorSettings)
                           AssetDatabase.LoadAssetAtPath(relativePath, typeof(LipsyncMouthSetCreatorSettings));

                settings.filePath = fileInfo.FullName;
                allSettings.Add(settings);
            });

            if (allSettings.Count <= 0)
            {
                currentSettings = ScriptableObject.CreateInstance <LipsyncMouthSetCreatorSettings>();
                AssetDatabase.CreateAsset(currentSettings, DefaultPath);

                allSettings.Add(currentSettings);

                Debug.Log("had to add one");
            }
            else
            {
                Debug.Log("there is something");
                currentSettings = allSettings[0];
            }
        }
Beispiel #2
0
        public static LipsyncSequenceDatabase BuildDatabase(DirectoryInfo directory)
        {
            LipsyncSequenceDatabase database = ScriptableObject.CreateInstance <LipsyncSequenceDatabase>();

            DirectoryWalkCallback callback = filePath =>
            {
                string[] lines = File.ReadAllLines(filePath.FullName);
                string   name  = filePath.Name.Replace(LipsyncAutomation.fileEnding, "");

                LipsyncSequence sequence = LipsyncSequenceFactory.BuildSequence(lines, name);

                database.sequences.Add(sequence);
            };

            LipsyncFileUtility.WalkDirectoryRecursively(directory, ".dat", callback);
            return(database);
        }