feat: red and white tablecloth on the Cook's Table
The cook goes back to the cartography table with its map painted over offline (scripts/paint_cook_cloth.py from textures pulled by scripts/extract_carto.py). The three PNGs are embedded in the DLL and swapped onto copied materials by PieceLook.Retexture. The smith stays on the black marble table.
This commit is contained in:
parent
b3edb2aed1
commit
069e098cf0
8 changed files with 238 additions and 22 deletions
39
scripts/extract_carto.py
Normal file
39
scripts/extract_carto.py
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
"""Export the cartography table's textures (PNG) and its high mesh (OBJ) from Valheim's bundle.
|
||||
Usage: py -3.14 -I extract_carto.py <pylib> <bundle file> <out dir>"""
|
||||
import os, sys
|
||||
sys.path.insert(0, sys.argv[1])
|
||||
import UnityPy
|
||||
|
||||
bundle, out = sys.argv[2], sys.argv[3]
|
||||
os.makedirs(out, exist_ok=True)
|
||||
env = UnityPy.load(bundle)
|
||||
|
||||
want_tex = {"Cartographer_d", "Cartographer_worn_d", "Cartographer_n", "Cartographer_m"}
|
||||
for obj in env.objects:
|
||||
if obj.type.name == "Texture2D":
|
||||
t = obj.read()
|
||||
if t.m_Name in want_tex:
|
||||
img = t.image
|
||||
img.save(os.path.join(out, t.m_Name + ".png"))
|
||||
print("tex", t.m_Name, img.size, t.m_TextureFormat)
|
||||
|
||||
for path, ptr in env.container.items():
|
||||
if path.endswith("/piece_cartographytable.prefab"):
|
||||
go = ptr.read()
|
||||
def walk(tr, prefix):
|
||||
g = tr.m_GameObject.read()
|
||||
name = prefix + "/" + g.m_Name
|
||||
for c in g.m_Component:
|
||||
o = (c.component if hasattr(c, 'component') else c[1]).read()
|
||||
if o.object_reader.type.name == "MeshFilter":
|
||||
m = o.m_Mesh.read()
|
||||
fn = name.strip("/").replace("/", "__") + ".obj"
|
||||
open(os.path.join(out, fn), "w").write(m.export())
|
||||
print("mesh", name, m.m_Name, "->", fn)
|
||||
for ch in tr.m_Children:
|
||||
walk(ch.read(), name)
|
||||
for c in go.m_Component:
|
||||
o = (c.component if hasattr(c, 'component') else c[1]).read()
|
||||
if o.object_reader.type.name == "Transform":
|
||||
walk(o, "")
|
||||
break
|
||||
Loading…
Add table
Add a link
Reference in a new issue