diff --git a/.vscode/launch.json b/.vscode/launch.json index c088bc9..7425398 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -11,6 +11,7 @@ "python": "${command:python.interpreterPath}", "program": "${file}", "args": ["--", "${workspaceFolder}/plugin/Data/Meshes/_EQ_ItemRoulette/roulette_container_final.nif"], + //"args": ["--", "${env:USERPROFILE}/Desktop/cabbage01.nif"], "console": "integratedTerminal" }, { diff --git a/Makefile b/Makefile index 1e01ba6..d68da92 100644 --- a/Makefile +++ b/Makefile @@ -59,6 +59,7 @@ plugin/Data/Textures/_EQ_ItemRoulette/%.dds: Source/Textures/_EQ_ItemRoulette/%. pyenv install $$(cat ".python-version") pyenv exec pip install --user pipenv pyenv exec python -m pipenv install + touch -c "$@" models: $(modelFiles) textures @@ -113,8 +114,11 @@ build/ChunkMerge/ChunkMerge.xml: build/ChunkMerge/ChunkMerge.exe 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,$^)" "$@" 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' diff --git a/setalpha.py b/setalpha.py index fed6ae6..f5ab307 100644 --- a/setalpha.py +++ b/setalpha.py @@ -11,6 +11,8 @@ except ValueError: index = len(argv) argv = argv[index:] +print(argv[0] + ' --> ' + argv[1]) + data = NifFormat.Data() with open(argv[0], 'rb') as nif_stream: data.inspect_version_only(nif_stream) @@ -21,14 +23,15 @@ with open(argv[0], 'rb') as nif_stream: else: raise UnsupportedOperation("Not a NIF") +alpha_index = len(data.header.block_types) + for child in data.get_global_iterator(): if isinstance(child, NifFormat.NiTriShape): - alpha = NifFormat.NiAlphaProperty() + alpha = NifFormat.NiAlphaProperty(parent=child) alpha.flags = 4845 - child.bs_properties.append(alpha) - child.bs_properties.update_size() + child.bs_properties[-1] = alpha + data.roots.append(alpha) + data.blocks.append(alpha) -with open('Z:/farts.nif', 'wb') as nif_out: - data.write(nif_out) - -print('frick') \ No newline at end of file +with open(argv[1], 'wb') as nif_out: + data.write(nif_out) \ No newline at end of file