Table of Contents

Class TexturePreProcessImporter

Namespace
CodeBase.Tool
Assembly
4Experience.CodeBase.Tool.ArtTools.dll

Feature that changes properties of textures that have specific suffix. For "_nor" changes texture type to NormalMap. For "_mas", "_mts", "_aoc" changes sRGB (ColorTexture) to false.

public class TexturePreProcessImporter : AssetPostprocessor
Inheritance
AssetPostprocessor
TexturePreProcessImporter
Extension Methods

Fields

MATERIAL_EXTENSION

private const string MATERIAL_EXTENSION = ".mat"

Field Value

string

URP_LIT_SHADER

private const string URP_LIT_SHADER = "Universal Render Pipeline/Lit"

Field Value

string

Properties

BaseMap

private int BaseMap { get; }

Property Value

int

BumpMap

private int BumpMap { get; }

Property Value

int

CurrentAutomaticTextureAssignSettings

private AutomaticTextureAssignSettings CurrentAutomaticTextureAssignSettings { get; }

Property Value

AutomaticTextureAssignSettings

EmissionMap

private int EmissionMap { get; }

Property Value

int

ExpectedSuffixesForAlbedo

private string[] ExpectedSuffixesForAlbedo { get; }

Property Value

string[]

ExpectedSuffixesForEmission

private string[] ExpectedSuffixesForEmission { get; }

Property Value

string[]

ExpectedSuffixesForHeightMaps

private string[] ExpectedSuffixesForHeightMaps { get; }

Property Value

string[]

ExpectedSuffixesForMetallicGloss

private string[] ExpectedSuffixesForMetallicGloss { get; }

Property Value

string[]

ExpectedSuffixesForNormalMaps

private string[] ExpectedSuffixesForNormalMaps { get; }

Property Value

string[]

ExpectedSuffixesForOcclusion

private string[] ExpectedSuffixesForOcclusion { get; }

Property Value

string[]

ExpectedSuffixesForSrgbColorSpace

private string[] ExpectedSuffixesForSrgbColorSpace { get; }

Property Value

string[]

HeightMap

private int HeightMap { get; }

Property Value

int

MetallicGlossMap

private int MetallicGlossMap { get; }

Property Value

int

OcclusionMap

private int OcclusionMap { get; }

Property Value

int

Methods

ApplyTextureOnMaterial(TextureImporter, AutomaticTextureApplyPreset)

private void ApplyTextureOnMaterial(TextureImporter importer, AutomaticTextureApplyPreset automaticTextureApplyPreset)

Parameters

importer TextureImporter
automaticTextureApplyPreset AutomaticTextureApplyPreset

AutomaticAssignTexturesToMaterial()

private void AutomaticAssignTexturesToMaterial()

CheckIfChangesNeeded(string, string[])

private bool CheckIfChangesNeeded(string name, string[] expectedSuffixes)

Parameters

name string
expectedSuffixes string[]

Returns

bool

GetContainingFolderPath(string)

private string GetContainingFolderPath(string texturePath)

Parameters

texturePath string

Returns

string

GetFileName(string)

private string GetFileName(string texturePath)

Parameters

texturePath string

Returns

string

GetMaterial(TextureImporter)

private Material GetMaterial(TextureImporter importer)

Parameters

importer TextureImporter

Returns

Material

GetShaderPropertyID(string)

private int GetShaderPropertyID(string shaderProperty)

Parameters

shaderProperty string

Returns

int

OnPostprocessTexture(Texture2D)

private void OnPostprocessTexture(Texture2D texture)

Parameters

texture Texture2D

OnPreprocessTexture()

private void OnPreprocessTexture()

SetProperlySettingsOnImportedTexture()

private void SetProperlySettingsOnImportedTexture()