PipelineChanger 1.0.0
by Black Rose Projects
Loading...
Searching...
No Matches
MaterialConverter Class Reference

Description

Base class of converters
Inherit from CustomConverter instead of this if you need to create your own converter.

Public Types

enum  UpgradeFlags { None = 0 , CleanupNonUpgradedProperties = 2 }
 

Public Member Functions

delegate void MaterialFinalizer (Material mat)
 
virtual void Convert (Material originalMaterial, Material copyMaterial)
 
void RenameShader (Shader oldShader, Shader newShader, MaterialFinalizer finalizer=null)
 
void SetFinalizer (MaterialFinalizer finalizer)
 
void RenameShader (string oldShaderName, string newShaderName, MaterialFinalizer finalizer=null)
 
void RenameTexture (int source, params int[] target)
 
void RenameTexture (string source, string target)
 
void RenameFloat (int source, params int[] target)
 
void RenameFloat (string source, string target)
 
void RenameColor (int source, params int[] target)
 
void RenameColor (string source, string target)
 
void RemoveTexture (int source)
 
void RemoveTexture (string source)
 
void SetFloat (int property, float value)
 
void SetFloat (string property, float value)
 
void SetColor (int property, Color value)
 
void SetColor (string property, Color value)
 
void SetTexture (int property, Texture value)
 
void SetTexture (string property, Texture value)
 
void RenameInt (int source, params int[] target)
 
void RenameInt (string source, int value)
 
void RenameVector (int source, params int[] target)
 
void RenameVector (string source, string target)
 
void RenameRange (int source, params int[] target)
 
void RenameRange (string source, string target)
 
void RenameKeywordToFloat (string oldName, string newName, float setVal, float unsetVal)
 
void EnableKeyworld (string keyworld)
 

Static Public Member Functions

static void ProcessConvertion (Material material, MaterialConverter upgrader, UpgradeFlags flags=UpgradeFlags.CleanupNonUpgradedProperties)
 
static void ProcessConvertion (Material material, List< MaterialConverter > upgraders, UpgradeFlags flags)
 
static void ProcessConvertion (Material material, List< CustomConverter > upgraders, UpgradeFlags flags)
 

Member Enumeration Documentation

◆ UpgradeFlags

Flags for conversion.

Enumerator
None 

Do no additional stuff, convert data, but leave old fields in material.

CleanupNonUpgradedProperties 

Cleanup all data that is not included in conversion pocess.

Member Function Documentation

◆ Convert()

virtual void Convert ( Material originalMaterial,
Material copyMaterial )
virtual

Convert Material with using temporary material to store value with convertion rules
Used by ProcessMaterial(Material, UpgradeFlags)

Parameters
originalMaterialMaterial currently during conversion process
copyMaterialtemporary Material to store variables values

◆ EnableKeyworld()

void EnableKeyworld ( string keyworld)

Enable given Keyworld in material.

Parameters
keyworldKeyworld to enable

◆ MaterialFinalizer()

delegate void MaterialFinalizer ( Material mat)

Material Upgrader finalizer delegate.

Parameters
matMaterial

◆ ProcessConvertion() [1/3]

static void ProcessConvertion ( Material material,
List< CustomConverter > upgraders,
UpgradeFlags flags )
static

Convert material with Converter to other shader, with collection of converters.
Automatic detection which converterr shoud be used from Converter collection.

Parameters
materialMaterial that will be converted
upgradersCollection of Converters
flagsSpecial Upgrading flags

◆ ProcessConvertion() [2/3]

static void ProcessConvertion ( Material material,
List< MaterialConverter > upgraders,
UpgradeFlags flags )
static

Convert material with Converter to other shader, with collection of converters.
Automatic detection which converterr shoud be used from Converter collection.

Parameters
materialMaterial that will be converted
upgradersCollection of Converters
flagsSpecial Upgrading flags

◆ ProcessConvertion() [3/3]

static void ProcessConvertion ( Material material,
MaterialConverter upgrader,
UpgradeFlags flags = UpgradeFlags::CleanupNonUpgradedProperties )
static

Convert material with Converter to other shader.

Parameters
materialMaterial that will be converted
upgraderUpgrader with specific convertion instructions
flagsSpecial Upgrading flags

◆ RemoveTexture() [1/2]

void RemoveTexture ( int source)

Add Texture to remove from material during conversion
Use Shader.PropertyToID to get int ID of property.

Parameters
sourceShader.PropertyToID of targeted Texture property

◆ RemoveTexture() [2/2]

void RemoveTexture ( string source)

Better to use non-string version.
Add Texture to remove from material during conversion

Parameters
sourcename of targeted Texture property

◆ RenameColor() [1/2]

void RenameColor ( int source,
params int[] target )

Map Color property to other Color property
Use Shader.PropertyToID to get int ID of property.

Parameters
sourceShader.PropertyToID of original Color property
targetShader.PropertyToID of targeted Color property or array of them

◆ RenameColor() [2/2]

void RenameColor ( string source,
string target )

Better to use non-string version.
Map Color property to other Color property.

