C# Class UIAtlasMaker, DsynBio

Atlas maker lets you create atlases from a bunch of small textures. It's an alternative to using the external Texture Packer.
Inheritance: EditorWindow
ファイルを表示 Open project: CyberCRI/DsynBio Class Usage Examples

Public Methods

Method Description
AddOrUpdate ( UIAtlas, atlas, Texture2D tex ) : void

Add the specified texture to the atlas, or update an existing one.

Private Methods

Method Description
AddSprite ( List sprites, SpriteEntry se ) : UIAtlas.Sprite,

Add a new sprite to the atlas, given the texture it's coming from and the packed rect within the atlas.

Compare ( SpriteEntry a, SpriteEntry b ) : int

Used to sort the sprites by pixels used

CreateSprites ( List textures ) : List

Create a list of sprites using the specified list of textures.

ExtractSprites ( UIAtlas, atlas, List sprites ) : void

Extract sprites from the atlas, adding them to the list.

GetSelectedTextures ( ) : List

Helper function that retrieves the list of currently selected textures.

GetSpriteList ( List textures ) : int>.Dictionary

Helper function that creates a single sprite list from both the atlas's sprites as well as selected textures. Dictionary value meaning: 0 = No change 1 = Update 2 = Add

LoadTextures ( List textures ) : List

Load the specified list of textures as Texture2Ds, fixing their import properties as necessary.

OnGUI ( ) : void

Draw the UI for this tool.

OnSelectAtlas ( MonoBehaviour obj ) : void

Atlas selection callback.

OnSelectionChange ( ) : void

Refresh the window on selection.

PackTextures ( Texture2D tex, List sprites ) : void

Pack all of the specified sprites into a single texture, updating the outer and inner rects of the sprites as needed.

ReleaseSprites ( List sprites ) : void

Release all temporary textures created for the sprites.

ReplaceSprites ( UIAtlas, atlas, List sprites ) : void

Replace the sprites within the atlas.

UpdateAtlas ( List textures, bool keepSprites ) : void

Update the sprites within the texture atlas, preserving the sprites that have not been selected.

UpdateAtlas ( UIAtlas, atlas, List sprites ) : void

Update the sprite atlas, keeping only the sprites that are on the specified list.

UpdateTexture ( UIAtlas, atlas, List sprites ) : Texture2D

Combine all sprites into a single texture and save it to disk.

Method Details

AddOrUpdate() public static method

Add the specified texture to the atlas, or update an existing one.
public static AddOrUpdate ( UIAtlas, atlas, Texture2D tex ) : void
atlas UIAtlas,
tex UnityEngine.Texture2D
return void