Show / Hide Table of Contents

Class TextureReplacement

Handles import and injection of custom textures and images with the purpose of providing modding support. Import materials from mods and textures from mods and loose files.

Inheritance
Object
TextureReplacement
Namespace: DaggerfallWorkshop.Utility.AssetInjection
Assembly: Assembly-CSharp.dll
Syntax
public static class TextureReplacement

Properties

| Improve this Doc View Source

CifRciPath

Path to custom Cif and Rci files on disk.

Declaration
public static string CifRciPath { get; }
Property Value
Type Description
String
| Improve this Doc View Source

ImagesPath

Path to custom images on disk.

Declaration
public static string ImagesPath { get; }
Property Value
Type Description
String
| Improve this Doc View Source

TexturesPath

Path to custom textures on disk.

Declaration
public static string TexturesPath { get; }
Property Value
Type Description
String

Methods

| Improve this Doc View Source

AssignFiltermode(Material)

Assign current filtermode to all standard shader textures of the given material.

Declaration
public static void AssignFiltermode(Material material)
Parameters
Type Name Description
Material material
| Improve this Doc View Source

CustomizeMaterial(Int32, Int32, Int32, Material)

Import additional custom components of material.

Declaration
public static void CustomizeMaterial(int archive, int record, int frame, Material material)
Parameters
Type Name Description
Int32 archive

Archive index

Int32 record

Record index

Int32 frame

Texture frame

Material material

Material.

| Improve this Doc View Source

FileNameToArchive(String)

Parses the ID from the name of a texture archive from classic Daggerfall.

Declaration
public static int FileNameToArchive(string filename)
Parameters
Type Name Description
String filename

A name with format "TEXTURE.XXX".

Returns
Type Description
Int32

The number parsed from "XXX".

See Also
IndexToFileName(Int32)
| Improve this Doc View Source

GetMobileBillboardMaterial(Int32, MeshFilter, ref MobileBillboardImportedTextures)

Gets a custom material for a mobile billboard with textures and configuration imported from mods.

Declaration
public static Material GetMobileBillboardMaterial(int archive, MeshFilter meshFilter, ref MobileBillboardImportedTextures importedTextures)
Parameters
Type Name Description
Int32 archive

Archive index.

MeshFilter meshFilter

The MeshFilter of the billboard object.

MobileBillboardImportedTextures importedTextures

All the imported textures for the archive.

Returns
Type Description
Material

A material or null.

Remarks

Seek the texture for the first frame of the first record. If found, it imports the entire archive. If this texture has an emission map the material is considered emissive and all emission maps are imported.

| Improve this Doc View Source

GetName(Int32, Int32, Int32, TextureMap, DyeColors)

Get name for a texture.

Declaration
public static string GetName(int archive, int record, int frame = 0, TextureMap textureMap = TextureMap.Albedo, DyeColors dye = DyeColors.Chain)
Parameters
Type Name Description
Int32 archive

Archive index from TEXTURE.XXX

Int32 record

Record index.

Int32 frame

Frame index. It's different than zero only for animations.

TextureMap textureMap

Texture type.

DyeColors dye

Color Dye.

Returns
Type Description
String

The name for the texture with requested options.

| Improve this Doc View Source

GetNameCifRci(String, Int32, Int32)

Get name for a CifRci image.

Declaration
public static string GetNameCifRci(string filename, int record, int frame = 0)
Parameters
Type Name Description
String filename

Name of CIF/RCI file.

Int32 record

Record index.

Int32 frame

Frame index. It's different than zero only for animations.

Returns
Type Description
String
| Improve this Doc View Source

GetNameCifRci(String, Int32, Int32, MetalTypes)

Get name for a CifRci image with a metal type.

Declaration
public static string GetNameCifRci(string filename, int record, int frame, MetalTypes metalType)
Parameters
Type Name Description
String filename

Name of CIF/RCI file.

Int32 record

