TilePlus Version 5
Unity3D Tilemap Extension
Loading...
Searching...
No Matches
TilePlus.TpTileBundle Class Reference

An asset used to bundle-up tiles for later re-creation. Since Transforms, Colors, and Flags values are often the same, those are indexed to save space. Note this is a partial class. More...

Inheritance diagram for TilePlus.TpTileBundle:
Collaboration diagram for TilePlus.TpTileBundle:

Classes

class  PrefabItem
 Prefab info for use when loading tilesets. More...
class  TilePlusItem
 Specification for one TilePlus tile. More...
class  TilePosition
 What's at one particular position. More...
class  TilesetItem
 Class with info about tiles. IEnumerable of instances of this is returned from Tileset method. More...
class  UnityTileItem
 specification for one Unity tile More...

Public Types

enum  TilemapRotation { Zero , Ninety , OneEighty , TwoSeventy }
 Enum of rotation types. More...

Public Member Functions

TileChangeData[] Dictionary< Vector3Int, string > dict TilesetChangeData (TilemapRotation rotation, Vector3Int offset, FabOrBundleLoadFlags loadFlags, Func< FabOrBundleFilterType, BoundsInt, object, bool >? filter=null)
List< TilesetItemTileset (TilemapRotation rotation, FabOrBundleLoadFlags loadFlags, Func< FabOrBundleFilterType, BoundsInt, object, bool >? filter=null)
 Get an array of TilesetItem instances with all the information that's needed to populate a Tilemap with the tiles contained in the asset.
bool Chunkify (TpZoneLayout layout)
 Break up this bundle into chunks. Assumption is that this bundle is from a grid selection so all of the BoundsInts are the same: same value and all are power of two aligned and square in size.
bool LoadCachedTileChangeData (RectInt locator, Tilemap map)
 Get a set of TileChangeData for a particular locator (offset = locator.position) and load it to a tilemap.
void GetAllPositions (List< Vector3Int > output)
 Get an array of all positions used by this bundle. NOTE that these are relative positions and NOT actual tilemap positions.
void ClearCache (bool alsoClearLastCompleteTileset=false)
 Clear the Unity tiles' cache v4.1+ also optionally clears lastCompleteTileset.
bool AddGuid ()
 Add a GUID to this asset. Only works once.
TilePlusBase FindMatchingTpTile (Vector3Int position)
 Find the TilePlus tile for a position.
TileBase? FindMatchingUnityTile (Vector3Int position)
 Find the Unity tile for a position.
void GenerateInitialData ()
 Generate initial JSON GUID-SaveData sets. Note that this only applies to use of SaveDataWrapper and StringPacket.

Public Attributes

TileChangeData[] data
 Get TileChangeData from the Bundle's TileSet.
string? m_TimeStamp
 The timestamp for this asset.
string m_ScenePath = string.Empty
 The scene path when this asset was created.
string m_OriginalScene = string.Empty
 The original scene this was created from.
bool m_FromGridSelection
 set true if this bundle was created from a GridSelection rather than an entire tilemap.
bool m_IgnoreInPainter
 Set true if Painter should not show this in its Palettes list.
bool m_UserFlag
 Arbitrary boolean for use when filtering layouts.
string m_UserString = string.Empty
 Arbitrary string for use when filtering layouts.
Spritem_Icon
 Added in V3. A representative sprite. Painter will display this UNLESS it's packed in an atlas.
BoundsInt m_TilemapBoundsInt
 The bounds int for this tilemap.
List< TilePlusItemm_TilePlusTiles = new()
 The tileplus tiles for this tilemap.
List< UnityTileItemm_UnityTiles = new()
 The Unity tiles for this tilemap.
List< PrefabItemm_Prefabs = new()
 The prefabs for this tilemap.
TileFlags?[] m_TileFlags
 An array of indexed tile flags.
Matrix4x4?[] m_TileTransforms
 An array of indexed tile transforms.
Color?[] m_TileColors
 An array of indexed tile colors.
int m_TotalChunkedUtiles
 If Chunkified, this is total number of Unity tiles in the fabZoneToCachedUtileMap.
int m_TotalChunkedTtiles
 If Chunkified, this is total number of TPT tiles in the fabZoneToCachedUtileMap.
string?[] m_PersistableGuids
 The set of TPT tile GUIDs for this bundle.
string?[] m_PersistableJson
 The set of TPT tile JSON: the preserved state.

Properties

float ElapsedTime [get]
 Elapsed time for the Chunkify process.
bool IsChunkified [get]
 is this tilefab chunkified?
List< TilesetItemUnityTileCache [get]
 Get the current cache of Unity tiles. This may have been affected by filtering.
List< TilesetItem >? LastCompleteTileset [get]
 Get the last complete Tileset created by Tileset. May have been affected by filtering.
Guid BundleGuid [get]
 Get the asset's GUID as a GUID struct.
