Attempt to fix object collisions with ChunkMerge. Not working?
This commit is contained in:
parent
b7439100a1
commit
2220f68d35
10 changed files with 7503 additions and 24 deletions
1
.vscode/tasks.json
vendored
1
.vscode/tasks.json
vendored
|
@ -11,7 +11,6 @@
|
||||||
"kind": "build"
|
"kind": "build"
|
||||||
},
|
},
|
||||||
"command": "${workspaceFolder}/build.ps1",
|
"command": "${workspaceFolder}/build.ps1",
|
||||||
"args": ["-KickVortex"],
|
|
||||||
"problemMatcher": [
|
"problemMatcher": [
|
||||||
"$PapyrusCompiler"
|
"$PapyrusCompiler"
|
||||||
]
|
]
|
||||||
|
|
32
ChunkMerge.ahk
Normal file
32
ChunkMerge.ahk
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
SetTitleMatchMode, RegEx
|
||||||
|
WinWait, ahk_exe i)ChunkMerge.exe
|
||||||
|
WinActivate, ahk_exe i)ChunkMerge.exe
|
||||||
|
|
||||||
|
ControlFocus Button1, A
|
||||||
|
Send {Space}
|
||||||
|
Clipboard := ChunkMerge_NifFile
|
||||||
|
Send +{Insert}
|
||||||
|
Send {Enter}
|
||||||
|
|
||||||
|
WinWaitActive, i)ChunkMerge
|
||||||
|
|
||||||
|
ControlFocus Button2, A
|
||||||
|
Send {Space}
|
||||||
|
Clipboard := ChunkMerge_CollisionFile
|
||||||
|
Send +{Insert}
|
||||||
|
Send {Enter}
|
||||||
|
|
||||||
|
WinWaitActive, i)ChunkMerge
|
||||||
|
|
||||||
|
ControlFocus, ComboBox1, A
|
||||||
|
Send, %ChunkMerge_TemplateFile%
|
||||||
|
ControlFocus, Mesh Data, A
|
||||||
|
Send {Space}
|
||||||
|
ControlFocus, Name of NiTriShape, A
|
||||||
|
Send {Space}
|
||||||
|
|
||||||
|
Send {Enter}
|
||||||
|
|
||||||
|
Sleep 3000
|
||||||
|
|
||||||
|
WinClose, ahk_exe i)ChunkMerge.exe
|
Binary file not shown.
Binary file not shown.
BIN
Source/Meshes/_EQ_ItemRoulette/roulette_container_mesh.blend
Normal file
BIN
Source/Meshes/_EQ_ItemRoulette/roulette_container_mesh.blend
Normal file
Binary file not shown.
BIN
Source/Meshes/_EQ_ItemRoulette/roulette_container_template.nif
Normal file
BIN
Source/Meshes/_EQ_ItemRoulette/roulette_container_template.nif
Normal file
Binary file not shown.
148
build.ps1
148
build.ps1
|
@ -2,6 +2,9 @@
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Builds the plugin and optionally reloads it in Vortex.
|
Builds the plugin and optionally reloads it in Vortex.
|
||||||
|
|
||||||
|
.PARAMETER InstallDependencies
|
||||||
|
Installs script dependencies with Chocolatey, except Papyrus, and quit
|
||||||
|
|
||||||
.PARAMETER Scripts
|
.PARAMETER Scripts
|
||||||
Build Papyrus scripts
|
Build Papyrus scripts
|
||||||
|
|
||||||
|
@ -12,19 +15,29 @@
|
||||||
Build GIMP textures
|
Build GIMP textures
|
||||||
|
|
||||||
.PARAMETER Zip
|
.PARAMETER Zip
|
||||||
Build the ZIP AND NOTHING ELSE. You probably don't want this option
|
Build the ZIP AND NOTHING ELSE. You probably don't want this option.
|
||||||
|
|
||||||
.PARAMETER KickVortex
|
.PARAMETER KickVortex
|
||||||
Syncs the plugin with Vortex. If there are file conflicts, take changes
|
Syncs the plugin with Vortex. This option requires Node.js and pnpm to
|
||||||
from the game directory! This will have changes from the ESP that were
|
communicate with Vortex. Keep in mind that this only half works if Vortex
|
||||||
made in Creation Kit! You need to symlink the /plugin directory into
|
wasn't already started, so if it fails just run the script again.
|
||||||
the staging area, preferably using setup-dev.ps1 script.
|
If there are file conflicts, take changes from the game directory! This will
|
||||||
|
have changes from the ESP that were made in Creation Kit! You need to
|
||||||
|
symlink the /plugin directory into the mod staging area, preferably using
|
||||||
|
setup-dev.ps1 script.
|
||||||
|
|
||||||
|
.PARAMETER KickPort
|
||||||
|
The port for Vortex to listen on.
|
||||||
|
|
||||||
.PARAMETER Reload
|
.PARAMETER Reload
|
||||||
Reloads Skyrim after building. It completely kills and restarts the game
|
Kills Skyrim before and loads it after building. It completely kills the game
|
||||||
as I had trouble getting hlp and reloadscript commands to work.
|
because I had trouble getting hlp and reloadscript commands to work.
|
||||||
#>
|
#>
|
||||||
param (
|
param (
|
||||||
|
[Parameter(Mandatory = $False)]
|
||||||
|
[Switch]
|
||||||
|
$InstallDependencies,
|
||||||
|
|
||||||
[Parameter(Mandatory = $False)]
|
[Parameter(Mandatory = $False)]
|
||||||
[Switch]
|
[Switch]
|
||||||
$Scripts,
|
$Scripts,
|
||||||
|
@ -34,6 +47,7 @@ param (
|
||||||
[Parameter(Mandatory = $False)]
|
[Parameter(Mandatory = $False)]
|
||||||
[Switch]
|
[Switch]
|
||||||
$Textures,
|
$Textures,
|
||||||
|
|
||||||
[Parameter(Mandatory = $False)]
|
[Parameter(Mandatory = $False)]
|
||||||
[Switch]
|
[Switch]
|
||||||
$Zip,
|
$Zip,
|
||||||
|
@ -41,11 +55,24 @@ param (
|
||||||
[Parameter(Mandatory = $False)]
|
[Parameter(Mandatory = $False)]
|
||||||
[Switch]
|
[Switch]
|
||||||
$KickVortex,
|
$KickVortex,
|
||||||
|
[Parameter(Mandatory = $False)]
|
||||||
|
[int]
|
||||||
|
$KickPort = 6969,
|
||||||
|
|
||||||
[Parameter(Mandatory = $False)]
|
[Parameter(Mandatory = $False)]
|
||||||
[Switch]
|
[Switch]
|
||||||
$Reload
|
$Reload
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if($InstallDependencies) {
|
||||||
|
# Chocolatey
|
||||||
|
Set-ExecutionPolicy Bypass -Scope Process -Force
|
||||||
|
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
|
||||||
|
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
|
||||||
|
|
||||||
|
choco install blender gimp 7zip autohotkey
|
||||||
|
}
|
||||||
|
|
||||||
if(-not $Scripts -and -not $Models -and -not $Textures -and -not $Zip) {
|
if(-not $Scripts -and -not $Models -and -not $Textures -and -not $Zip) {
|
||||||
$Scripts = $true
|
$Scripts = $true
|
||||||
$Textures = $true
|
$Textures = $true
|
||||||
|
@ -79,7 +106,7 @@ if(-not $SkyrimBase) {
|
||||||
$steamLibraries = @()
|
$steamLibraries = @()
|
||||||
|
|
||||||
$steamLibraries += @($steamInstallPath)
|
$steamLibraries += @($steamInstallPath)
|
||||||
$steamLibraries += Get-Member -InputObject $libraryFolders.Value -MemberType Dynamic | where-object -Property Name -Match "[0-9]+" | foreach { $libraryFolders.Value[$_.Name].ToString() }
|
$steamLibraries += Get-Member -InputObject $libraryFolders.Value -MemberType Dynamic | where-object -Property Name -Match "[0-9]+" | ForEach-Object { $libraryFolders.Value[$_.Name].ToString() }
|
||||||
|
|
||||||
$manifestPath = $None
|
$manifestPath = $None
|
||||||
foreach($steamLibrary in $steamLibraries) {
|
foreach($steamLibrary in $steamLibraries) {
|
||||||
|
@ -110,6 +137,12 @@ if(-not $SkyrimBase) {
|
||||||
)).FullName
|
)).FullName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($Reload) {
|
||||||
|
if($Proc) {
|
||||||
|
Stop-Process $Proc
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if($Scripts) {
|
if($Scripts) {
|
||||||
# Compile the scripts
|
# Compile the scripts
|
||||||
& "$SkyrimBase/Papyrus Compiler/PapyrusCompiler.exe" `
|
& "$SkyrimBase/Papyrus Compiler/PapyrusCompiler.exe" `
|
||||||
|
@ -127,7 +160,8 @@ if($Scripts) {
|
||||||
if($Textures) {
|
if($Textures) {
|
||||||
Push-Location "$PSScriptRoot"
|
Push-Location "$PSScriptRoot"
|
||||||
|
|
||||||
gimp-console -n -i --batch-interpreter python-fu-eval -b "import export_gimp_textures"
|
$Gimp = (Get-Item -Path @("$Env:ProgramFiles/GIMP*/bin/gimp-console*.exe", "${env:ProgramFiles(x86)}/GIMP*/bin/gimp-console*.exe")).FullName
|
||||||
|
& $Gimp -n -i --batch-interpreter python-fu-eval -b "import export_gimp_textures"
|
||||||
|
|
||||||
if($LastExitCode -ne 0) {
|
if($LastExitCode -ne 0) {
|
||||||
return $LastExitCode
|
return $LastExitCode
|
||||||
|
@ -136,12 +170,81 @@ if($Textures) {
|
||||||
Pop-Location
|
Pop-Location
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if($Models) {
|
if($Models) {
|
||||||
blender --background --python "$PSScriptRoot/export_blender_models.py"
|
$Blender = (Get-Item -Path @("${env:ProgramFiles(x86)}/blender*/blender*/blender.exe", "$env:ProgramFiles/blender*/blender*/blender.exe")).FullName
|
||||||
|
& $Blender --background --python "$PSScriptRoot/export_blender_models.py"
|
||||||
|
|
||||||
if($LastExitCode -ne 0) {
|
if($LastExitCode -ne 0) {
|
||||||
return $LastExitCode
|
return $LastExitCode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$ChunkmergeBase = "$PSScriptRoot/build/ChunkMerge"
|
||||||
|
$MeshSourceDir = "$PSScriptRoot/Source/Meshes/_EQ_ItemRoulette"
|
||||||
|
$MeshDestDir = "$PSScriptRoot/plugin/Data/Meshes/_EQ_ItemRoulette"
|
||||||
|
$ChunkMergeZip = "$PSScriptRoot/build/chunkmerge.7z"
|
||||||
|
if(-not (Test-Path $ChunkmergeBase)) {
|
||||||
|
Invoke-WebRequest -Uri "https://github.com/downloads/skyfox69/NifUtils/ChunkMerge0155.7z" -OutFile $ChunkMergeZip
|
||||||
|
7z x "-o$PSScriptRoot/build" $ChunkMergeZip
|
||||||
|
}
|
||||||
|
|
||||||
|
$ChunkMergeConfig = @"
|
||||||
|
<Config>
|
||||||
|
<PathSkyrim>$SkyrimBase</PathSkyrim>
|
||||||
|
<PathNifXML>$PSScriptRoot/nif.xml</PathNifXML>
|
||||||
|
<PathTemplate>$MeshSourceDir</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>
|
||||||
|
"@
|
||||||
|
|
||||||
|
Out-File -Encoding ascii -FilePath "$ChunkmergeBase/ChunkMerge.xml" -InputObject $ChunkMergeConfig
|
||||||
|
|
||||||
|
$ChunkMerge = "$ChunkmergeBase/ChunkMerge.exe"
|
||||||
|
& $ChunkMerge
|
||||||
|
|
||||||
|
# FIXME This path is not recursive because ChunkMerge can't handle it
|
||||||
|
foreach($ChunkTemplate in (Get-Item "$MeshSourceDir/*_template.nif")) {
|
||||||
|
$env:ChunkMerge_NifFile = Join-Path $MeshDestDir ($ChunkTemplate.Name -replace "_template.", ".")
|
||||||
|
$env:ChunkMerge_CollisionFile = Join-Path $MeshDestDir ($ChunkTemplate.Name -replace "_template.", "_collision.")
|
||||||
|
$env:ChunkMerge_TemplateFile = $ChunkTemplate.Name
|
||||||
|
Start-Process -Wait -FilePath AutoHotkey -ArgumentList @("$PSScriptRoot/ChunkMerge.ahk")
|
||||||
|
|
||||||
|
if($LastExitCode -ne 0) {
|
||||||
|
return $LastExitCode
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($Zip) {
|
if($Zip) {
|
||||||
|
@ -154,23 +257,28 @@ if($Zip) {
|
||||||
|
|
||||||
if($KickVortex) {
|
if($KickVortex) {
|
||||||
# Restart Vortex and kick off deploy-mods event via Chrome Debug Protocol.
|
# Restart Vortex and kick off deploy-mods event via Chrome Debug Protocol.
|
||||||
Stop-Process -Name Vortex -ErrorAction SilentlyContinue
|
$VortexRunningWithDebuggingPortActive = `
|
||||||
$env:KICK_PORT=6969
|
(Get-NetTCPConnection -State Listen -LocalPort $KickPort -ErrorAction SilentlyContinue) `
|
||||||
$VortexPath = (Get-ItemProperty HKLM:\SOFTWARE\57979c68-f490-55b8-8fed-8b017a5af2fe).InstallLocation
|
| Where-Object {
|
||||||
$GameId = (Get-Item "$env:APPDATA/Vortex/skyrim*").BaseName
|
$tcpConn = $_
|
||||||
& "$VortexPath/Vortex.exe" --remote-debugging-port=$env:KICK_PORT --game=$GameId
|
Get-Process -Name Vortex | Where-Object { $tcpConn.OwningProcess -eq $_.Id }
|
||||||
|
}
|
||||||
|
|
||||||
|
$env:KICK_PORT=$KickPort
|
||||||
|
|
||||||
|
if (-not $VortexRunningWithDebuggingPortActive) {
|
||||||
|
Stop-Process -Name Vortex -ErrorAction SilentlyContinue
|
||||||
|
$VortexPath = (Get-ItemProperty HKLM:\SOFTWARE\57979c68-f490-55b8-8fed-8b017a5af2fe).InstallLocation
|
||||||
|
$GameId = (Get-Item "$env:APPDATA/Vortex/skyrim*").BaseName
|
||||||
|
& "$VortexPath/Vortex.exe" --remote-debugging-port=$KickPort --game=$GameId
|
||||||
|
}
|
||||||
|
|
||||||
pnpm install -C "$PSScriptRoot"
|
pnpm install -C "$PSScriptRoot"
|
||||||
|
|
||||||
node "$PSScriptRoot/kick-vortex.js"
|
node "$PSScriptRoot/kick-vortex.js"
|
||||||
Stop-Process -Name Vortex -ErrorAction SilentlyContinue
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($Reload) {
|
if($Reload) {
|
||||||
if($Proc) {
|
|
||||||
Stop-Process $Proc
|
|
||||||
}
|
|
||||||
|
|
||||||
# Prefer SKSE loader if we have it installed
|
# Prefer SKSE loader if we have it installed
|
||||||
$SkyrimExe = Get-Item -Path @(
|
$SkyrimExe = Get-Item -Path @(
|
||||||
"$SkyrimBase/skse*_loader.exe",
|
"$SkyrimBase/skse*_loader.exe",
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import bpy
|
import bpy
|
||||||
import os
|
import os
|
||||||
|
import itertools
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
curdir = Path(__file__).parent
|
curdir = Path(__file__).parent
|
||||||
|
@ -10,12 +11,12 @@ mesh_src_dir = curdir.joinpath("Source/Meshes")
|
||||||
print("Mesh Source directory: " + str(mesh_src_dir))
|
print("Mesh Source directory: " + str(mesh_src_dir))
|
||||||
mesh_dest_dir = plugin_data_dir.joinpath("Meshes")
|
mesh_dest_dir = plugin_data_dir.joinpath("Meshes")
|
||||||
print("Mesh Dest directory: " + str(mesh_dest_dir))
|
print("Mesh Dest directory: " + str(mesh_dest_dir))
|
||||||
blend_paths = Path(mesh_src_dir).rglob("*.blend")
|
blend_paths = itertools.chain(Path(mesh_src_dir).rglob("*_mesh.blend"), Path(mesh_src_dir).rglob("*_collision.blend"))
|
||||||
for blend_path in blend_paths:
|
for blend_path in blend_paths:
|
||||||
dest_blend_path = mesh_dest_dir.joinpath(blend_path.relative_to(mesh_src_dir))
|
dest_blend_path = mesh_dest_dir.joinpath(blend_path.relative_to(mesh_src_dir))
|
||||||
nif_parent = dest_blend_path.parent
|
nif_parent = dest_blend_path.parent
|
||||||
nif_path = nif_parent.joinpath(dest_blend_path.stem + '.nif')
|
nif_path = nif_parent.joinpath(dest_blend_path.stem.replace('_mesh', '') + '.nif')
|
||||||
print(str(blend_path) + " -> " + str(nif_path))
|
print("CONVERTING: " + str(blend_path) + " -> " + str(nif_path))
|
||||||
try:
|
try:
|
||||||
nif_parent.mkdir(parents=True)
|
nif_parent.mkdir(parents=True)
|
||||||
except FileExistsError:
|
except FileExistsError:
|
||||||
|
|
Binary file not shown.
Loading…
Add table
Reference in a new issue