Record index.

Int32 frame

Frame index. It's different than zero only for animations.

MetalTypes metalType

Metal type of weapon.

Returns
Type Description
String
| Improve this Doc View Source

GetNameTexArray(Int32, TextureMap)

Gets name for a texture array.

Declaration
public static string GetNameTexArray(int archive, TextureMap textureMap = TextureMap.Albedo)
Parameters
Type Name Description
Int32 archive

Archive index from TEXTURE.XXX

TextureMap textureMap

Texture type.

Returns
Type Description
String

The name for the texture array with requested options.

| Improve this Doc View Source

GetSize(Texture2D, String, Boolean)

Get a safe size for a control based on resolution of img.

Declaration
public static Vector2 GetSize(Texture2D texture, string textureName, bool allowXml = false)
Parameters
Type Name Description
Texture2D texture
String textureName
Boolean allowXml
Returns
Type Description
Vector2
| Improve this Doc View Source

GetSize(Texture2D, String, Int32, Int32)

Get a safe size for a control based on resolution of cif or rci.

Declaration
public static Vector2 GetSize(Texture2D texture, string textureName, int record, int frame = 0)
Parameters
Type Name Description
Texture2D texture
String textureName
Int32 record
Int32 frame
Returns
Type Description
Vector2
| Improve this Doc View Source

GetStaticBillboardMaterial(GameObject, Int32, Int32, ref BillboardSummary, out Vector2)

Gets a custom material for a static billboard with textures and configuration imported from mods.

Declaration
public static Material GetStaticBillboardMaterial(GameObject go, int archive, int record, ref BillboardSummary summary, out Vector2 scale)
Parameters
Type Name Description
GameObject go

The billboard object.

Int32 archive

Archive index.

Int32 record

Record index.

BillboardSummary summary

Summary data of the billboard object.

Vector2 scale

Custom local scale for the billboard.

Returns
Type Description
Material

A material or null.

Remarks

Seek the texture for the first frame of the given record. If found, it imports all other frames. Always creates an emission map for textures marked as emissive by TextureReader, import emission maps for others only if available.

| Improve this Doc View Source

IsDaggerfallTexture(String, out Int32, out Int32)

Get archive and record from "archive_record-0" string.

Declaration
public static bool IsDaggerfallTexture(string name, out int archive, out int record)
Parameters
Type Name Description
String name

"archive_record-frame string."

Int32 archive

Archive index.

Int32 record

Record index.

Returns
Type Description
Boolean

True if texture is a Daggerfall texture.

| Improve this Doc View Source

IsLinearTextureMap(TextureMap)

Determine if texture map is of a linear type.

Declaration
public static bool IsLinearTextureMap(TextureMap textureMap)
Parameters
Type Name Description
TextureMap textureMap

Texture map type.

Returns
Type Description
Boolean

True if this texture should be loaded as linear.

| Improve this Doc View Source

MakeResults(Material, Int32, Int32)

Makes texture results for given material.

Declaration
public static GetTextureResults MakeResults(Material material, int archive, int record)
Parameters
Type Name Description
Material material

Unity material.

Int32 archive

Texture archive.

Int32 record

Record index.

Returns
Type Description
GetTextureResults

Results for the given material.

| Improve this Doc View Source

SetBillboardScale(Int32, Int32, ref Vector2)

Read scale from xml and apply to given vector.

Declaration
public static void SetBillboardScale(int archive, int record, ref Vector2 size)
Parameters
Type Name Description
Int32 archive
Int32 record
Vector2 size
| Improve this Doc View Source

TextureExistsAmongLooseFiles(Int32, Int32, Int32, TextureMap)

Seek a texture on disk inside TexturesPath without importing it.

Declaration
public static bool TextureExistsAmongLooseFiles(int archive, int record, int frame = 0, TextureMap textureMap = TextureMap.Albedo)
Parameters
Type Name Description
Int32 archive

