Properly write alpha value to final model generated by ChunkMerge

This commit is contained in:
Empathic Qubit 2021-06-13 01:50:25 -04:00
parent 597fcd2f64
commit 53f0d31b52
3 changed files with 16 additions and 8 deletions

1
.vscode/launch.json vendored
View file

@ -11,6 +11,7 @@
"python": "${command:python.interpreterPath}", "python": "${command:python.interpreterPath}",
"program": "${file}", "program": "${file}",
"args": ["--", "${workspaceFolder}/plugin/Data/Meshes/_EQ_ItemRoulette/roulette_container_final.nif"], "args": ["--", "${workspaceFolder}/plugin/Data/Meshes/_EQ_ItemRoulette/roulette_container_final.nif"],
//"args": ["--", "${env:USERPROFILE}/Desktop/cabbage01.nif"],
"console": "integratedTerminal" "console": "integratedTerminal"
}, },
{ {

View file

@ -59,6 +59,7 @@ plugin/Data/Textures/_EQ_ItemRoulette/%.dds: Source/Textures/_EQ_ItemRoulette/%.
pyenv install $$(cat ".python-version") pyenv install $$(cat ".python-version")
pyenv exec pip install --user pipenv pyenv exec pip install --user pipenv
pyenv exec python -m pipenv install pyenv exec python -m pipenv install
touch -c "$@"
models: $(modelFiles) textures models: $(modelFiles) textures
@ -113,8 +114,11 @@ build/ChunkMerge/ChunkMerge.xml: build/ChunkMerge/ChunkMerge.exe
</Config> </Config>
HERE HERE
plugin/Data/Meshes/_EQ_ItemRoulette/%_final.nif: setalpha.py .venv/pyvenv.cfg plugin/Data/Meshes/_EQ_ItemRoulette/%_chunkmerge.nif
pyenv exec python -m pipenv run python "$<" -- "$(word 3,$^)" "$@"
plugin/Data/Meshes/_EQ_ItemRoulette/%_final.nif: Source/Meshes/_EQ_ItemRoulette/%_template.nif plugin/Data/Meshes/_EQ_ItemRoulette/%_collision.nif plugin/Data/Meshes/_EQ_ItemRoulette/%_mesh.nif build/ChunkMerge/ChunkMerge.xml .PRECIOUS: plugin/Data/Meshes/_EQ_ItemRoulette/%_chunkmerge.nif
plugin/Data/Meshes/_EQ_ItemRoulette/%_chunkmerge.nif: Source/Meshes/_EQ_ItemRoulette/%_template.nif plugin/Data/Meshes/_EQ_ItemRoulette/%_collision.nif plugin/Data/Meshes/_EQ_ItemRoulette/%_mesh.nif build/ChunkMerge/ChunkMerge.xml
cp "$(filter %_mesh.nif,$^)" "$@" cp "$(filter %_mesh.nif,$^)" "$@"
build/ChunkMerge/ChunkMerge.exe & build/ChunkMerge/ChunkMerge.exe &
powershell -Command '$$env:ChunkMerge_NifFile=Split-Path (Join-Path "$@" "."); $$env:ChunkMerge_CollisionFile=Split-Path (Join-Path "$(filter %_collision.nif,$^)" ".") ; $$env:ChunkMerge_TemplateFile="$(notdir $(filter %_template.nif,$^))" ; Start-Process -Wait -FilePath AutoHotKey -ArgumentList @("ChunkMerge.ahk") ; Stop-Process -Name ChunkMerge' powershell -Command '$$env:ChunkMerge_NifFile=Split-Path (Join-Path "$@" "."); $$env:ChunkMerge_CollisionFile=Split-Path (Join-Path "$(filter %_collision.nif,$^)" ".") ; $$env:ChunkMerge_TemplateFile="$(notdir $(filter %_template.nif,$^))" ; Start-Process -Wait -FilePath AutoHotKey -ArgumentList @("ChunkMerge.ahk") ; Stop-Process -Name ChunkMerge'

View file

@ -11,6 +11,8 @@ except ValueError:
index = len(argv) index = len(argv)
argv = argv[index:] argv = argv[index:]
print(argv[0] + ' --> ' + argv[1])
data = NifFormat.Data() data = NifFormat.Data()
with open(argv[0], 'rb') as nif_stream: with open(argv[0], 'rb') as nif_stream:
data.inspect_version_only(nif_stream) data.inspect_version_only(nif_stream)
@ -21,14 +23,15 @@ with open(argv[0], 'rb') as nif_stream:
else: else:
raise UnsupportedOperation("Not a NIF") raise UnsupportedOperation("Not a NIF")
alpha_index = len(data.header.block_types)
for child in data.get_global_iterator(): for child in data.get_global_iterator():
if isinstance(child, NifFormat.NiTriShape): if isinstance(child, NifFormat.NiTriShape):
alpha = NifFormat.NiAlphaProperty() alpha = NifFormat.NiAlphaProperty(parent=child)
alpha.flags = 4845 alpha.flags = 4845
child.bs_properties.append(alpha) child.bs_properties[-1] = alpha
child.bs_properties.update_size() data.roots.append(alpha)
data.blocks.append(alpha)
with open('Z:/farts.nif', 'wb') as nif_out: with open(argv[1], 'wb') as nif_out:
data.write(nif_out) data.write(nif_out)
print('frick')