bool Valid [get]
 Returns true if this asset was sealed. That's determined by checking to see if m_TileFlags != null, since if Seal was never called then that field would be null.
bool EmptyBundle [get]
 Returns true if this bundle has no tiles or prefabs.
string AssetGuidString [get]
 Get a string representation of the GUID.
byte AssetVersion [get]
 Gets the asset version.
string CacheState [get]
 Display cache state.
bool CacheForceFilter [get, set]
 Set true to force the U-tiles cache to use a provided filter. THE VALUE IF THIS PROPERTY IS CLEARED AFTER THE NEXT USE OF TileSet() or TileSetChangeData.

Detailed Description

An asset used to bundle-up tiles for later re-creation. Since Transforms, Colors, and Flags values are often the same, those are indexed to save space. Note this is a partial class.

Version 2 adds GUIDs

Member Enumeration Documentation

◆ TilemapRotation

Enum of rotation types.

Enumerator
Zero 

No rotation.

Ninety 

90 degrees rotation

OneEighty 

180 degrees rotation

TwoSeventy 

270 degrees rotation

Member Function Documentation

◆ AddGuid()

bool TilePlus.TpTileBundle.AddGuid ( )

Add a GUID to this asset. Only works once.

Returns
true if the GUID was added, false if there already was a GUID

◆ Chunkify()

bool TilePlus.TpTileBundle.Chunkify ( TpZoneLayout layout)

Break up this bundle into chunks. Assumption is that this bundle is from a grid selection so all of the BoundsInts are the same: same value and all are power of two aligned and square in size.

Parameters
layoutZone layout

◆ ClearCache()

void TilePlus.TpTileBundle.ClearCache ( bool alsoClearLastCompleteTileset = false)

Clear the Unity tiles' cache v4.1+ also optionally clears lastCompleteTileset.

◆ FindMatchingTpTile()

TilePlusBase TilePlus.TpTileBundle.FindMatchingTpTile ( Vector3Int position)

Find the TilePlus tile for a position.

Parameters
positionPosition
Returns
Tile instance or null if not found

◆ FindMatchingUnityTile()

TileBase? TilePlus.TpTileBundle.FindMatchingUnityTile ( Vector3Int position)

Find the Unity tile for a position.

Parameters
positionPosition
Returns
the tile instance or null if not found

◆ GenerateInitialData()

void TilePlus.TpTileBundle.GenerateInitialData ( )

Generate initial JSON GUID-SaveData sets. Note that this only applies to use of SaveDataWrapper and StringPacket.

◆ GetAllPositions()

void TilePlus.TpTileBundle.GetAllPositions ( List< Vector3Int > output)

Get an array of all positions used by this bundle. NOTE that these are relative positions and NOT actual tilemap positions.

Note that any filtering or caching does not affect the return value. It is solely based on what's in the Bundle.

◆ LoadCachedTileChangeData()

bool TilePlus.TpTileBundle.LoadCachedTileChangeData ( RectInt locator,
Tilemap map )

Get a set of TileChangeData for a particular locator (offset = locator.position) and load it to a tilemap.

Parameters
locatorthe locator
maptarget TileMap
Returns
false if an error.

◆ Tileset()

List< TilesetItem > TilePlus.TpTileBundle.Tileset ( TilemapRotation rotation,
FabOrBundleLoadFlags loadFlags,
Func< FabOrBundleFilterType, BoundsInt, object, bool >? filter = null )

Get an array of TilesetItem instances with all the information that's needed to populate a Tilemap with the tiles contained in the asset.

Parameters
rotationRotation (unimplemented)
filtera Func returning a bool.
loadFlagsControl Flags. See TileFabLib
Returns
List<TilesetItem>.

◆ TilesetChangeData()

TileChangeData[] Dictionary< Vector3Int, string > dict TilePlus.TpTileBundle.TilesetChangeData ( TilemapRotation rotation,
Vector3Int offset,
FabOrBundleLoadFlags loadFlags,
Func< FabOrBundleFilterType, BoundsInt, object, bool >? filter = null )

Member Data Documentation

◆ data

TileChangeData [] TilePlus.TpTileBundle.data

Get TileChangeData from the Bundle's TileSet.

Parameters
rotation
offsetThe offset to use for normalizing positions if this Bundle is from a grid selection.
loadFlagscontrol flags. See TileFabLib
filterFunc returning a bool
Returns
Tuple with TileChangeData array and position->GUID dictionary. Note it's possible for the dict to have null entries if there are no TPT tiles

◆ m_FromGridSelection

bool TilePlus.TpTileBundle.m_FromGridSelection

set true if this bundle was created from a GridSelection rather than an entire tilemap.

◆ m_Icon

Sprite? TilePlus.TpTileBundle.m_Icon

Added in V3. A representative sprite. Painter will display this UNLESS it's packed in an atlas.