Texture archive.

Int32 record

Record index.

Int32 frame

Frame index.

TextureMap textureMap

Texture type.

Returns
Type Description
Boolean

True if texture is found.

| Improve this Doc View Source

TryCustomizeButton(ref Button, String)

Import custom texture and label settings for buttons. This feature has been deprecated in favor of UIWindowFactory.

Declaration
[Obsolete("This feature has been deprecated in favor of UIWindowFactory.")]
public static bool TryCustomizeButton(ref Button button, string colorName)
Parameters
Type Name Description
Button button

Button

String colorName

Name of texture

Returns
Type Description
Boolean
| Improve this Doc View Source

TryGetSize(String, out Vector2)

Read size associated with a texture from xml.

Declaration
public static bool TryGetSize(string textureName, out Vector2 size)
Parameters
Type Name Description
String textureName
Vector2 size
Returns
Type Description
Boolean
| Improve this Doc View Source

TryImportCifRci(String, Int32, Int32, MetalTypes, Boolean, out Texture2D)

Seek CifRci with a specific metaltype from modding locations.

Declaration
public static bool TryImportCifRci(string name, int record, int frame, MetalTypes metalType, bool readOnly, out Texture2D tex)
Parameters
Type Name Description
String name

Image name.

Int32 record

Record index.

Int32 frame

Animation frame index

MetalTypes metalType

Metal type.

Boolean readOnly

Release copy on system memory after uploading to gpu.

Texture2D tex

Imported image as texture.

Returns
Type Description
Boolean

True if CifRci imported.

| Improve this Doc View Source

TryImportCifRci(String, Int32, Int32, Boolean, out Texture2D)

Seek CifRci from modding locations.

Declaration
public static bool TryImportCifRci(string name, int record, int frame, bool readOnly, out Texture2D tex)
Parameters
Type Name Description
String name

Image name.

Int32 record

Record index.

Int32 frame

Animation frame index

Boolean readOnly

Release copy on system memory after uploading to gpu.

Texture2D tex

Imported image as texture.

Returns
Type Description
Boolean

True if CifRci imported.

| Improve this Doc View Source

TryImportImage(String, Boolean, out Texture2D)

Seek image from modding locations.

Declaration
public static bool TryImportImage(string name, bool readOnly, out Texture2D tex)
Parameters
Type Name Description
String name

Image name.

Boolean readOnly

Release copy on system memory after uploading to gpu.

Texture2D tex

Imported image as texture.

Returns
Type Description
Boolean

True if image imported.

| Improve this Doc View Source

TryImportMaterial(Int32, Int32, Int32, out Material)

Seek material from mods.

Declaration
public static bool TryImportMaterial(int archive, int record, int frame, out Material material)
Parameters
Type Name Description
Int32 archive

Texture archive.

Int32 record

Record index.

Int32 frame

Animation frame index.

Material material

Imported material.

Returns
Type Description
Boolean

True if material imported.

| Improve this Doc View Source

TryImportTexture(Int32, Int32, Int32, DyeColors, TextureMap, out Texture2D)

Seek texture from modding locations with a specific dye.

Declaration
public static bool TryImportTexture(int archive, int record, int frame, DyeColors dye, TextureMap textureMap, out Texture2D tex)
Parameters
Type Name Description
Int32 archive

Texture archive.

Int32 record

Record index.

Int32 frame

Animation frame index

DyeColors dye

Dye colour for armour, weapons, and clothing.

TextureMap textureMap

Texture type.

Texture2D tex

Imported texture.

Returns
Type Description
Boolean

True if texture imported.

| Improve this Doc View Source

TryImportTexture(Int32, Int32, Int32, TextureMap, TextureImport, Boolean, out Texture2D)

Seek texture from modding locations.

Declaration
public static bool TryImportTexture(int archive, int record, int frame, TextureMap textureMap, TextureImport textureImport, bool readOnly, out Texture2D tex)
Parameters
Type Name Description
Int32 archive

