-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d3b9d9e
commit ca20262
Showing
7 changed files
with
1,758 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using Jotunn.Managers; | ||
using SoftReferenceableAssets; | ||
using UnityEngine; | ||
|
||
namespace JotunnDoc.Docs | ||
{ | ||
public class MeshDoc : Doc | ||
{ | ||
public MeshDoc() : base("prefabs/mesh-list.md") | ||
{ | ||
PrefabManager.OnVanillaPrefabsAvailable += DocMeshes; | ||
} | ||
|
||
void DocMeshes() | ||
{ | ||
if (Generated) | ||
{ | ||
return; | ||
} | ||
|
||
Jotunn.Logger.LogInfo("Documenting meshes"); | ||
|
||
AddHeader(1, "Mesh list"); | ||
AddText("All the meshes currently in the game."); | ||
AddText("Use the SoftReference system to load the meshes, the internal object name is only for reference."); | ||
AddText($"This file is automatically generated from Valheim {Version.GetVersionString(true)} using the JotunnDoc mod found on our GitHub."); | ||
|
||
AddTableHeader("SoftReference Name", "Asset ID", "Internal Object Name"); | ||
|
||
foreach (var pair in AssetManager.Instance.MapNameToAssetID[typeof(Mesh)]) | ||
{ | ||
if (!pair.Value.IsValid) | ||
{ | ||
continue; | ||
} | ||
|
||
var softReferenceName = pair.Key; | ||
var assetID = pair.Value; | ||
SoftReference<GameObject> asset = new SoftReference<GameObject>(assetID); | ||
asset.Load(); | ||
|
||
if (!PrefabManager.TryFindAssetInSelfOrChildComponents(asset.Asset, typeof(Mesh), out Object meshAsset)) | ||
{ | ||
continue; | ||
} | ||
|
||
AddTableRow(softReferenceName, assetID.ToString(), meshAsset.name); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1,701 changes: 1,701 additions & 0 deletions
1,701
JotunnLib/Documentation/data/prefabs/mesh-list.md
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters