Remove crappy ChunkMerge tool and merge collisions ourself.
This commit is contained in:
parent
53f0d31b52
commit
29bad2801e
8 changed files with 54 additions and 127 deletions
13
.vscode/launch.json
vendored
13
.vscode/launch.json
vendored
|
@ -10,15 +10,14 @@
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"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_mesh.nif",
|
||||||
|
"${workspaceFolder}/plugin/Data/Meshes/_EQ_ItemRoulette/roulette_container_final.nif",
|
||||||
|
"${workspaceFolder}/Source/Meshes/_EQ_ItemRoulette/roulette_container_template.nif"
|
||||||
|
],
|
||||||
//"args": ["--", "${env:USERPROFILE}/Desktop/cabbage01.nif"],
|
//"args": ["--", "${env:USERPROFILE}/Desktop/cabbage01.nif"],
|
||||||
"console": "integratedTerminal"
|
"console": "integratedTerminal"
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "papyrus",
|
|
||||||
"name": "Skyrim",
|
|
||||||
"request": "attach",
|
|
||||||
"game": "skyrimSpecialEdition"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -1,28 +0,0 @@
|
||||||
SetTitleMatchMode, RegEx
|
|
||||||
WinWait, ahk_exe i)ChunkMerge.exe
|
|
||||||
WinGet, ChunkMain, ID, ahk_exe i)ChunkMerge.exe
|
|
||||||
WinActivate, ahk_id %ChunkMain%
|
|
||||||
|
|
||||||
Clipboard := ChunkMerge_NifFile
|
|
||||||
ControlFocus Edit1, ahk_id %ChunkMain%
|
|
||||||
Send +{Insert}
|
|
||||||
|
|
||||||
Clipboard := ChunkMerge_CollisionFile
|
|
||||||
ControlFocus Edit2, ahk_id %ChunkMain%
|
|
||||||
Send +{Insert}
|
|
||||||
|
|
||||||
ControlFocus, ComboBox1, ahk_id %ChunkMain%
|
|
||||||
Send, %ChunkMerge_TemplateFile%
|
|
||||||
ControlClick, Mesh Data, ahk_id %ChunkMain%
|
|
||||||
ControlClick, Name of NiTriShape, ahk_id %ChunkMain%
|
|
||||||
|
|
||||||
ControlSend Convert, {Space}, ahk_id %ChunkMain%
|
|
||||||
|
|
||||||
Loop {
|
|
||||||
Sleep 100
|
|
||||||
ControlGetText, FinishedText, RichEdit20W1, ahk_id %ChunkMain%
|
|
||||||
IfInString, FinishedText, Nif converted successfully
|
|
||||||
{
|
|
||||||
Break
|
|
||||||
}
|
|
||||||
}
|
|
66
Makefile
66
Makefile
|
@ -63,65 +63,8 @@ plugin/Data/Textures/_EQ_ItemRoulette/%.dds: Source/Textures/_EQ_ItemRoulette/%.
|
||||||
|
|
||||||
models: $(modelFiles) textures
|
models: $(modelFiles) textures
|
||||||
|
|
||||||
.PRECIOUS: build/ChunkMerge/ChunkMerge.exe
|
plugin/Data/Meshes/_EQ_ItemRoulette/%_final.nif: setalpha.py .venv/pyvenv.cfg plugin/Data/Meshes/_EQ_ItemRoulette/%_mesh.nif Source/Meshes/_EQ_ItemRoulette/%_template.nif
|
||||||
build/ChunkMerge/ChunkMerge.exe: build/chunkmerge.7z
|
pyenv exec python -m pipenv run python "$<" -- "$(word 3,$^)" "$@" "$(word 4,$^)"
|
||||||
7z x -y "-obuild" "$<"
|
|
||||||
touch -c "$@"
|
|
||||||
|
|
||||||
.PRECIOUS: build/chunkmerge.7z
|
|
||||||
build/chunkmerge.7z:
|
|
||||||
powershell -Command 'Invoke-WebRequest -Uri "https://github.com/downloads/skyfox69/NifUtils/ChunkMerge0155.7z" -OutFile "$@"'
|
|
||||||
|
|
||||||
build/ChunkMerge/ChunkMerge.xml: build/ChunkMerge/ChunkMerge.exe
|
|
||||||
cat > "$@" <<'HERE'
|
|
||||||
<Config>
|
|
||||||
<PathSkyrim>$(SKYRIM_BASE)</PathSkyrim>
|
|
||||||
<PathNifXML>$(current_dir)/nif.xml</PathNifXML>
|
|
||||||
<PathTemplate>$(current_dir)\\Source\\Meshes\\_EQ_ItemRoulette</PathTemplate>
|
|
||||||
<LastTexture></LastTexture>
|
|
||||||
<LastTemplate></LastTemplate>
|
|
||||||
<DirSource></DirSource>
|
|
||||||
<DirDestination></DirDestination>
|
|
||||||
<DirCollision></DirCollision>
|
|
||||||
<MatHandling>0</MatHandling>
|
|
||||||
<VertexColorHandling>0</VertexColorHandling>
|
|
||||||
<UpdateTangentSpace>1</UpdateTangentSpace>
|
|
||||||
<ReorderProperties>1</ReorderProperties>
|
|
||||||
<CollTypeHandling>1</CollTypeHandling>
|
|
||||||
<CollMaterial>-553455049</CollMaterial>
|
|
||||||
<MaterialScan>
|
|
||||||
<MatScanTag>SkyrimHavokMaterial</MatScanTag>
|
|
||||||
<MatScanName>SKY_HAV_</MatScanName>
|
|
||||||
<MatScanPrefixList>
|
|
||||||
<MatScanPrefix>Material</MatScanPrefix>
|
|
||||||
</MatScanPrefixList>
|
|
||||||
<MatScanIgnoreList>
|
|
||||||
<MatScanIgnore>Unknown</MatScanIgnore>
|
|
||||||
</MatScanIgnoreList>
|
|
||||||
</MaterialScan>
|
|
||||||
<DirectXView>
|
|
||||||
<ShowTexture>1</ShowTexture>
|
|
||||||
<ShowWireframe>0</ShowWireframe>
|
|
||||||
<ShowColorWire>0</ShowColorWire>
|
|
||||||
<ForceDDS>0</ForceDDS>
|
|
||||||
<ColorWireframe>ffffffff</ColorWireframe>
|
|
||||||
<ColorWireCollision>ffffff00</ColorWireCollision>
|
|
||||||
<ColorBackground>ff200020</ColorBackground>
|
|
||||||
<ColorSelected>ffff00ff</ColorSelected>
|
|
||||||
<TexturePathList>
|
|
||||||
</TexturePathList>
|
|
||||||
</DirectXView>
|
|
||||||
</Config>
|
|
||||||
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,$^)" "$@"
|
|
||||||
|
|
||||||
.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'
|
|
||||||
|
|
||||||
.PRECIOUS: build/blender-windows64/blender.exe
|
.PRECIOUS: build/blender-windows64/blender.exe
|
||||||
build/blender-windows64/blender.exe: build/blender.zip build/blender-windows64/2.93/scripts/addons/io_scene_niftools/__init__.py
|
build/blender-windows64/blender.exe: build/blender.zip build/blender-windows64/2.93/scripts/addons/io_scene_niftools/__init__.py
|
||||||
|
@ -145,8 +88,3 @@ build/blender.zip:
|
||||||
plugin/Data/Meshes/_EQ_ItemRoulette/%_mesh.nif: Source/Meshes/_EQ_ItemRoulette/%_mesh.blend build/blender-windows64/blender.exe
|
plugin/Data/Meshes/_EQ_ItemRoulette/%_mesh.nif: Source/Meshes/_EQ_ItemRoulette/%_mesh.blend build/blender-windows64/blender.exe
|
||||||
BLENDER="$(word 2, $^)"
|
BLENDER="$(word 2, $^)"
|
||||||
"$$BLENDER" --background --python "./export_blender_models.py" -- "$<" "$@"
|
"$$BLENDER" --background --python "./export_blender_models.py" -- "$<" "$@"
|
||||||
|
|
||||||
.PRECIOUS: plugin/Data/Meshes/_EQ_ItemRoulette/%_collision.nif
|
|
||||||
plugin/Data/Meshes/_EQ_ItemRoulette/%_collision.nif: Source/Meshes/_EQ_ItemRoulette/%_collision.blend build/blender-windows64/blender.exe
|
|
||||||
BLENDER="$(word 2, $^)"
|
|
||||||
"$$BLENDER" --background --python "./export_blender_models.py" -- "$<" "$@"
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -6,13 +6,24 @@ Static Property _EQ_ItemRoulette_Roulette Auto
|
||||||
ObjectReference[] DisplayItems
|
ObjectReference[] DisplayItems
|
||||||
ObjectReference Roulette
|
ObjectReference Roulette
|
||||||
|
|
||||||
Int MAX_ITEMS = 5
|
Int MAX_ITEMS
|
||||||
Float UI_DISTANCE = 48.0
|
Float UI_DISTANCE
|
||||||
Float UI_DEGREES = 7.0
|
Float UI_DEGREES
|
||||||
Float UI_ZEES = 4.0
|
Float UI_ZEES
|
||||||
Float UI_ITEM_SCALE = 0.2
|
Float UI_ITEM_SCALE
|
||||||
|
|
||||||
Event OnInit()
|
Event OnInit()
|
||||||
|
; Placeholder for things to happen only on first load for this save
|
||||||
|
Main()
|
||||||
|
EndEvent
|
||||||
|
|
||||||
|
Function Main()
|
||||||
|
MAX_ITEMS = 5
|
||||||
|
UI_DISTANCE = 48.0
|
||||||
|
UI_DEGREES = 14.0
|
||||||
|
UI_ZEES = 12.0
|
||||||
|
UI_ITEM_SCALE = 0.25
|
||||||
|
|
||||||
DisplayItems = New ObjectReference[127]
|
DisplayItems = New ObjectReference[127]
|
||||||
int index = 0
|
int index = 0
|
||||||
While index < MAX_ITEMS
|
While index < MAX_ITEMS
|
||||||
|
@ -20,10 +31,6 @@ Event OnInit()
|
||||||
index += 1
|
index += 1
|
||||||
EndWhile
|
EndWhile
|
||||||
|
|
||||||
Main()
|
|
||||||
EndEvent
|
|
||||||
|
|
||||||
Function Main()
|
|
||||||
Debug.Trace("Item Roulette loaded")
|
Debug.Trace("Item Roulette loaded")
|
||||||
Roulette = PlayerRef.PlaceAtMe(_EQ_ItemRoulette_Roulette)
|
Roulette = PlayerRef.PlaceAtMe(_EQ_ItemRoulette_Roulette)
|
||||||
RegisterForModEvent("_EQ_ItemRoulette_Activate", "OnMyAction")
|
RegisterForModEvent("_EQ_ItemRoulette_Activate", "OnMyAction")
|
||||||
|
@ -32,9 +39,6 @@ Function Main()
|
||||||
EndFunction
|
EndFunction
|
||||||
|
|
||||||
Event OnUpdate()
|
Event OnUpdate()
|
||||||
Float handX = VRIK.VrikGetHandX(true)
|
|
||||||
Float handY = VRIK.VrikGetHandY(true)
|
|
||||||
Float handZ = VRIK.VrikGetHandZ(true)
|
|
||||||
Float playerAngle = PlayerRef.GetAngleZ()
|
Float playerAngle = PlayerRef.GetAngleZ()
|
||||||
|
|
||||||
Roulette.TranslateTo(PlayerRef.X + UI_DISTANCE * Math.sin(playerAngle), PlayerRef.Y + UI_DISTANCE * Math.cos(playerAngle), VRIK.VrikGetHmdZ(), 0, 0, playerAngle, 1000)
|
Roulette.TranslateTo(PlayerRef.X + UI_DISTANCE * Math.sin(playerAngle), PlayerRef.Y + UI_DISTANCE * Math.cos(playerAngle), VRIK.VrikGetHmdZ(), 0, 0, playerAngle, 1000)
|
||||||
|
@ -56,7 +60,7 @@ Event OnUpdate()
|
||||||
Else
|
Else
|
||||||
top = UI_ZEES
|
top = UI_ZEES
|
||||||
EndIf
|
EndIf
|
||||||
DisplayItems[index].MoveTo(PlayerRef, UI_DISTANCE * Math.sin(playerAngle - left), UI_DISTANCE * Math.cos(playerAngle - left), (VRIK.VrikGetHmdZ() - PlayerRef.Z) + top)
|
DisplayItems[index].MoveTo(PlayerRef, UI_DISTANCE * Math.sin(playerAngle - left), UI_DISTANCE * Math.cos(playerAngle - left), (VRIK.VrikGetHmdZ() - PlayerRef.Z) - top)
|
||||||
index += 1
|
index += 1
|
||||||
EndWhile
|
EndWhile
|
||||||
|
|
||||||
|
|
44
setalpha.py
44
setalpha.py
|
@ -4,6 +4,15 @@ import pickle
|
||||||
from pyffi.formats.nif import NifFormat
|
from pyffi.formats.nif import NifFormat
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
def validate_nif(mesh_data, nif_stream):
|
||||||
|
mesh_data.inspect_version_only(nif_stream)
|
||||||
|
if mesh_data.version >= 0:
|
||||||
|
mesh_data.read(nif_stream)
|
||||||
|
elif mesh_data.version == -1:
|
||||||
|
raise UnsupportedOperation("Unsupported NIF version")
|
||||||
|
else:
|
||||||
|
raise UnsupportedOperation("Not a NIF")
|
||||||
|
|
||||||
argv = sys.argv
|
argv = sys.argv
|
||||||
try:
|
try:
|
||||||
index = argv.index("--") + 1
|
index = argv.index("--") + 1
|
||||||
|
@ -11,27 +20,32 @@ except ValueError:
|
||||||
index = len(argv)
|
index = len(argv)
|
||||||
argv = argv[index:]
|
argv = argv[index:]
|
||||||
|
|
||||||
print(argv[0] + ' --> ' + argv[1])
|
print(argv[0] + ' --> ' + argv[1] + ' TEMPLATE: ' + argv[2])
|
||||||
|
|
||||||
data = NifFormat.Data()
|
mesh_data = NifFormat.Data()
|
||||||
with open(argv[0], 'rb') as nif_stream:
|
with open(argv[0], 'rb') as mesh_file:
|
||||||
data.inspect_version_only(nif_stream)
|
validate_nif(mesh_data, mesh_file)
|
||||||
if data.version >= 0:
|
|
||||||
data.read(nif_stream)
|
|
||||||
elif data.version == -1:
|
|
||||||
raise UnsupportedOperation("Unsupported NIF version")
|
|
||||||
else:
|
|
||||||
raise UnsupportedOperation("Not a NIF")
|
|
||||||
|
|
||||||
alpha_index = len(data.header.block_types)
|
alpha_index = len(mesh_data.header.block_types)
|
||||||
|
|
||||||
for child in data.get_global_iterator():
|
for child in mesh_data.get_global_iterator():
|
||||||
|
# Replace the generic collision data with data from the template,
|
||||||
|
# but preserve the collision vertices
|
||||||
|
if isinstance(child, NifFormat.bhkCollisionObject):
|
||||||
|
template_data = NifFormat.Data()
|
||||||
|
with open(argv[2], 'rb') as template_file:
|
||||||
|
validate_nif(template_data, template_file)
|
||||||
|
|
||||||
|
new_collision = template_data.roots[0].collision_object
|
||||||
|
new_collision.body.shape = child.body.shape
|
||||||
|
|
||||||
|
child.target.collision_object = new_collision
|
||||||
|
# Fix the alpha value
|
||||||
if isinstance(child, NifFormat.NiTriShape):
|
if isinstance(child, NifFormat.NiTriShape):
|
||||||
alpha = NifFormat.NiAlphaProperty(parent=child)
|
alpha = NifFormat.NiAlphaProperty(parent=child)
|
||||||
alpha.flags = 4845
|
alpha.flags = 4845
|
||||||
child.bs_properties[-1] = alpha
|
child.bs_properties[-1] = alpha
|
||||||
data.roots.append(alpha)
|
mesh_data.blocks.append(alpha)
|
||||||
data.blocks.append(alpha)
|
|
||||||
|
|
||||||
with open(argv[1], 'wb') as nif_out:
|
with open(argv[1], 'wb') as nif_out:
|
||||||
data.write(nif_out)
|
mesh_data.write(nif_out)
|
Loading…
Add table
Reference in a new issue