Texture archive.

Int32 record

Record index.

Int32 frame

Animation frame index.

TextureMap textureMap

Texture type.

TextureImport textureImport

Texture import options.

Boolean readOnly

Release copy on system memory after uploading to gpu.

Texture2D tex

Imported texture.

Returns
Type Description
Boolean

True if texture imported.

| Improve this Doc View Source

TryImportTexture(Int32, Int32, Int32, TextureMap, Boolean, out Texture2D)

Seek texture from modding locations.

Declaration
public static bool TryImportTexture(int archive, int record, int frame, TextureMap textureMap, bool readOnly, out Texture2D tex)
Parameters
Type Name Description
Int32 archive

Texture archive.

Int32 record

Record index.

Int32 frame

Animation frame index.

TextureMap textureMap

Texture type.

Boolean readOnly

Release copy on system memory after uploading to gpu.

Texture2D tex

Imported texture.

Returns
Type Description
Boolean

True if texture imported.

| Improve this Doc View Source

TryImportTexture(Int32, Int32, Int32, out Texture2D)

Seek texture from modding locations.

Declaration
public static bool TryImportTexture(int archive, int record, int frame, out Texture2D tex)
Parameters
Type Name Description
Int32 archive

Texture archive.

Int32 record

Record index.

Int32 frame

Animation frame index.

Texture2D tex

Imported texture.

Returns
Type Description
Boolean

True if texture imported.

| Improve this Doc View Source

TryImportTexture(Int32, Int32, out Texture2D[])

Seek animated texture from modding locations with all frames.

Declaration
public static bool TryImportTexture(int archive, int record, out Texture2D[] texFrames)
Parameters
Type Name Description
Int32 archive

Texture archive.

Int32 record

Record index.

Texture2D[] texFrames

Imported texture frames.

Returns
Type Description
Boolean

True if texture imported.

| Improve this Doc View Source

TryImportTexture(String, Boolean, out Texture2D)

Seek texture from modding locations.

Declaration
public static bool TryImportTexture(string name, bool readOnly, out Texture2D tex)
Parameters
Type Name Description
String name

Texture name.

Boolean readOnly

Release copy on system memory after uploading to gpu.

Texture2D tex

Imported texture.

Returns
Type Description
Boolean

True if texture imported.

| Improve this Doc View Source

TryImportTextureFromDisk(String, Boolean, Boolean, out Texture2D, Boolean)

Seek texture from disk using a full path.

Declaration
[Obsolete("Use TryImportTextureFromLooseFiles()")]
public static bool TryImportTextureFromDisk(string path, bool mipMaps, bool isLinear, out Texture2D tex, bool readOnly = true)
Parameters
Type Name Description
String path
Boolean mipMaps

Enable mipmaps?

Boolean isLinear

This is a linear texture such as a normal map.

Texture2D tex

Imported texture.

Boolean readOnly

Release copy on system memory after uploading to gpu.

Returns
Type Description
Boolean

True if texture exists and has been imported.

| Improve this Doc View Source

TryImportTextureFromLooseFiles(Int32, Int32, Int32, TextureMap, Boolean, out Texture2D)

Seek texture from loose files.

Declaration
public static bool TryImportTextureFromLooseFiles(int archive, int record, int frame, TextureMap textureMap, bool readOnly, out Texture2D tex)
Parameters
Type Name Description
Int32 archive

Texture archive.

Int32 record

Record index.

Int32 frame

Animation index.

TextureMap textureMap

Texture type.

Boolean readOnly

Release copy on system memory after uploading to gpu.

Texture2D tex

Imported texture.

Returns
Type Description
Boolean

True if texture imported.

| Improve this Doc View Source

TryImportTextureFromLooseFiles(String, Boolean, Boolean, Boolean, out Texture2D)