Parameters
sourcename of Color property to map
targetname of Color property to transfer

◆ RenameFloat() [1/2]

void RenameFloat ( int source,
params int[] target )

Map float property to other float property
Use Shader.PropertyToID to get int ID of property.

Parameters
sourceShader.PropertyToID of original float property
targetShader.PropertyToID of targeted float property or array of them

◆ RenameFloat() [2/2]

void RenameFloat ( string source,
string target )

Better to use non-string version.
Map float property to other float property.

Parameters
sourcename of float property to map
targetname of float property to transfer

◆ RenameInt() [1/2]

void RenameInt ( int source,
params int[] target )

Map int property to other int property
Use Shader.PropertyToID to get int ID of property.

Parameters
sourceShader.PropertyToID of original int property
targetShader.PropertyToID of targeted int property or array of them

◆ RenameInt() [2/2]

void RenameInt ( string source,
int value )

Better to use non-string version.
Map int property to other int property

Parameters
sourcename of targeted int property
valueint value of property to set during convertion

◆ RenameKeywordToFloat()

void RenameKeywordToFloat ( string oldName,
string newName,
float setVal,
float unsetVal )

Renaming float-keyworld property.

Parameters
oldName
newName
setVal
unsetVal

◆ RenameRange() [1/2]

void RenameRange ( int source,
params int[] target )

Map Range property to other range property
Use Shader.PropertyToID to get int ID of property.

Parameters
sourceShader.PropertyToID of original property
targetShader.PropertyToID of targeted property

◆ RenameRange() [2/2]

void RenameRange ( string source,
string target )

Better to use non-string version.
Map Range property to other range property

Parameters
sourcename of original property
targetname of targeted property

◆ RenameShader() [1/2]

void RenameShader ( Shader oldShader,
Shader newShader,
MaterialFinalizer finalizer = null )

Most important method for converter. Map Shader together for convertion.
Suggested to use in constructor.

Parameters
oldShaderShader that will be converted
newShaderConvertion targer
finalizerOptional - MaterialFinalizer(Material) delegate for additional stuff to do after mapped variable convertion

◆ RenameShader() [2/2]

void RenameShader ( string oldShaderName,
string newShaderName,
MaterialFinalizer finalizer = null )

Better to use non-string version.
Most important method for converter. Map Shader together for convertion.
Suggested to use in constructor.

Parameters
oldShaderNameShader that will be converted
newShaderNameConvertion targer
finalizerOptional - MaterialFinalizer(Material) delegate for additional stuff to do after mapped variable convertion

◆ RenameTexture() [1/2]

void RenameTexture ( int source,
params int[] target )

Map Texture to other Texture property.
Use Shader.PropertyToID to get int ID of property.

Parameters
sourceShader.PropertyToID of original Texture property
targetShader.PropertyToID of targeted Texture property or array of them

◆ RenameTexture() [2/2]

void RenameTexture ( string source,
string target )

Better to use non-string version.
Map Texture property to other Texture property.

Parameters
sourcename of Texture property to map
targetname of Texture property to transfer

◆ RenameVector() [1/2]

void RenameVector ( int source,
params int[] target )

Map Vector4 property to other Vector4 property
Use Shader.PropertyToID to get int ID of property.

Parameters
sourceShader.PropertyToID of original Vector4 property
targetShader.PropertyToID of targeted Vector4 property or array of them

◆ RenameVector() [2/2]

void RenameVector ( string source,
string target )

Better to use non-string version.
Map Vector4 property to other Vector4 property

Parameters
sourcename of targeted Vector4 property
targetVector4 value of property to set during convertion

◆ SetColor() [1/2]

void SetColor ( int property,
Color value )

Set Color property to specific value
Use Shader.PropertyToID to get int ID of property.

Parameters
propertyShader.PropertyToID of property
valueColor value of property to set during convertion

◆ SetColor() [2/2]

void SetColor ( string property,
Color value )

Better to use non-string version.
Set Color property to specific value.

Parameters
propertyname of targeted Color property
valueColor value of property to set during convertion

◆ SetFinalizer()

void SetFinalizer ( MaterialFinalizer finalizer)

Set finalizer to given method.

Parameters
finalizer

◆ SetFloat() [1/2]

void SetFloat ( int property,
float value )

Set float property to specific value
Use Shader.PropertyToID to get int ID of property.

Parameters
propertyShader.PropertyToID of property
valuefloat value of property to set during convertion

◆ SetFloat() [2/2]

void SetFloat ( string property,
float value )

Better to use non-string version.
Set float property to specific value.

Parameters
propertyname of targeted float property
valuefloat value of property to set during convertion

◆ SetTexture() [1/2]

void SetTexture ( int property,
Texture value )

Set Texture property to specific value Use Shader.PropertyToID to get int ID of property.

Parameters
propertyShader.PropertyToID of property
valueTexture value of property to set during convertion

◆ SetTexture() [2/2]

void SetTexture ( string property,
Texture value )

Better to use non-string version.
Set Texture property to specific value.

Parameters
propertyname of targeted Texture property
valueTexture value of property to set during convertion