Class MeshReplacement
Handles import and injection of GamObjects with the purpose of providing modding support. Daggerfall meshes and billboards can be replaced with a prefab imported from mods.
Namespace: DaggerfallWorkshop.Utility.AssetInjection
Assembly: Assembly-CSharp.dll
Syntax
public static class MeshReplacement
Properties
| Improve this Doc View SourceGetTreeColorCallback
Generates the color for a TreeInstance; should return a different value each time for variety.
Declaration
public static Func<Color32> GetTreeColorCallback { set; }
Property Value
Type | Description |
---|---|
Func<Color32> |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | This callback must not be set to null. |
GetTreeScaleCallback
Generates the scale for a TreeInstance where 1
is the reference value;
should return a different value each time for variety.
Declaration
public static Func<float> GetTreeScaleCallback { set; }
Property Value
Type | Description |
---|---|
Func<Single> |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | This callback must not be set to null. |
SetTreesSettingsCallback
Customizes terrain settings, such as tree distance or lod, before instantiating trees. Note that many settings only affect objects of type Tree created with the Unity Tree Editor and not other solutions like SpeedTree.
Declaration
public static Action<Terrain> SetTreesSettingsCallback { set; }
Property Value
Type | Description |
---|---|
Action<Terrain> |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | This callback must not be set to null. |
Methods
| Improve this Doc View SourceClearNatureGameObjects(Terrain)
Remove all tree instances from terrain.
Declaration
public static void ClearNatureGameObjects(Terrain terrain)
Parameters
Type | Name | Description |
---|---|---|
Terrain | terrain |
GetFlatReplacementName(Int32, Int32)
Declaration
public static string GetFlatReplacementName(int archive, int record)
Parameters
Type | Name | Description |
---|---|---|
Int32 | archive | |
Int32 | record |
Returns
Type | Description |
---|---|
String |
ImportCustomFlatGameobject(Int32, Int32, Vector3, Transform, Boolean)
Seek and import a GameObject from mods to replace a Daggerfall billboard.
Declaration
public static GameObject ImportCustomFlatGameobject(int archive, int record, Vector3 position, Transform parent, bool inDungeon = false)
Parameters
Type | Name | Description |
---|---|---|
Int32 | archive | Texture archive for original billboard. |
Int32 | record | Texture record for original billboard. |
Vector3 | position | Position to assign to GameObject. |
Transform | parent | Parent to assign to GameObject. |
Boolean | inDungeon | Fix position for dungeon models. |
Returns
Type | Description |
---|---|
GameObject | Returns the imported model or null if not found. |
ImportCustomGameobject(UInt32, Transform, Matrix4x4, Boolean)
Seek and import a GameObject from mods to replace a Daggerfall mesh.
Declaration
public static GameObject ImportCustomGameobject(uint modelID, Transform parent, Matrix4x4 matrix, bool isAutomapRun = false)
Parameters
Type | Name | Description |
---|---|---|
UInt32 | modelID | Daggerfall model ID. |
Transform | parent | Parent to assign to GameObject. |
Matrix4x4 | matrix | Matrix with position and rotation of GameObject. |
Boolean | isAutomapRun | True if current model is being created for an Automap? |
Returns
Type | Description |
---|---|
GameObject | Returns the imported model or null if not found. |
ImportNatureGameObject(Int32, Int32, Terrain, Int32, Int32)
Import a gameobject from mods to use with the terrain system.
Declaration
public static bool ImportNatureGameObject(int archive, int record, Terrain terrain, int x, int y)
Parameters
Type | Name | Description |
---|---|---|
Int32 | archive | Texture archive for original billboard. |
Int32 | record | Texture record for original billboard. |
Terrain | terrain | Unity terrain. |
Int32 | x | X coordinate on terrain. |
Int32 | y | Y coordinate on terrain. |
Returns
Type | Description |
---|---|
Boolean | True if gameobject is found and imported. |
RetryAssetImports()
Clears records of import attempts for assets from loose files and mods.
Declaration
public static void RetryAssetImports()
SwapCustomFlatGameobject(Int32, Int32, Transform, Vector3, Boolean)
Ensures that the requested imported model is assigned to the given transform and is positioned correctly. If archive and record mismatch, the requested prefab is imported while currently loaded gameobject is destroyed. This has a similar purpose to SetMaterial(Int32, Int32, Int32).
Declaration
public static GameObject SwapCustomFlatGameobject(int archive, int record, Transform parent, Vector3 position, bool inDungeon = false)
Parameters
Type | Name | Description |
---|---|---|
Int32 | archive | Texture archive for original billboard. |
Int32 | record | Texture record for original billboard. |
Transform | parent | Parent to assign to GameObject. |
Vector3 | position | Position to assign to GameObject. |
Boolean | inDungeon | Fix position for dungeon models. |
Returns
Type | Description |
---|---|
GameObject | Returns the imported model or null if not found. |