Class ExporterMaterialMapper
Abstract base class for mapping Unity materials to exported formats, including utility methods for handling textures.
Inheritance
Inherited Members
Namespace: TriLibExporter.Mappers
Assembly: Assembly-CSharp.dll
Syntax
public abstract class ExporterMaterialMapper : ScriptableObject
Properties
Priority
Indicates the priority this mapper will be tested. Higher values are tested first.
Declaration
public abstract int Priority { get; }
Property Value
Type | Description |
---|---|
int |
Methods
GetNormalTextureData(AssetWriterContext, Texture)
Retrieves the normal texture data, converting it if necessary.
Declaration
protected static Texture GetNormalTextureData(AssetWriterContext assetWriterContext, Texture texture)
Parameters
Type | Name | Description |
---|---|---|
AssetWriterContext | assetWriterContext | The context of the asset writer. |
Texture | texture | The Unity texture to process. |
Returns
Type | Description |
---|---|
Texture | The processed normal texture. |
GetPNGData(Texture)
Converts a texture to PNG data.
Declaration
public static byte[] GetPNGData(Texture texture)
Parameters
Type | Name | Description |
---|---|---|
Texture | texture | The texture to convert. |
Returns
Type | Description |
---|---|
byte[] | The PNG data as a byte array. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if the texture is null or has no data. |
GetTextureData(AssetWriterContext, Texture)
Retrieves texture data, converting it if necessary.
Declaration
protected static Texture GetTextureData(AssetWriterContext assetWriterContext, Texture texture)
Parameters
Type | Name | Description |
---|---|---|
AssetWriterContext | assetWriterContext | The context of the asset writer. |
Texture | texture | The Unity texture to process. |
Returns
Type | Description |
---|---|
Texture | The processed texture data. |
GetTextureData(AssetWriterContext, Texture, int, bool)
Retrieves texture data for a specific channel, converting it if necessary.
Declaration
protected static Texture GetTextureData(AssetWriterContext assetWriterContext, Texture texture, int channelIndex, bool invert = false)
Parameters
Type | Name | Description |
---|---|---|
AssetWriterContext | assetWriterContext | The context of the asset writer. |
Texture | texture | The Unity texture to process. |
int | channelIndex | The channel index to extract. |
bool | invert | Whether to invert the channel data. |
Returns
Type | Description |
---|---|
Texture | The processed texture data. |
IsCompatible(AssetWriterContext, Material)
Returns whether this mapper is compatible with the current context.
Declaration
public abstract bool IsCompatible(AssetWriterContext context, Material material)
Parameters
Type | Name | Description |
---|---|---|
AssetWriterContext | context | |
Material | material |
Returns
Type | Description |
---|---|
bool |
Map(ExporterMaterialMapperContext)
Maps a material context to the export format.
Declaration
public abstract void Map(ExporterMaterialMapperContext materialMapperContext)
Parameters
Type | Name | Description |
---|---|---|
ExporterMaterialMapperContext | materialMapperContext | The material mapping context. |
SaveTexture(AssetWriterContext, Texture)
Saves a texture to a PNG file.
Declaration
public static void SaveTexture(AssetWriterContext assetWriterContext, Texture texture)
Parameters
Type | Name | Description |
---|---|---|
AssetWriterContext | assetWriterContext | The context of the asset writer. |
Texture | texture | The texture to save. |