Seeks a texture from loose files using a full path or a relative path from TexturesPath.

Declaration
public static bool TryImportTextureFromLooseFiles(string path, bool mipMaps, bool isLinear, bool readOnly, out Texture2D tex)
Parameters
Type Name Description
String path

Path to texture file, full or relative to TexturesPath.

Boolean mipMaps

Enable mipmaps?

Boolean isLinear

This is a linear texture such as a normal map.

Boolean readOnly

Release copy on system memory after uploading to gpu.

Texture2D tex

Imported texture.

Returns
Type Description
Boolean

True if texture exists and has been imported.

| Improve this Doc View Source

TryImportTextureFromLooseFiles(String, Boolean, Boolean, out Texture2D)

Seek texture from loose files using a relative path from TexturesPath.

Declaration
[Obsolete("Use overload that accepts readOnly flag.")]
public static bool TryImportTextureFromLooseFiles(string relPath, bool mipMaps, bool isLinear, out Texture2D tex)
Parameters
Type Name Description
String relPath

Relative path to file from TexturesPath.

Boolean mipMaps

Enable mipmaps?

Boolean isLinear

This is a linear texture such as a normal map.

Texture2D tex

Imported texture.

Returns
Type Description
Boolean

True if texture exists and has been imported.

  • Improve this Doc
  • View Source
In This Article
  • Properties
    • CifRciPath
    • ImagesPath
    • TexturesPath
  • Methods
    • AssignFiltermode(Material)
    • CustomizeMaterial(Int32, Int32, Int32, Material)
    • FileNameToArchive(String)
    • GetMobileBillboardMaterial(Int32, MeshFilter, ref MobileBillboardImportedTextures)
    • GetName(Int32, Int32, Int32, TextureMap, DyeColors)
    • GetNameCifRci(String, Int32, Int32)
    • GetNameCifRci(String, Int32, Int32, MetalTypes)
    • GetNameTexArray(Int32, TextureMap)
    • GetSize(Texture2D, String, Boolean)
    • GetSize(Texture2D, String, Int32, Int32)
    • GetStaticBillboardMaterial(GameObject, Int32, Int32, ref BillboardSummary, out Vector2)
    • IsDaggerfallTexture(String, out Int32, out Int32)
    • IsLinearTextureMap(TextureMap)
    • MakeResults(Material, Int32, Int32)
    • SetBillboardScale(Int32, Int32, ref Vector2)
    • TextureExistsAmongLooseFiles(Int32, Int32, Int32, TextureMap)
    • TryCustomizeButton(ref Button, String)
    • TryGetSize(String, out Vector2)
    • TryImportCifRci(String, Int32, Int32, MetalTypes, Boolean, out Texture2D)
    • TryImportCifRci(String, Int32, Int32, Boolean, out Texture2D)
    • TryImportImage(String, Boolean, out Texture2D)
    • TryImportMaterial(Int32, Int32, Int32, out Material)
    • TryImportTexture(Int32, Int32, Int32, DyeColors, TextureMap, out Texture2D)
    • TryImportTexture(Int32, Int32, Int32, TextureMap, TextureImport, Boolean, out Texture2D)
    • TryImportTexture(Int32, Int32, Int32, TextureMap, Boolean, out Texture2D)
    • TryImportTexture(Int32, Int32, Int32, out Texture2D)
    • TryImportTexture(Int32, Int32, out Texture2D[])
    • TryImportTexture(String, Boolean, out Texture2D)
    • TryImportTextureFromDisk(String, Boolean, Boolean, out Texture2D, Boolean)
    • TryImportTextureFromLooseFiles(Int32, Int32, Int32, TextureMap, Boolean, out Texture2D)
    • TryImportTextureFromLooseFiles(String, Boolean, Boolean, Boolean, out Texture2D)
    • TryImportTextureFromLooseFiles(String, Boolean, Boolean, out Texture2D)
Back to top Generated by DocFX