◆ m_IgnoreInPainter

bool TilePlus.TpTileBundle.m_IgnoreInPainter

Set true if Painter should not show this in its Palettes list.

◆ m_OriginalScene

string TilePlus.TpTileBundle.m_OriginalScene = string.Empty

The original scene this was created from.

◆ m_PersistableGuids

string? [] TilePlus.TpTileBundle.m_PersistableGuids

The set of TPT tile GUIDs for this bundle.

◆ m_PersistableJson

string? [] TilePlus.TpTileBundle.m_PersistableJson

The set of TPT tile JSON: the preserved state.

◆ m_Prefabs

List<PrefabItem> TilePlus.TpTileBundle.m_Prefabs = new()

The prefabs for this tilemap.

◆ m_ScenePath

string TilePlus.TpTileBundle.m_ScenePath = string.Empty

The scene path when this asset was created.

◆ m_TileColors

Color? [] TilePlus.TpTileBundle.m_TileColors

An array of indexed tile colors.

◆ m_TileFlags

TileFlags? [] TilePlus.TpTileBundle.m_TileFlags

An array of indexed tile flags.

◆ m_TilemapBoundsInt

BoundsInt TilePlus.TpTileBundle.m_TilemapBoundsInt

The bounds int for this tilemap.

◆ m_TilePlusTiles

List<TilePlusItem> TilePlus.TpTileBundle.m_TilePlusTiles = new()

The tileplus tiles for this tilemap.

◆ m_TileTransforms

Matrix4x4? [] TilePlus.TpTileBundle.m_TileTransforms

An array of indexed tile transforms.

◆ m_TimeStamp

string? TilePlus.TpTileBundle.m_TimeStamp

The timestamp for this asset.

◆ m_TotalChunkedTtiles

int TilePlus.TpTileBundle.m_TotalChunkedTtiles

If Chunkified, this is total number of TPT tiles in the fabZoneToCachedUtileMap.

◆ m_TotalChunkedUtiles

int TilePlus.TpTileBundle.m_TotalChunkedUtiles

If Chunkified, this is total number of Unity tiles in the fabZoneToCachedUtileMap.

◆ m_UnityTiles

List<UnityTileItem> TilePlus.TpTileBundle.m_UnityTiles = new()

The Unity tiles for this tilemap.

◆ m_UserFlag

bool TilePlus.TpTileBundle.m_UserFlag

Arbitrary boolean for use when filtering layouts.

◆ m_UserString

string TilePlus.TpTileBundle.m_UserString = string.Empty

Arbitrary string for use when filtering layouts.

Property Documentation

◆ AssetGuidString

string TilePlus.TpTileBundle.AssetGuidString
get

Get a string representation of the GUID.

◆ AssetVersion

byte TilePlus.TpTileBundle.AssetVersion
get

Gets the asset version.

The asset version.

◆ BundleGuid

Guid TilePlus.TpTileBundle.BundleGuid
get

Get the asset's GUID as a GUID struct.

The unique identifier.

◆ CacheForceFilter

bool TilePlus.TpTileBundle.CacheForceFilter
getset

Set true to force the U-tiles cache to use a provided filter. THE VALUE IF THIS PROPERTY IS CLEARED AFTER THE NEXT USE OF TileSet() or TileSetChangeData.

Also clears the cache for you.

◆ CacheState

string TilePlus.TpTileBundle.CacheState
get

Display cache state.

string

◆ ElapsedTime

float TilePlus.TpTileBundle.ElapsedTime
get

Elapsed time for the Chunkify process.

◆ EmptyBundle

bool TilePlus.TpTileBundle.EmptyBundle
get

Returns true if this bundle has no tiles or prefabs.

◆ IsChunkified

bool TilePlus.TpTileBundle.IsChunkified
get

is this tilefab chunkified?

◆ LastCompleteTileset

List<TilesetItem>? TilePlus.TpTileBundle.LastCompleteTileset
get

Get the last complete Tileset created by Tileset. May have been affected by filtering.

◆ UnityTileCache

List<TilesetItem> TilePlus.TpTileBundle.UnityTileCache
get

Get the current cache of Unity tiles. This may have been affected by filtering.

◆ Valid

bool TilePlus.TpTileBundle.Valid
get

Returns true if this asset was sealed. That's determined by checking to see if m_TileFlags != null, since if Seal was never called then that field would be null.

Updated in 2.1 to include a check for no prefabs. Permits use of prefab-only bundles.


The documentation for this class was generated from the following files:
  • /Users/jms/Documents/Tpt_55/TPT55/Assets/Plugins/TilePlus/Runtime/AssetScripts/Bundles/TpTileBundle.cs
  • /Users/jms/Documents/Tpt_55/TPT55/Assets/Plugins/TilePlus/Runtime/AssetScripts/Bundles/TpTileBundleData.cs