Example #1
0
        public static void CreateMouthDatabase()
        {
            LipsyncMouthSet database = ScriptableObject.CreateInstance <LipsyncMouthSet>();

            AssetDatabase.CreateAsset(database, "Assets/New Mouth Database.asset");

            Selection.activeObject = database;
        }
Example #2
0
        void CreateMouthSet()
        {
            LipsyncMouthSet set;

            if (LipsyncMouthSetFactory.CreateSet(currentSettings.mouths.ToArray(), currentSettings.spriteAssignment.ToArray(), out set))
            {
                string          path        = currentSettings.exportFolderPath + currentSettings.setName + ".asset";
                LipsyncMouthSet existingSet = (LipsyncMouthSet)AssetDatabase.LoadAssetAtPath(path, typeof(LipsyncMouthSet));
                if (existingSet != null)
                {
                    EditorUtility.CopySerialized(set, existingSet);
                }
                else
                {
                    AssetDatabase.CreateAsset(set, path);
                }
            }
        }
Example #3
0
        public static bool CreateSet(LipsyncMouthSetCreatorSettings.ImportMouth[] importMouths, int[] spriteAssignment, out LipsyncMouthSet set)
        {
            set = ScriptableObject.CreateInstance <LipsyncMouthSet>();

            for (int i = 0; i < importMouths.Length; i++)
            {
                LipsyncPrestonBlairMouth mouth = new LipsyncPrestonBlairMouth();

                mouth.mood = importMouths[i].mood;

                Sprite[] spriteSet = GetSpriteSet(importMouths[i].spritesheet);

                for (int s = 0; s < spriteAssignment.Length; s++)
                {
                    try
                    {
                        mouth[s] = spriteSet[spriteAssignment[s]];
                    }
                    catch (IndexOutOfRangeException e)
                    {
                        Debug.Log("sprite assignment failed " + importMouths[i].spritesheet);
                    }
                }

                set.mouths.Add(mouth);
            }

            return(true);
        }