Ejemplo n.º 1
0
        public static void MA_CheckTextureAtlas(MA_TextureAtlasserProAtlas atlas)
        {
            if (atlas.textureGroupRegistration == null)
            {
                atlas.textureGroupRegistration = new List <MA_TextureGroupRegistration>();

                MA_TextureGroupRegistration groupRegistration = new MA_TextureGroupRegistration
                {
                    name = DEFAULT_TEXTURE_GROUP_NAME
                };

                atlas.textureGroupRegistration.Add(groupRegistration);
            }

            if (atlas.textureQuads == null)
            {
                atlas.textureQuads = new List <MA_TextureAtlasserProQuad>();
            }
            else
            {
                bool _sameCount = true;
                foreach (MA_TextureAtlasserProQuad q in atlas.textureQuads)
                {
                    if (q.textureGroups.Count != atlas.textureGroupRegistration.Count)
                    {
                        _sameCount = false;
                        Debug.LogWarning("TextureAtlasser: " + q.name + " doesn't have the right amount of texture groups!");
                    }
                }

                if (_sameCount)
                {
                    foreach (MA_TextureAtlasserProQuad q in atlas.textureQuads)
                    {
                        for (int i = 0; i < atlas.textureQuads.Count; i++)
                        {
                            for (int j = 0; j < atlas.textureGroupRegistration.Count; j++)
                            {
                                if (atlas.textureQuads[i].textureGroups[j].name != atlas.textureGroupRegistration[j].name)
                                {
                                    Debug.LogWarning("TextureAtlasser: " + q.name + " doesn't have the right texture group name!");
                                }
                            }
                        }
                    }
                }
            }

            if (atlas.exportSettings == null)
            {
                atlas.exportSettings = LoadExportSettings();
            }
        }
        public static void CreateTextureGroup(MA_TextureAtlasserProAtlas atlas, string name)
        {
            MA_TextureGroupRegistration _textureGroupRegistration = new MA_TextureGroupRegistration();

            _textureGroupRegistration.name = name;
            atlas.textureGroupRegistration.Add(_textureGroupRegistration);

            foreach (MA_TextureAtlasserProQuad q in atlas.textureQuads)
            {
                MA_TextureGroup _textureGroup = new MA_TextureGroup();
                _textureGroup.name = name;
                q.textureGroups.Add(_textureGroup);
            }
        }