public Element AddElement( Texture2D _tex, bool _trim )
{
if ( exTextureHelper.IsValidForAtlas (_tex) == false )
exTextureHelper.ImportTextureForAtlas(_tex);
//
exAtlasInfo.Element el = new exAtlasInfo.Element();
if ( _trim ) {
el.trimRect = exTextureHelper.GetTrimTextureRect(_tex);
}
else {
el.trimRect = new Rect( 0, 0, _tex.width, _tex.height );
}
el.rotated = false;
el.trim = _trim;
el.atlasInfo = this;
el.texture = _tex;
el.coord[0] = 0;
el.coord[1] = 0;
elements.Add(el);
// get sprite animation clip by textureGUID, add them to rebuildAnimClipGUIDs
AddSpriteAnimClipForRebuilding(el);
//
needRebuild = true;
EditorUtility.SetDirty(this);
return el;
}