Files
2025-09-29 00:52:08 +02:00

2546 lines
117 KiB
Plaintext
Executable File

------------------------------------------------------------------------------------
--
-- File:: RsJunctionVisualiser.ms
-- Description:: Junction Test Visualisation/Generation/Analysis Tool
--
-- Author:: Martin Good <martin.good@rockstarnorth.com>
-- Date:: 06/03/2014
--
------------------------------------------------------------------------------------
filein (RsConfigGetWildWestDir() + "script/3dsMax/_config_files/Wildwest_header.ms")
filein (RsConfigGetWildWestDir() + "script/3dsMax/_common_functions/FN_RSTA_XML.ms")
fileIn "pipeline/util/RAG_funcs.ms"
filein "pipeline/util/assert.ms"
global RsJunctionViewerPos = [580,75] -- floater height and default position
try (RsJunctionViewerPos = GetDialogPos RsJunctionViewer ; DestroyDialog RsJunctionViewer) catch()
try (CloseRolloutFloater RsJunctionAddPreset) catch()
---- MAIN DIALOG ----
rollout RsJunctionViewer "Junction Test Viewer"
(
local ROwidth = 250
local FPPrecision = "#.2f"
-- STRUCTS --
struct Preset (Name, HMult, WMult, HOffset, WOffset, TrackedStat, MHStat, MWStat, ZeroZ)
struct Project (name, folder, platforms)
struct Thresholds (col1, col2, col3, col4, col5, col6, col7, col8, col9, val1, val2, val3, val4, val5, val6, val7, val8, val9)
struct versionformat (target, ToD, vNum) -- For parsed file name settings... for use in ParseFileName function...
struct texture (name, size, dims, form, TCS, type, template, sourceImage, sourceRes, errorFlag)
-- VARIABLES --
local PresetValues = #()
local Projects = #()
local defaultThresholds = Thresholds col1:[40, 0, 0] col2:[255, 0, 0] col3:[255, 165, 0]col4:[255, 255, 0] \
col5:[70, 255, 0] col6:[235, 235, 235] col7:[0, 210, 255] col8:[0, 96, 255] col9:[0, 22, 132] \
val1:4.0 val2:2.0 val3:0.5 val4:0.25 val5:0 val6:(0 - 0.01) val7:-10 val8:-20 val9:-40
local Threshes = #(defaultThresholds)
local TextureList = #()
local DefaultsFile = ::RsConfigGetWildwestDir() + "\script\3dsMax\Optimisation\RSJunctionVisualiser_Defaults.csv"
local DefaultPreset = Preset name:"Default Preset" HMult:1 WMult:1 HOffset:8 WOffset:8 TrackedStat:5 MHStat:5 MWStat:5 ZeroZ:false
local PresetValues = #(DefaultPreset)
local PresetNames = #(DefaultPreset.name)
local DefaultProject = Project name:" " folder:"X:\\" platforms:#("XBox360", "PS3", "PS4", "XB1", "PC")
local Projects = #(DefaultProject)
local ProjectNames = #(DefaultProject.name)
local BATNames = #("CLICK_ME_360_JUNC_TEST.bat", "CLICK_ME_PS3_JUNC_TEST.bat", "game_orbis_beta.bat", "game_durango_beta.bat", "game_win64_beta.bat")
-- Used to track dropdownlist changes
local ActivePreset = 1
local ActiveProject = 1
local ActiveThresh = 1
--local DefaultCurrCSVName = "X:\Juncs\Output\LIBERTY_Junc_out_360_OVERNEW.csv" -- my default location... proper junction tests may be in the following...
--local DefaultPrevCSVName = "X:\Juncs\Output\LIBERTY_Junc_out_360_v006.csv"
local DefaultCurrCSVName = "N:\RSGEDI\QA\GTA V\Art\Automated Map Junction Tests\Results\Readings v369\Junc_out_PS3_v369_DAY.csv" -- my default location... proper junction tests may be in the following...
local DefaultPrevCSVName = "N:\RSGEDI\QA\GTA V\Art\Automated Map Junction Tests\Results\Older Readings\Readings v340\Junc_out_xbox_v340_DAY.csv"
local DefaultWriteCSVLocation = "X:\Juncs\LIBERTY_Test_Junctions.csv"
local currCSVName = DefaultCurrCSVName
local prevCSVName = DefaultPrevCSVName
local writeCSVName = DefaultWriteCSVLocation
-- Flags due to separate rollouts... (may not need...)
local compare_tests = false
local OldVersion = versionformat target:"ps3" ToD:"Day" vNum:"v340"
local NewVersion = versionformat target:"ps3" ToD:"Day" vNum:"v369"
dotNetControl rsBannerPanel "System.Windows.Forms.Panel" height:32 pos:[0,0] width:RsJunctionViewer.width
local banner = makeRsBanner dn_Panel:rsBannerPanel versionNum:1.0 versionName:"Evaluation Version" colourScheme:#eval filename:(getThisScriptFilename())
subrollout Comp "Compare Junctions" height:26 width:ROwidth pos:[3,37] rolledup:true
progressbar CompVisSeparator "" value:100 width:ROwidth color:[40, 0,0] height:7 pos:[3,65]
subrollout Vis "Visualise Junctions" height:926 width:ROwidth pos:[3,72] rolledup:false
progressbar VisGenSeparator "" value:100 width:ROwidth color:[40, 0,0] height:7 pos:[3,1000]
subrollout Gen "Generate Junction File" height:26 width:ROwidth pos:[3,1008] rolledup:true
---- VISUALISER FUNCTIONS ----
fn loadSettings =
( -- Load initial settings from defaults file (::RsConfigGetWildwestDir() + "\script\3dsMax\Optimisation\RSJunctionVisualiser_Defaults.csv")
local defaults_file = openFile DefaultsFile
/* -- comment this out to override default file */
if defaults_file != undefined then
(
while not eof defaults_file do
(
local nextCSVline = readline defaults_file
local DefaultsData = filterstring nextCSVline ","
case DefaultsData[1] of
(
"DefaultWriteCSVLocation": (writeCSVName = DefaultWriteCSVLocation = DefaultsData[2] as string)
"DefaultCurrentCSVLocation": (currCSVName = DefaultCurrCSVName = DefaultsData[2] as string)
"DefaultPreviousCSVLocation": (prevCSVName = DefaultPrevCSVName = DefaultsData[2] as string)
"DefaultCol1Thresh(Highest)": (Threshes[1].val1 = DefaultsData[2] as float)
"DefaultCol2Thresh": (Threshes[1].val2 = DefaultsData[2] as float)
"DefaultCol3Thresh": (Threshes[1].val3 = DefaultsData[2] as float)
"DefaultCol4Thresh": (Threshes[1].val4 = DefaultsData[2] as float)
"DefaultCol5Thresh": (Threshes[1].val5 = DefaultsData[2] as float)
"DefaultCol6Thresh": (Threshes[1].val6 = DefaultsData[2] as float)
"DefaultCol7Thresh": (Threshes[1].val7 = DefaultsData[2] as float)
"DefaultCol8Thresh": (Threshes[1].val8 = DefaultsData[2] as float)
"DefaultCol9Thresh(Lowest)": (Threshes[1].val9 = DefaultsData[2] as float)
"Colour1 RGB":(Threshes[1].col1.x = DefaultsData[2] as float ; Threshes[1].col1.y = DefaultsData[3] as float ; Threshes[1].col1.z = DefaultsData[4] as float)
"Colour2 RGB":(Threshes[1].col2.x = DefaultsData[2] as float ; Threshes[1].col2.y = DefaultsData[3] as float ; Threshes[1].col2.z = DefaultsData[4] as float)
"Colour3 RGB":(Threshes[1].col3.x = DefaultsData[2] as float ; Threshes[1].col3.y = DefaultsData[3] as float ; Threshes[1].col3.z = DefaultsData[4] as float)
"Colour4 RGB":(Threshes[1].col4.x = DefaultsData[2] as float ; Threshes[1].col4.y = DefaultsData[3] as float ; Threshes[1].col4.z = DefaultsData[4] as float)
"Colour5 RGB":(Threshes[1].col5.x = DefaultsData[2] as float ; Threshes[1].col5.y = DefaultsData[3] as float ; Threshes[1].col5.z = DefaultsData[4] as float)
"Colour6 RGB":(Threshes[1].col6.x = DefaultsData[2] as float ; Threshes[1].col6.y = DefaultsData[3] as float ; Threshes[1].col6.z = DefaultsData[4] as float)
"Colour7 RGB":(Threshes[1].col7.x = DefaultsData[2] as float ; Threshes[1].col7.y = DefaultsData[3] as float ; Threshes[1].col7.z = DefaultsData[4] as float)
"Colour8 RGB":(Threshes[1].col8.x = DefaultsData[2] as float ; Threshes[1].col8.y = DefaultsData[3] as float ; Threshes[1].col8.z = DefaultsData[4] as float)
"Colour9 RGB":(Threshes[1].col9.x = DefaultsData[2] as float ; Threshes[1].col9.y = DefaultsData[3] as float ; Threshes[1].col9.z = DefaultsData[4] as float)
"Preset":
(
local newPreset = Preset name:DefaultsData[2]
newPreset.HMult = DefaultsData[3] as float ; newPreset.WMult = DefaultsData[4] as float
newPreset.HOffset = DefaultsData[5] as float ; newPreset.WOffset= DefaultsData[6] as float
newPreset.TrackedStat= DefaultsData[7] as integer ; newPreset.MWStat= DefaultsData[8] as integer ; newPreset.MHStat= DefaultsData[9] as integer
newPreset.ZeroZ= DefaultsData[10] as booleanClass
append PresetValues newPreset
append PresetNames newPreset.name
if ( DefaultsData[2] == "XBox360 Preset" ) then ActivePreset = PresetNames.count -- !!! This line sets default Preset to XBOX360
)
"Project":
(
local newProject = Project name:DefaultsData[2]
newProject.folder = DefaultsData[3]
local newPlatforms = #()
for pindex = 4 to DefaultsData.count do
(
append newPlatforms DefaultsData[pindex]
)
newProject.platforms = newPlatforms
append Projects newProject
append ProjectNames newProject.name
if ( DefaultsData[2] == "Liberty" ) then ActiveProject = ProjectNames.count -- !!! This line sets default Project build/dev location to LIBERTY
)
)
)
close defaults_file
)
)
fn ParseFileName FileNameString =
( -- Used by Comparison and Visualiser - returns Platform, Time Of Day and Version number gleaned from a filename
local FileVersion = versionformat target:"" ToD:"" vNum:0
local FileNameArray = filterstring (getFilenameFile FileNameString) "_"
for index = 1 to FileNameArray.count do
(
local nextbit = toLower FileNameArray[index]
case of
( -- !!! Extra casess needed for Future Proofing !!!! Possibly convert to dropdownlist.selection value
( nextbit == "ps4"):( FileVersion.target = "orbis" )
( nextbit == "orbis"):( FileVersion.target = "ps4" )
( nextbit == "xb1"):( FileVersion.target = "durango" )
( nextbit == "durango"):( FileVersion.target = "durango" )
( nextbit == "pc"):( FileVersion.target = "x64" )
( nextbit == "x64"):( FileVersion.target = "x64" )
( nextbit == "ps3"):( FileVersion.target = "ps3" )
( nextbit == "xbox"):( FileVersion.target = "xbox" )
( nextbit == "360"):( FileVersion.target = "xbox")
( nextbit == "day"):( FileVersion.ToD = "Day" )
( nextbit == "night"):( FileVersion.ToD = "Night" )
( substring nextbit 1 1 == "v"):( FileVersion.vNum = nextbit )
)
)
--format "%\n" FileVersion
return FileVersion
)
fn FMin Num1 Num2 =
( -- Returns minimum of the two values (Num2 by default)... I suspect that this exists somewhere, but my MaxScriptHelp search failed...
case of
(
(Num1 < Num2) : Num1
(default) : Num2
)
)
fn FMax Num1 Num2 =
( -- Returns maximum of the two values (Num2 by default)... I suspect that this exists somewhere, but my MaxScriptHelp search failed...
case of
(
(Num1 > Num2) : Num1
(default) : Num2
)
)
---- OPEN/CLOSE EVENTS ----
on RsJunctionViewer open do
(
banner.setup()
try (SetDialogPos RsJunctionViewer RsJunctionViewerPos) catch()
loadSettings()
)
on RsJunctionViewer close do
(
try (DestroyDialog RsJunctionRenamePreset) catch()
)
)
rollout RsJunctionRenamePreset "Choose Preset Name"
( -- New scale/position settings preset rename dialog
dotNetControl rsBannerPanel "System.Windows.Forms.Panel" height:32 pos:[0,0] width:RsJunctionRenamePreset.width
local banner = makeRsBanner dn_Panel:rsBannerPanel versionName:"Junction Viewer - Rename Preset" versionNum:1.0 colourScheme:#eval filename:(getThisScriptFilename())
edittext PresetName "" text:"THIS SHOULD BE OVERWRITTEN" width:(RsJunctionRenamePreset.width-4) align:#centre offset:[-13,0]
button SavePreset "SAVE PRESET TO DEFAULTS FILE" width:(RsJunctionRenamePreset.width-8) height:30 align:#centre offset:[-1,-2]
on PresetName changed NewName do
(
local NotFound = true
if ((findItem RsJunctionViewer.PresetNames NewName) == 0) then
(
SavePreset.enabled = true ; SavePreset.text = "SAVE PRESET TO DEFAULTS FILE"
)
else
(
SavePreset.enabled = false ; SavePreset.text = "Preset Name Already Exists"
)
RsJunctionViewer.PresetNames[RsJunctionViewer.ActivePreset] = PresetName.text
RsJunctionViewer.Vis.rollouts[1].MarkerPresets.items = RsJunctionViewer.PresetNames
)
on SavePreset pressed do
(
RsJunctionViewer.PresetNames[RsJunctionViewer.ActivePreset] = PresetName.text
RsJunctionViewer.Vis.rollouts[1].MarkerPresets.items = RsJunctionViewer.PresetNames
local message = "Couldn't open default settings file :\n"+RsJunctionViewer.DefaultDefaultFile+"\nto add the new preset.\n\n"
if doesFileExist RsJunctionViewer.DefaultDefaultFile then
(
if getFileAttribute RsJunctionViewer.DefaultDefaultFile #readOnly then
(
message += "File is read only..."
messageBox message title:"Couldn't update Defaults File"
)
else
(
local defaults_file = openFile DefaultDefaultFile mode:"a"
if defaults_file != undefined then
(
local newPresetString = "Preset,"+PresetName.text+","+(newPreset.HMult as string)+","+(newPreset.WMult as string)+","+(newPreset.HOffset as string)+","+(newPreset.WOffset as string)+","
newPresetString+=(newPreset.TrackedStat as string)+","+(newPreset.MWStat as string)+","+(newPreset.MHStat as string)+","+(newPreset.ZeroZ as string)+"\n"
--format "%\n" newPresetString
format "%" newPresetString to:defaults_file
close defaults_file
)
)
)
else
(
message += "File doesn't exist..."
messageBox message title:"Couldn't update Defaults File"
)
DestroyDialog RsJunctionAddPreset
)
---- ROLLOUT OPEN EVENT ----
on RsJunctionRenamePreset open do
(
banner.setup()
)
on PresetName entered ArgIgnore do
(
DestroyDialog RsJunctionRenamePreset
)
)
---- JUNCTION VIEWER MAIN ROLLOUTS ----
rollout Comparison "Compare Junction Test Results" rolledUp:true
( -- Runs the junction comparison script (if set up properly) on the existing junction memory dump files in N:
local ROwidth = 234
local scriptRootDir = "X:\Juncs\Costs\\"
local compareRootDir = "N:\RSGEDI\QA\GTA V\Art\Automated Map Junction Tests\Results\costs\\" -- All QA memory dumps should be in here somewhere
local compareTextDir = scriptRootDir + "Comparisons\\"
local compare_bat_name = scriptRootDir + "JunctionCompare.bat"
-- And where to dump the temporary uncompressed ZIP files
local compare_NewZIPTemp = scriptRootDir + "ZIPTemp\New"
local compare_OldZIPTemp = scriptRootDir + "ZIPTemp\Old"
local compareNotSetText = " Not set in Visualiser"
-- Adding all the bits together for filenames and paths...
local compareOldPath = compareRootDir + RsJunctionViewer.OldVersion.vNum + "\\" + RsJunctionViewer.OldVersion.ToD + "\\" -- Test results on N:
local compareNewPath = compareRootDir + RsJunctionViewer.NewVersion.vNum + "\\" + RsJunctionViewer.NewVersion.ToD + "\\"
local compareNewFileName = RsJunctionViewer.NewVersion.target + RsJunctionViewer.NewVersion.vNum + ".zip"
local compareOldFileName = RsJunctionViewer.OldVersion.target + RsJunctionViewer.OldVersion.vNum + ".zip"
local DefaultCompareOld = compareOldPath + compareOldFileName
local DefaultCompareNew = compareNewPath + compareNewFileName
local CompareOldZIP = DefaultCompareOld
local CompareNewZIP = DefaultCompareNew
group "Search for .ZIPs from Visualiser Settings"
(
button FindTestResults "Find Junction Test Versions" width:(ROwidth-16) height:30 align:#center offset:[0,-2] tooltip:"Uses the version file names from the CURRENT and PREVIOUS files in the Visualiser to find the corresponding junction streaming dump .ZIP files.\nMay fail to find them if the naming convention changes for either..."
dropdownlist TargetPlatform "" items:RsJunctionViewer.Projects[1].platforms selection:1 align:#left width:(ROwidth-84) height:16 offset:[-4,0] enabled:false
checkbox PlatformOverride "Override" checked:false align:#right offset:[8,-24] tooltip:"Manually override the target platform."
dropdownlist TargetToD "" items:#("Day","Night") selection:1 align:#left width:(ROwidth-84) height:16 offset:[-4,0] enabled:false
checkbox ToDOverride "Override" checked:false align:#right offset:[8,-24] tooltip:"Manually override the Day and Night test results. (Night is less common, so will fail regularly...)"
editText NewVersionNum "New Version" text:" NOT FOUND" fieldwidth:((ROwidth*0.5)-8) labelOnTop:true across:2 align:#left offset:[-5,0] readonly:true enabled:false
editText OldVersionNum "Old Version" text:" NOT FOUND" fieldwidth:((ROwidth*0.5)-8) labelOnTop:true align:#right offset:[5,0] readonly:true enabled:false
button ChangeNewVersion "Change New" across:2 align:#left width:((ROwidth*0.5)-10) height:26 offset:[-4,-2]
button ChangeOldVersion "Change Old" align:#right width:((ROwidth*0.5)-10) height:26 offset:[4,-2]
)
group "Run Junction Compare Script"
(
button ChangeCompBATFile "Change Junction Comparison Script" width:(ROwidth-16) tooltip:"Script for comparing junctions."
editText CompBATFileName "" text:compare_bat_name width:(ROwidth-10) offset:[-2,-5] align:#center readonly:true
button RunTest "Run Comparison Script" width:(ROwidth-16) height:60 offset:[0,2] tooltip:"Run the junction test .BATon your target PS3/XBox/etc. Needs set up outside this script, so results may vary...\nErrors will appear in the text box below."
radioButtons OpenTextFiles "Open after Comparison Script" labels:#("Files","Folder","None") default:2 tooltip:"Opens all the selected junctions' comparison files or the folder when 'Run Comparison Script' is pressed.\nDefault is 'Folder' to prevent spamming notepads. Won't kill previously openend explorer windows though."
editText ErrorText "Info / Errors" text:"" labelOnTop:true width:(ROwidth-16) height:20 align:#center readonly:true enabled:false
)
---- COMPARISON FUNCTIONS ----
fn SearchForZIPNames =
(
ErrorText.text = ""
ErrorText.enabled = false
PlatformOverride.enabled = true
ToDOverride.enabled = true
local OldPlatform = RsJunctionViewer.OldVersion.target
local NewPlatform = RsJunctionViewer.NewVersion.target
local OldTime = RsJunctionViewer.OldVersion.ToD
local NewTime = RsJunctionViewer.NewVersion.ToD
if PlatformOverride.state then
(
case TargetPlatform.selected of
(
"XB1":(OldPlatform = NewPlatform = "durango")
"PS4":(OldPlatform = NewPlatform = "orbis")
"PC":(OldPlatform = NewPlatform = "x64")
"PS3":(OldPlatform = NewPlatform = "ps3")
default:(OldPlatform = NewPlatform = "xbox")
)
)
if ToDOverride.state then
(
OldTime = NewTime = TargetToD.selected
)
compareOldPath = compareRootDir + RsJunctionViewer.OldVersion.vNum + "\\" + OldTime + "\\" -- Test results on N:
compareNewPath = compareRootDir + RsJunctionViewer.NewVersion.vNum + "\\" + NewTime + "\\"
compareOldFileName = OldPlatform + "_" + RsJunctionViewer.OldVersion.vNum
compareNewFileName = NewPlatform + "_" + RsJunctionViewer.NewVersion.vNum
format "New Path :%\nNew file : %\nOld Path : %\nOld file : %\n" compareNewPath CompareNewFileName compareOldPath compareOldFileName
local JunctionZIPName = compareNewPath + compareNewFileName + ".zip"
if doesFileExist JunctionZIPName then
(
--NewVersionNum.text = "Found " + RsJunctionViewer.NewVersion.target + RsJunctionViewer.NewVersion.vNum
NewVersionNum.text = "Found " + compareNewFileName
NewVersionNum.enabled = true
CompareNewZIP = JunctionZIPName
)
else
(
compareNewPath = compareRootDir + RsJunctionViewer.NewVersion.vNum + "\\" -- older test results don't have "Day" in the path...
JunctionZIPName = compareNewPath + compareNewFileName + ".zip"
if doesFileExist JunctionZIPName then
(
NewVersionNum.text = "Found " + compareNewFileName
NewVersionNum.enabled = true
CompareNewZIP = JunctionZIPName
)
else
(
if RsJunctionViewer.NewVersion.vNum == "NONE" then
(
NewVersionNum.text = compareNotSetText
)
else
(
NewVersionNum.text = "Can't find " + compareNewFileName
)
NewVersionNum.enabled = false
)
)
JunctionZIPName = compareOldPath + compareOldFileName + ".zip"
if doesFileExist JunctionZIPName then
(
OldVersionNum.text = "Found " + compareOldFileName
OldVersionNum.enabled = true
CompareOldZIP = JunctionZIPName
)
else
(
compareOldPath = compareRootDir + RsJunctionViewer.OldVersion.vNum + "\\" -- older test results use this path...
JunctionZIPName = compareOldPath + compareOldFileName + ".zip"
if doesFileExist JunctionZIPName then
(
OldVersionNum.text = "Found " + compareOldFileName
OldVersionNum.enabled = true
CompareOldZIP = JunctionZIPName
)
else
(
if RsJunctionViewer.OldVersion.vNum == "NONE" then
(
OldVersionNum.text = compareNotSetText
)
else
(
OldVersionNum.text = "Can't find " + compareOldFileName
)
OldVersionNum.enabled = false
)
)
)
---- COMPARISON EVENTS ----
on PlatformOverride changed Arg do
(
TargetPlatform.enabled = Arg
SearchForZIPNames()
)
on ToDOverride changed Arg do
(
TargetTod.enabled = Arg
SearchForZIPNames()
)
on TargetPlatform selected ArgIgnore do ( SearchForZIPNames() )
on TargetToD selected ArgIgnore do ( SearchForZIPNames() )
on FindTestResults pressed do ( SearchForZIPNames () )
on ChangeOldVersion pressed do
(
local zip_name = getOpenFileName caption:"Old ZIP file" filename:CompareOldZIP types:"ZIP (*.zip)|*.zip|All Files (*.*)|*.*|"
if zip_name == undefined then
(
CompareOldZIP = DefaultCompareOld
ErrorText.text = " Using default .ZIP file location"
)
else
(
CompareOldZIP = zip_name
ErrorText.text =""
local parsedZIPName = RsJunctionViewer.ParseFileName zip_name
format "Target : %, ToD : %, Version : %\n" parsedZIPName.target parsedZIPName.ToD parsedZIPName.vNum
OldVersionNum.text = "Using " + parsedZIPName.target + "_" parsedZIPName.vNum
OldVersionNum.enabled = true
PlatformOverride.enabled = false
PlatformOverride.state = false
ToDOverride.enabled = false
ToDOverride.state = false
TargetToD.enabled = false
TargetPlatform.enabled = false
case parsedZIPName.target of
(
"ps3":( TargetPlatform.selection = 2 )
"xbox":( TargetPlatform.selection = 1 )
)
)
)
on ChangeNewVersion pressed do
(
local zip_name = getOpenFileName caption:"New ZIP file" filename:CompareNewZIP types:"ZIP (*.zip)|*.zip|All Files (*.*)|*.*|"
if zip_name == undefined then
(
CompareNewZIP = DefaultCompareNew
--NewVersionNum.enabled = false -- technically should disable, but will run with default !!!
ErrorText.text = " Using default .ZIP file location"
)
else
(
CompareNewZIP = zip_name
ErrorText.text = ""
local parsedZIPName = RsJunctionViewer.ParseFileName zip_name
format "Target : %, ToD : %, Version : %\n" parsedZIPName.target parsedZIPName.ToD parsedZIPName.vNum
NewVersionNum.text = "Using " + parsedZIPName.target + "_" + parsedZIPName.vNum
NewVersionNum.enabled = true
PlatformOverride.enabled = false
PlatformOverride.state = false
ToDOverride.enabled = false
ToDOverride.state = false
TargetToD.enabled = false
TargetPlatform.enabled = false
case parsedZIPName.target of
(
"ps3":( TargetPlatform.selection = 1 )
"xbox":( TargetPlatform.selection = 2 )
)
)
)
on RunTest pressed do
(
ErrorText.text = ""
ErrorText.enabled = false
local TextNewFileName = TextOldFileName = ScriptOutputName = "NONE"
local CSVPlatform = RsJunctionViewer.NewVersion.target
if PlatformOverride.state then
(
case TargetPlatform.selected of
(
"XB1":(CSVPlatform = "durango")
"PS4":(CSVPlatform = "orbis")
"PC":(CSVPlatform = "x64")
"PS3":(CSVPlatform = "ps3")
default:(CSVPlatform = "xbox")
)
)
if selection.count > 0 and OldVersionNum.enabled and NewVersionNum.enabled and doesFileExist CompBATFileName.text then
(
if makedir compare_NewZIPTemp and makedir compare_OldZIPTemp and makedir compareTextDir then
(
format "Extracting Old ZIP : %\n" CompareOldZIP
unmaz CompareOldZIP compare_OldZIPTemp
format "Extracting New ZIP : %\n" CompareNewZIP
unmaz CompareNewZIP compare_NewZIPTemp
for SelectedJunction in selection do
(
local SelectedJunctionName =SelectedJunction.name + ".txt"
JunctionOldZIPName = compare_OldZipTemp + "\\" + SelectedJunctionName
JunctionNewZIPName = compare_NewZipTemp + "\\" + SelectedJunctionName
if doesFileExist JunctionOldZIPName then
(
TextOldFileName = compareTextDir + "old.txt"
if doesFileExist TextOldFileName then deleteFile TextOldFileName -- remove any old versions or it won't overwrite
local InfoText = "Copying ..\Old\\" + SelectedJunctionName + " --> old.txt | "
format "%" InfoText
copyFile JunctionOldZIPName TextOldFileName
-- NEW FILE COPY --
if doesFileExist JunctionNewZIPName then
(
TextNewFileName = compareTextDir + "new.txt"
if doesFileExist TextNewFileName then deleteFile TextNewFileName -- remove any old versions or it won't overwrite
local InfoText = "..\New\\" + SelectedJunctionName + " --> new.txt | "
format "%" InfoText
copyFile JunctionNewZIPName TextNewFileName
-- Run the comparison script .BAT
HiddenDOSCommand CompBATFileName.text
-- Rename the output file
ScriptOutputName = compareTextDir + "StreamingChanges.txt"
RenamedFileName = RsJunctionViewer.NewVersion.vNum + RsJunctionViewer.OldVersion.vNum + "_" + CSVPlatform + "_" + SelectedJunction.name + "_Changes.txt"
RenamedOutput = compareTextDir + RenamedFileName
copyFile ScriptOutputName RenamedOutput --rename fail... copy instead
format "% written.\n" RenamedFileName
-- Open the output file
if OpentextFiles.state == 1 then
(
HiddenDOSCommand RenamedOutput donotwait:true -- Open with default package... could get messy if set up strangely
--command = RenamedOutput --"%windir%\system32\\notepad.exe " + RenamedOutput -- Original, and moderately guaranteed to work (assuming notepad is there).
)
)
else
(
local InfoText = "Couldn't find " + SelectedJunctionName + " in New .zip file"
format "%\n" InfoText
ErrorText.text = InfoText
)
)
else
(
local InfoText = "Couldn't find " + SelectedJunctionName + " in New .zip file"
format "%\n" InfoText
ErrorText.text = InfoText
)
)
-- Delete any temp files regardless of success --
format "Removing Temp Files : %\n" compare_OldZIPTemp
local command = "del " + compare_OldZIPTemp + "\\*.txt" -- clean up the unzipped files now it's copied
HiddenDOSCommand command donotwait:true
format "Removing Temp Files : %\n" compare_NewZIPTemp
command = "del " + compare_NewZIPTemp + "\\*.txt" -- clean up the unzipped files now it's copied
HiddenDOSCommand command donotwait:true
if doesFileExist TextNewFileName then
(
command = "del " + TextNewFileName
HiddenDOSCommand command donotwait:true
)
if doesFileExist TextOldFileName then
(
command = "del " + TextOldFileName
HiddenDOSCommand command donotwait:true
)
if doesFileExist ScriptOutputName then
(
command = "del " + ScriptOutputName
HiddenDOSCommand command donotwait:true
)
if OpenTextFiles.state == 2 then
(
command = "explorer " + compareTextDir ; HiddenDOSCommand command donotwait:true
)
)
else
(
ErrorText.text = "Problem creating folder : "
if makedir compare_NewZIPTemp == false then Error.text += compare_NewZIPTemp + " "
if makedir compare_OldZIPTemp == false then Error.text += compare_OldZIPTemp + " "
if makedir compareTextDir == false then Error.text += compareTextDir
ErrorText.enabled = true
)
)
else
(
case of -- Fail cases
(
(selection.count == 0) : ( ErrorText.text = "Nothing Selected")
(OldVersionNum.enabled == false) : (ErrorText.text = "No Old Version .zip file selected")
(NewVersionNum.enabled == false) : ( ErrorText.text = "No New Version .zip file selected")
(doesFileExist CompBATFileName.text == false):( ErrorText.text = CompBATFileName.text + " does not exist." )
)
ErrorText.enabled = true
)
)
---- COMPARISON ROLLOUT EVENTS ----
on Comparison rolledUp Rolled do
(
if Rolled then (RsJunctionViewer.Comp.height = 424) else (RsJunctionViewer.Comp.height = 26)
RsJunctionViewer.Vis.pos.y = RsJunctionViewer.Comp.height + RsJunctionViewer.Comp.pos.y + 10
if (RsJunctionViewer.Vis.height > 26) then (RsJunctionViewer.Vis.height = RsJunctionViewer.height - (RsJunctionViewer.Vis.pos.y + RsJunctionViewer.Gen.height + 14))
RsJunctionViewer.Gen.pos.y = RsJunctionViewer.Vis.pos.y + RsJunctionViewer.Vis.height + 10
RsJunctionViewer.CompVisSeparator.position.y = RsJunctionViewer.Vis.pos.y - 7
RsJunctionViewer.VisGenSeparator.position.y = RsJunctionViewer.Gen.pos.y - 7
)
)
rollout Visualiser "Visualise Junction Test Results"
( -- Loads junction test results and displays them as boxes, sized and coloured by a selection of the test data
local ROwidth = 234
local CPwidth = 38
local LockGap = 0.01
local ThresholdGap = 0.05
local ThresholdLimit = 200.0
local Threshes = RsJunctionViewer.Threshes
local PrevThresh = #(Threshes[1].val1,Threshes[1].val2,Threshes[1].val3,Threshes[1].val4,Threshes[1].val5,Threshes[1].val6,Threshes[1].val7,Threshes[1].val8,Threshes[1].val9)
local CurrThresh = deepcopy PrevThresh
struct junction (name, xcoord, ycoord, zcoord, main, vram, main_compare, vram_compare, archetypes, archetypes_compare, bad_junc, tracked_stat, marker)
local active_juncs = #()
-- Values used for Stat Tracking
local WorstCount = 0
local WorstJunc = ThresholdLimit
local BestJunc = 0.0 - ThresholdLimit
local WorstThresh = 0.0
local TrackedMean = 0.0
local NotLoadedText = " Not Loaded"
struct JuncFileHeader (name, x, y, z, Main, VRAM, VRAMScene, MainScene, VRAMAvail, MainAvail, ArchNum)
local JuncField = JuncFileHeader name:-10000 x:-10000 y:-10000 z:-10000 Main:-10000 VRAM:-10000 \
VRAMScene:-10000 MainScene:-10000 VRAMAvail:-10000 MainAvail:-10000 ArchNum:-10000
group "Junction Test Files"
(
button LoadCurrentCSV "Load CURRENT Data" width:((ROWidth*0.65)-8) height:40 align:#left offset:[-4, -4]
button ChangeCurrentCSV "Browse" width:((ROWidth*0.35)-8) height:22 align:#right offset:[4,-45]
editText CurrFileCount "" text:" Not Loaded" width:((ROWidth*0.35)-3) align:#right offset:[5,-4] enabled:false readonly:true
editText CurrFileName "" text:(filenameFromPath RsJunctionViewer.currCSVName) width:(ROWidth-10) align:#left offset:[-9,-4] enabled:true readonly:true
button LoadPreviousCSV "Load PREVIOUS Data" width:((ROWidth*0.65)-8) height:40 align:#left offset:[-4, 0] enabled:false
button ChangePreviousCSV "Browse" width:((ROWidth*0.35)-8) height:22 align:#right offset:[4,-45] enabled:false
editText PrevFileCount "" text:" Not Loaded" width:((ROWidth*0.35)-3) align:#right offset:[5,-4] enabled:false readonly:true
editText PrevFileName "" text:(filenameFromPath RsJunctionViewer.prevCSVName) width:(ROWidth-10) align:#left offset:[-9,-4] enabled:true readonly:true
progressbar PrevSurround "" color:[60,220,60] value:100 width:((ROwidth*0.5)-34) height:24 align:#left offset:[-5,0] enabled:false
progressbar CurrSurround "" color:[60,220,60] value:100 width:((ROwidth*0.5)-34) height:24 align:#left offset:[((ROwidth*0.5)-37),-29] enabled:false
progressbar DiffSurround "" color:[60,220,60] value:100 width:51 height:24 align:#right offset:[4,-29] enabled:false
editText VersionPrevious "" text:NotLoadedText width:((ROwidth*0.5)-37) offset:[-5, -25] align:#left readonly:true enabled:false
editText VersionCurrent "" text:NotLoadedText width:((ROwidth*0.5)-37) offset:[((ROwidth*0.5)-37), -22] align:#left readonly:true enabled:false
editText CompareCount "" text:" N/A" width:48 align:#right offset:[1, -22] enabled:false readonly:true tooltip:"Number of junctions contained in both CURRENT and PREVIOUS files."
button UsePrevious "PREVIOUS" width:((ROwidth*0.5)-34) offset:[-5, 0] align:#left enabled:false
button UseCurrent "CURRENT" width:((ROwidth*0.5)-34) offset:[((ROwidth*0.5)-37), -26] align:#left enabled:false
button UseDiff "DIFF" width:51 align:#right offset:[4, -26] enabled:false
radioButtons TrackedVersion "" labels:#("CURRENT", "PREVIOUS","DIFF") default:3 columns:3 align:#centre offset:[6,-20] visible:false enabled:false tooltip:"Switch between the 2 versions, and the comparison."
)
group "Stat Tracking"
(
editText BestJunction "" text:" N/A" across:2 align:#left fieldwidth:((ROwidth/2)-45) offset:[-8,0] readonly:true enabled:false tooltip:"Lowest tracked stat value."
editText WorstJunction "Low ---> High" text:" N/A" align:#right offset:[5,0] fieldwidth:((ROwidth/2)-45) readonly:true enabled:false tooltip:"Highest tracked stat value."
spinner WorstJunctionCount "" range:[0,0,0] scale:1 type:#integer across:2 align:#left fieldwidth:((ROwidth/2)-56) offset:[-5,3] enabled:false tooltip:"Number of junctions over threshold."
spinner WorstThreshold "over " range:[BestJunc, WorstJunc, WorstThresh] type:#float align:#right fieldwidth:((ROwidth/2)-62) offset:[-46, 3] tooltip:"Worst junction threshold."
button SelectWorst "Select" align:#right offset:[2,-24] enabled:false tooltip:"Select worst junctions using the over count/threshold to the left."
checkbox AutoSelect "Auto-Select" checked:false across:2 align:#left enabled:false offset:[-3,-2]
radioButtons AutoSelectType "" labels:#("Worst", "Nth") columns:2 default:2 align:#right offset:[20,-2]
radioButtons DropJunctions "Drop Junctions" labels:#("Under 0 MB", "Best", "None") default:3 columns:3 offset:[-4, 0] enabled:false align:#left tooltip:"Lowers the junctions.\n 0 MB : all junctions below 0.0MB\n Over : all junctions below the over value\nNone : don't lower any"
checkbox HideBest "Hide Dropped" align:#left across:2 offset:[-4, -2] ticked:false enabled:false
spinner DropAmount "Drop By" range:[0.0, 1000.0, 1000.0] scale:10.0 align:#right width:114 offset:[4, -2] enabled:false tooltip:"Distance to drop junctions by."
--progressbar RAGSurround "" color:[0,255,0] value:100 width:((ROwidth*0.35)-5) height:32 align:#left offset:[-6,-2] enabled:false
--button RAGConnect "CONNECT" height:24 width:((ROwidth*0.35)-12) across:2 align:#left offset:[-2,-33] enabled:true
--button WarpTo "Warp Player" height:30 width:((ROwidth*0.65)-78) align:#right offset:[-64,-36] enabled:false
--button Analyse "ANALYSE" height:30 width:66 align:#right offset:[4,-35] enabled:true
progressbar RAGSurround "" color:[0,255,0] value:100 width:(ROwidth*0.35) height:32 align:#left offset:[-6,-2] enabled:false
button RAGConnect "CONNECT" height:24 width:((ROwidth*0.35)-7) across:2 align:#left offset:[-2,-33] enabled:true
button WarpTo "Warp To Selection" height:30 width:((ROwidth*0.65)-16) align:#right offset:[4,-36] enabled:false
)
group "Marker Scale and Position"
(
radioButtons WidthOptions "Marker Width" labels:#("Main","VRAM","Main+VRAM","Archetypes","None") default:RsJunctionViewer.PresetValues[RsJunctionViewer.ActivePreset].MWStat columns:1 align:#left offset:[-3,0] tooltip:"Statistic to track on junction marker heights"
radioButtons HeightOptions "Marker Height" labels:#("Main","VRAM","Main+VRAM","Archetypes","None") default:RsJunctionViewer.PresetValues[RsJunctionViewer.ActivePreset].MHStat columns:1 align:#left offset:[76,-96] tooltip:"Statistic to track on junction marker widths"
radioButtons TrackedStat "Track" labels:#("Main","VRAM","M+V","ATypes","None","Width","Height") default:RsJunctionViewer.PresetValues[RsJunctionViewer.ActivePreset].TrackedStat columns:1 align:#right offset:[8,-96]tooltip:"Stats to use for colour group.\nDefault is Total = Main + VRAM.\nHeight and Width options are affected by offsets."
checkbox TrackLink "Link Width/Height to Track" checked:false align:#left offset:[-1,-27]
spinner HeightMult "Height : Scale" range:[0.1,100.0,RsJunctionViewer.PresetValues[RsJunctionViewer.ActivePreset].HMult] type:#float scale:1.0 width:100 align:#left across:2 offset:[-3,7] tooltip:"Scale multiplier for junction marker heights."
spinner HeightOffset "Offset" range:[-1000,1000,RsJunctionViewer.PresetValues[RsJunctionViewer.ActivePreset].HOffset] type:#float width:80 align:#right offset:[-6,7] tooltip:"Value in MB to add/subtract from junction marker heights (Default 0.0)"
spinner WidthMult "Width : Scale" range:[0.1,100,RsJunctionViewer.PresetValues[RsJunctionViewer.ActivePreset].WMult] type:#float scale:1.0 width:100 align:#left offset:[-3,-2] across:2 tooltip:"Scale multiplier for junction marker widths."
spinner WidthOffset "Offset" range:[-1000,1000,RsJunctionViewer.PresetValues[RsJunctionViewer.ActivePreset].WOffset] type:#float width:80 align:#right offset:[-6,-2] tooltip:"Value in MB to add/subtract from junction marker widths (Default 8.0 : will need changed to 0.0 if valid data displayed in the widths)."
button ScaleLink " " width:10 height:16 align:#left offset:[110,-30]
button OffsetLink " " width:10 height:16 align:#right offset:[4,-22]
checkbox PositiveWidths "All Widths > 0" checked:true across:2 align:#left offset:[-4,10] tooltip:"Don't allow widths to go bellow 0. Makes top view easier to read."
checkbox ZeroZ "Zero Z Positions" checked:RsJunctionViewer.PresetValues[RsJunctionViewer.ActivePreset].ZeroZ align:#right offset:[8,10] tooltip:"Move junction markers between default positions and 0.0m on z-axis. (Default positions are written to/taken from junction test file)."
dropdownlist MarkerPresets "" items:RsJunctionViewer.PresetNames selection:RsJunctionViewer.ActivePreset align:#left width:((ROwidth*0.67)-8) height:16 offset:[-4,0]
button SaveNewPreset "SAVE NEW" width:((ROwidth*0.33)-8) height:22 align:#right offset:[4,-28]
)
group "Marker Colour Minimum Thresholds"
(
checkbox SmthGrad "Smooth Gradient" checked:true align:#left offset:[-2,-2] tooltip:"Distinct colour groups or smoother gradients across all values."
checkbox ScaleRanges "Scale Ranges" checked:false align:#right offset:[8,-20] enabled:false tooltip:"Makes several buttons affect the threshold values if ticked, forcing the range to the low and high values from Stat Tracking."
colorpicker Col1Picker color:[Threshes[1].col1.x,Threshes[1].col1.y,Threshes[1].col1.z] align:#left Offset:[-7,-2] width:CPwidth height:16
spinner Col1Thresh "" range:[0.0-(ThresholdLimit-(ThresholdGap*7)),ThresholdLimit,Threshes[1].val1] type:#float fieldwidth:46 height:16 align:#left offset:[CPwidth-6,-21] tooltip:"Most expensive junction bracket. Threshold value in MB (or archtypes / 1000)."
button Col1Over "" width:14 height:16 align:#left offset:[CPwidth+54,-21] enabled:false tooltip:"Copy threshold value into 'over' in\n'Stat Tracking' group above."
editText Col1Count "" text:"" fieldwidth:36 height:16 align:#left offset:[CPwidth+67,-22] readonly:true
colorpicker Col2Picker color:[Threshes[1].col2.x,Threshes[1].col2.y,Threshes[1].col2.z] align:#left Offset:[-7,0] width:CPwidth height:16
spinner Col2Thresh "" range:[0.0-(ThresholdLimit-(ThresholdGap*6)),ThresholdLimit-ThresholdGap,Threshes[1].val2] type:#float fieldwidth:46 height:16 align:#left offset:[CPwidth-6,-21]
button Col2Over "" width:14 height:16 align:#left offset:[CPwidth+54,-21] enabled:false tooltip:"Copy threshold value into 'over' in\n'Stat Tracking' group above."
editText Col2Count "" text:"" fieldwidth:36 height:16 align:#left offset:[CPwidth+67,-22] readonly:true
colorpicker Col3Picker color:[Threshes[1].col3.x,Threshes[1].col3.y,Threshes[1].col3.z] align:#left Offset:[-7,0] width:CPwidth height:16
spinner Col3Thresh "" range:[0.0-(ThresholdLimit-(ThresholdGap*5)),ThresholdLimit-(ThresholdGap*2),Threshes[1].val3] type:#float fieldwidth:46 height:16 align:#left offset:[CPwidth-6,-21]
button Col3Over "" width:14 height:16 align:#left offset:[CPwidth+54,-21] enabled:false tooltip:"Copy threshold value into 'over' in\n'Stat Tracking' group above."
editText Col3Count "" text:"" fieldwidth:36 height:16 align:#left offset:[CPwidth+67,-22] readonly:true
colorpicker Col4Picker color:[Threshes[1].col4.x,Threshes[1].col4.y,Threshes[1].col4.z] align:#left Offset:[-7,0] width:CPwidth height:16
spinner Col4Thresh "" range:[0.0-(ThresholdLimit-(ThresholdGap*4)),ThresholdLimit-(ThresholdGap*3),Threshes[1].val4] type:#float fieldwidth:46 height:16 align:#left offset:[CPwidth-6,-21]
button Col4Over "" width:14 height:16 align:#left offset:[CPwidth+54,-21] enabled:false tooltip:"Copy threshold value into 'over' in\n'Stat Tracking' group above."
editText Col4Count "" text:"" fieldwidth:36 height:16 align:#left offset:[CPwidth+67,-22] readonly:true
colorpicker Col5Picker color:[Threshes[1].col5.x,Threshes[1].col5.y,Threshes[1].col5.z] align:#left Offset:[-7,0] width:CPwidth height:16
spinner Col5Thresh "" range:[0.0-(ThresholdLimit-(ThresholdGap*3)),ThresholdLimit-(ThresholdGap*4),Threshes[1].val5] enabled:false type:#float fieldwidth:46 height:16 align:#left offset:[CPwidth-6,-11] tooltip:"Middle junction bracket."
button Col5Over "" width:14 height:16 align:#left offset:[CPwidth+54,-21] enabled:false tooltip:"Copy threshold value into 'over' in\n'Stat Tracking' group above."
editText Col5Count "" text:"" fieldwidth:36 height:16 align:#left offset:[CPwidth+67,-22] readonly:true
colorpicker Col6Picker color:[Threshes[1].col6.x,Threshes[1].col6.y,Threshes[1].col6.z] align:#left Offset:[-7,-10] width:CPwidth height:16
colorpicker Col7Picker color:[Threshes[1].col7.x,Threshes[1].col7.y,Threshes[1].col7.z] align:#left Offset:[-7,0] width:CPwidth height:16
spinner Col7Thresh "" range:[0.0-(ThresholdLimit-(ThresholdGap*2)),ThresholdLimit-(ThresholdGap*5),Threshes[1].val7] type:#float fieldwidth:46 height:16 align:#left offset:[CPwidth-6,-21]
button Col7Over "" width:14 height:16 align:#left offset:[CPwidth+54,-21] enabled:false tooltip:"Copy threshold value into 'over' in\n'Stat Tracking' group above."
editText Col7Count "" text:"" fieldwidth:36 height:16 align:#left offset:[CPwidth+67,-22] readonly:true
colorpicker Col8Picker color:[Threshes[1].col8.x,Threshes[1].col8.y,Threshes[1].col8.z] align:#left Offset:[-7,0] width:CPwidth height:16
spinner Col8Thresh "" range:[0.0-(ThresholdLimit-ThresholdGap),ThresholdLimit-(ThresholdGap*6),Threshes[1].val8] type:#float fieldwidth:46 height:16 align:#left offset:[CPwidth-6,-21]
button Col8Over "" width:14 height:16 align:#left offset:[CPwidth+54,-21] enabled:false tooltip:"Copy threshold value into 'over' in\n'Stat Tracking' group above."
editText Col8Count "" text:"" fieldwidth:36 height:16 align:#left offset:[CPwidth+67,-22] readonly:true
colorpicker Col9Picker color:[Threshes[1].col9.x,Threshes[1].col9.y,Threshes[1].col9.z] align:#left Offset:[-7,0] width:CPwidth height:16
spinner Col9Thresh "" range:[0.0-ThresholdLimit,ThresholdLimit-(ThresholdGap*7),Threshes[1].val9] type:#float fieldwidth:46 height:16 align:#left offset:[CPwidth-6,-21] tooltip:"Least expensive junction bracket. Threshold value in MB (or archtypes / 1000)."
button Col9Over "" width:14 height:16 align:#left offset:[CPwidth+54,-21] enabled:false tooltip:"Copy threshold value into 'over' in\n'Stat Tracking' group above."
editText Col9Count "" text:"" fieldwidth:36 height:16 align:#left offset:[CPwidth+67,-22] readonly:true
button ResetThresholdColours "Reset" align:#left width:(CPwidth-4) height:20 offset:[-3,0] enabled:false tooltip:"Reset the threshold colours to initial defaults."
button ResetThresholdValues "Reset" align:#left width:72 height:20 offset:[CPwidth-4,-25] enabled:false tooltip:"Reset the threshold values to intial defaults."
button UseWorst "Use High" align:#right width:(ROwidth - (CPwidth+132)) height:22 offset:[4,-205] enabled:false tooltip:"Use worst junction value from 'Tracked Stats' as high threshold.\nScales other threshold values if 'Scale Range' is set."
button ZeroMean "Avg." width:(ROwidth - (CPwidth+132)) height:22 align:#right offset:[4,11] enabled:false tooltip:"Set middle threshold value to average junction size (mean).\nScales other threshold values if 'Scale Range' is set."
button ZeroZero "Zero" Width:(ROwidth - (CPwidth+132)) height:22 align:#right offset:[4,-2] enabled:false tooltip:"Set middle threshold to 0.0\nScales other threshold values if 'Scale Range' is set."
checkbox LockZero "Lock" align:#left offset:[(CPwidth+114),0] checked:(not Col5Thresh.enabled) tooltip:"Lock the middle value (mostly).\nCan still change with Avg., Zero, = Count, = Size and Reset."
button EqualizeCount "= Count" width:(ROwidth - (CPwidth+132)) height:22 align:#right offset:[4,0] enabled:false tooltip:"Sets each threshold group to container roughly the same number of junctions."
button EqualizeSize "= Size" width:(ROwidth - (CPwidth+132)) height:22 align:#right offset:[4,-2] enabled:false tooltip:"Equally spaces out threshold values between high and low. Sets minimum and maximum values if 'Scale Ranges' is set."
button UseBest "Use Low" align:#right width:(ROwidth - (CPwidth+132)) height:22 offset:[4,15] enabled:false tooltip:"Use best junction value from 'Tracked Stats' as low threshold.\nScales other threshold values if 'Scale Ranges' is set."
dropdownList ResetOption "" items:#("Default Thresholds") selected:1 width:(CPwidth+110) height:20 align:#left offset:[-3,0]
button StoreThresholds "<-- STORE" width:(ROwidth - (CPwidth+132)) height:22 align:#right offset:[4,-28] enabled:false
)
---- VISUALISER FUNCTIONS ----
---- GENERAL FUNCTIONS ----
fn CompareJuncs junc1 junc2 =
( -- Compare junction Tracked Stat values - used in qsort
diff = junc1.tracked_stat - junc2.tracked_stat
case of
(
(diff < 0.0): 1
(diff > 0.0): -1
default: 0
)
)
---- UI HANDLING FUNCTIONS ----
fn KillWidgets =
( -- Disable widgets - only used briefly when Load Current hit, and re-activated if CSV loaded properly
LoadPreviousCSV.enabled = false
ChangePreviousCSV.enabled = false
WorstJunctionCount.range = [1, 1, 1]
WorstJunctionCount.enabled = false
WorstThreshold.range.x = 0.0 ; WorstThreshold.range.y = 0.0
BestJunction.text = " N/A"
WorstJunction.text = " N/A"
SelectWorst.enabled = false
AutoSelect.enabled = false
DropJunctions.enabled = false
BestJunction.enabled = false
WorstJunction.enabled = false
DropAmount.enabled = false
UseWorst.enabled = false
UseBest.enabled = false
ZeroZero.enabled = false
ZeroMean.enabled = false
EqualizeCount.enabled = false
EqualizeSize.enabled = false
ScaleRanges.enabled = false
Col1Over.enabled = false
Col2Over.enabled = false
Col3Over.enabled = false
Col4Over.enabled = false
Col5Over.enabled = false
Col7Over.enabled = false
Col8Over.enabled = false
Col9Over.enabled = false
)
fn ActivateWidgets =
( -- Active disabled widgets on successful Current CSV load
LoadPreviousCSV.enabled = true
ChangePreviousCSV.enabled =true
PrevFileName.text = filenameFromPath RsJunctionViewer.prevCSVName
PrevFileName.enabled = true
SelectWorst.enabled = true
AutoSelect.enabled = true
DropJunctions.enabled = true
BestJunction.enabled = true
WorstJunction.enabled = true
DropAmount.enabled = true
UseWorst.enabled = true
UseBest.enabled = true
ZeroZero.enabled =true
ZeroMean.enabled = true
EqualizeCount.enabled = true
EqualizeSize.enabled = true
ScaleRanges.enabled = true
Col1Over.enabled = true
Col2Over.enabled = true
Col3Over.enabled = true
Col4Over.enabled = true
Col5Over.enabled = true
Col7Over.enabled = true
Col8Over.enabled = true
Col9Over.enabled = true
)
---- FILE HANDLING FUNCTIONS ----
fn ReadHeader CSVstream =
( -- Parse CSV header to determine which columns are which... (extra data added part way through V, initial NG has no header...)
local header = readLine CSVstream
local headerNames = filterstring header ","
-- set default indices ludicrously low so they can all be tested in one if
JuncField.name = JuncField.x = JuncField.y = JuncField.z = JuncField.Main = JuncField.VRAM = JuncField.VRAMScene = JuncField.MainScene = JuncField.VRAMAvail = JuncField.MainAvail = JuncField.ArchNum = -10000
for index = 1 to headerNames.count do
(
case headerNames[index] of
(
"name": ( JuncField.name = index )
"x": ( JuncField.x = index )
"y": ( JuncField.y = index )
"z": ( JuncField.z = index )
"main":(JuncField.VRAM = index)
"vram":(JuncField.Main = index)
"physical":(JuncField.Main = index)
"virtual":(JuncField.VRAM = index)
"main_avail": ( JuncField.VRAMAvail = index ) -- yes... main and VRAM are swapped in the CSV (at least for 360)...
"vram_avail": ( JuncField.MainAvail = index )
"main_scene": (JuncField.VRAMScene = index )
"vram_scene": ( JuncField.MainScene = index )
"arch_num": ( JuncField.Archnum = index )
)
)
)
fn LoadCurrCSV =
( -- Load CURRENT data - Parse header, set up junction data... visualisation handled elsewhere in ProcessActiveCSV()
local csv_file = openFile RsJunctionViewer.currCSVName
-- Parse the file name to extract equivalent junction test result .zip info (hopefully... since the convension has changed from v315)
RsJunctionViewer.NewVersion.target = RsJunctionViewer.OldVersion.target = RsJunctionViewer.NewVersion.ToD = RsJunctionViewer.OldVersion.ToD = "NONE"
RsJunctionViewer.NewVersion.vNum = RsJunctionViewer.OldVersion.vNum = "NONE"
VersionCurrent.text = VersionPrevious.text = NotLoadedText
VersionCurrent.enabled = VersionPrevious.enabled = CurrSurround.enabled = PrevSurround.enabled = DiffSurround.enabled = false
local parsedCSVName = RsJunctionViewer.ParseFileName RsJunctionViewer.currCSVName
RsJunctionViewer.NewVersion = parsedCSVName
local NewVersionText = RsJunctionViewer.NewVersion.target + " " + RsJunctionViewer.NewVersion.vNum
if csv_file != undefined then
(
if active_juncs.count > 0 then
(
-- Delete old markers
local oldMarkers = #()
for junc in active_juncs do
(
if ( not isDeleted junc.marker) then append oldMarkers junc.marker
)
delete oldMarkers
)
active_juncs = #()
ReadHeader csv_file
-- Override Previous CSV data when new Current CSV is loaded --
TrackedVersion.state = 1
TrackedVersion.enabled = false
UseCurrent.enabled = UsePrevious.enabled = UseDiff.enabled = false
PrevFileName.text = " NONE SELECTED"
PrevFileName.enabled = false
PrevFileCount.text = NotLoadedText
PrevFileCount.enabled = false
CompareCount.text = " N/A"
CompareCount.enabled = false
local indexcheckstat = JuncField.Main + JuncField.VRAM
local indexchecksum = JuncField.VRAMScene + JuncField.MainScene + JuncField.VRAMAvail + JuncField.MainAvail
if indexcheckstat > indexchecksum then memorycheck = indexcheckstat else memorycheck = indexchecksum
if JuncField.Name + JuncField.X + JuncField.Y + JuncField.Z + memorycheck < 0 then -- everything else is ignorable
(
CurrFileName.text = " !!! PROBLEM WITH CSV !!!"
CurrFileName.enabled = false
CurrFileCount.text = NotLoadedText
CurrFileCount.enabled = false
local errorText = "Bad CURRENT CSV : Missing fields " -- report everything including the ignorable missing fields
if JuncField.Name < 0 then errorText += " - Name"
if JuncField.X < 0 then errorText += " - X_coord"
if JuncField.Y < 0 then errorText += " - Y_coord"
if JuncField.Z < 0 then errorText += " - Z_coord"
if JuncField.Main < 0 then errorText += " - Main"
if JuncField.VRAM < 0 then errorText += " - VRAM"
if JuncField.VRAMScene < 0 then errorText += " - VRAM_Scene"
if JuncField.MainScene < 0 then errorText += " - Main_Scene"
if JuncField.VRAMAvail < 0 then errorText += " - VRAM_Avail"
if JuncField.MainAvail < 0 then errorText += " - Main_Avail"
if JuncField.ArchNum < 0 then errorText += " - Archetype_Num"
errorText += "\nEither you've attempted to load something that isn't a junction test CSV, or the format has changed...\n"
messageBox errorText title:"Problem with CSV file"
KillWidgets() -- The penalty for trying to load an invalid CSV is you don't get to play no more
)
else
(
VersionCurrent.text = NewVersionText
VersionCurrent.enabled = true ; CurrSurround.enabled = true
local vram_actual = 0
local main_actual = 0
while not eof csv_file do
(
local nextCSVline = readline csv_file
local CSVdata = filterstring nextCSVline ","
--junc_main = CSVdata[JuncField.Main] as float -- Keeping these lines as a reminder about the extra unused data in the CSVs --
--junc_vram = CSVdata[JuncField.VRAM] as float
--junc_archmem = CSVdata[JuncField.ArchMem] as float
--junc_mainused = CSVdata[JuncField.MainUsed] as float
--junc_vramused = CSVdata[JuncField.VRAMUsed] as float
local junc_name = CSVdata[JuncField.Name]
local junc_x = CSVdata[JuncField.X] as float
local junc_y = CSVdata[JuncField.Y] as float
local junc_z = CSVdata[JuncField.Z] as float
if JuncField.ArchNum > 0 then junc_archnum = CSVdata[JuncField.ArchNum] as float else junc_archnum = 0 -- catch missing archetype data
local arch_num = junc_archnum / 1000
if (indexchecksum > 0) then
(
local junc_mainavail = CSVdata[JuncField.MainAvail] as float
local junc_vramavail = CSVdata[JuncField.VRAMAvail] as float
local junc_mainscene = CSVdata[JuncField.MainScene] as float
local junc_vramscene = CSVdata[JuncField.VRAMScene] as float
if ((junc_mainavail + junc_vramavail) > 0) then
(
vram_actual = (junc_vramscene - junc_vramavail) / 1024
main_actual = (junc_mainscene - junc_mainavail) / 1024
)
else
(
-- available memory = 0 --> next gen USED at least
-- default to VRAM and Main readin
vram_actual = CSVdata[JuncField.VRAM] as float / 1024
main_actual = CSVdata[JuncField.Main] as float / 1024
)
)
else
(
-- missing indices --> old data
-- default to VRAM and Main readin
vram_actual = CSVdata[JuncField.VRAM] as float / 1024
main_actual = CSVdata[JuncField.Main] as float / 1024
)
local next_junction = junction name:junc_name
local next_junction = junction name:junc_name xcoord:junc_x ycoord:junc_y zcoord:junc_z main:main_actual vram:vram_actual main_compare:0 vram_compare:0 archetypes:arch_num archetypes_compare:0 bad_junc:false tracked_stat:StatVal
appendIfUnique active_juncs next_junction
CurrSurround.value = mod active_juncs.count 100
VersionCurrent.enabled = true
)
close csv_file
CurrSurround.value = 100
VersionCurrent.enabled = true
UseCurrent.enabled = true
ActivateWidgets()
CurrFileCount.text = active_juncs.count as string
--CurrFileCount.enabled = true -- Might keep this one disabled unless we go mental with junction counts - box will display up to 9999 easily, probably up to 19999
)
)
else
(
CurrFileName.text = " !!! Missing CSV !!!"
KillWidgets()
) --else Undefined CSV File
)
fn LoadPrevCSV =
( -- Load PREVIOUS data - separate function, since it modifies the existing active_juncs array... common data only tracked properly, no check to see whether the locations match yet...
local csv_file = openFile RsJunctionViewer.prevCSVName
if csv_file != undefined then
(
ReadHeader csv_file
local indexcheckstat = JuncField.Main + JuncField.VRAM
local indexchecksum = JuncField.VRAMScene + JuncField.MainScene + JuncField.VRAMAvail + JuncField.MainAvail
if indexcheckstat > indexchecksum then memorycheck = indexcheckstat else memorycheck = indexchecksum
if JuncField.Name + JuncField.X + JuncField.Y + JuncField.Z + memorycheck < 0 then -- everything else is ignorable
(
--SwapCSVs.enabled = false
TrackedVersion.state = 1
TrackedVersion.enabled = false
UseCurrent.enabled = UsePrevious.enabled = UseDiff.enabled = false
PrevFileName.enabled = false
PrevFileName.text = " !!! PROBLEM WITH CSV !!!"
PrevFileCount.text = NotLoadedText
PrevFileCount.enabled = false
CompareCount.text = " N/A"
CompareCount.enabled = false
local errorText = "Bad PREVIOUS CSV : Missing fields "
if JuncField.Name < 0 then errorText += " - Name"
if JuncField.X < 0 then errorText += " - X_coord"
if JuncField.Y < 0 then errorText += " - Y_coord"
if JuncField.Z < 0 then errorText += " - Z_coord"
if JuncField.Main < 0 then errorText += " - Main"
if JuncField.VRAM < 0 then errorText += " - VRAM"
if JuncField.VRAMScene < 0 then errorText += " - VRAM_Scene"
if JuncField.MainScene < 0 then errorText += " - Main_Scene"
if JuncField.VRAMAvail < 0 then errorText += " - VRAM_Avail"
if JuncField.MainAvail < 0 then errorText += " - Main_Avail"
if JuncField.ArchNum < 0 then errorText += " - Archetype_Num"
errorText += "\nEither you've attempted to load something that isn't a junction test CSV, or the format has changed...\n"
messageBox errorText title:"Problem with CSV file"
)
else
(
-- Parse the file name to extract equivalent junction test result .zip info (hopefully... convension has changed from v315)
-- just need the version number here, since the other info should be set up from the other loadfile button...
RsJunctionViewer.OldVersion.vNum = "NONE"
RsJunctionViewer.OldVersion.target = RsJunctionViewer.OldVersion.ToD = ""
VersionPrevious.text = NotLoadedText
VersionPrevious.enabled = false
--parsedCSVName = RsJunctionViewer.ParseFileName RsJunctionViewer.prevCSVName
--RsJunctionViewer.compareOldTarget = parsedCSVName.target
--RsJunctionViewer.compareOldTimeOfDay = parsedCSVName.ToD
--RsJunctionViewer.compareOldVersion = parsedCSVName.vNum
RsJunctionViewer.OldVersion = RsJunctionViewer.ParseFileName RsJunctionViewer.prevCSVName
local OldVersionText = RsJunctionViewer.OldVersion.target + " " + RsJunctionViewer.OldVersion.vNum
local OldNum = (trimleft RsJunctionViewer.OldVersion.vNum "v") as integer
local NewNum = (trimleft RsJunctionViewer.NewVersion.vNum "v") as integer
if (RsJunctionViewer.NewVersion.target != RsJunctionViewer.OldVersion.target) then
(
case of
(
(OldNum < NewNum):(PrevSurround.color = [220, 180, 30]) -- not entirel sure, if named correctly probably wrong
(OldNum > NewNum):(PrevSurround.color = [255,130,20]) -- probably wrong
(OldNum == NewNum):(PrevSurround.color = [20,130,255]) -- possibly valid, but unusual
)
)
else
(
case of
(
(OldNum < NewNum):(PrevSurround.color = [60,220,60]) -- correct
(OldNum > NewNum):(PrevSurround.color = [255,180,20]) -- probably wrongish
(OldNum == NewNum):(PrevSurround.color = [60,60,60]) -- identical
)
)
VersionPrevious.text = OldVersionText
local previousJuncCount = 0
local foundJuncs = 0
PrevSurround.enabled = true
PrevSurround.value = 0
TrackedVersion.state = 3
TrackedVersion.enabled = true
VersionPrevious.enabled = true
PrevFileName.enabled = true
UseCurrent.enabled = UsePrevious.enabled = UseDiff.enabled = true
while not eof csv_file do
(
--SwapCSVs.enabled = true -- Removed button
local nextCSVline = readline csv_file
local CSVdata = filterstring nextCSVline ","
local vram_actual = 0
local main_actual = 0
local junc_name = CSVdata[JuncField.Name]
local junc_x = CSVdata[JuncField.X] as float
local junc_y = CSVdata[JuncField.Y] as float
local junc_z = CSVdata[JuncField.Z] as float
if JuncField.ArchNum > 0 then junc_archnum = CSVdata[JuncField.ArchNum] as float else junc_archnum = 0 -- catch missing archetype data
local arch_num = junc_archnum / 1000
if indexchecksum > 0 then
(
local junc_mainavail = CSVdata[JuncField.MainAvail] as float
local junc_vramavail = CSVdata[JuncField.VRAMAvail] as float
local junc_mainscene = CSVdata[JuncField.MainScene] as float
local junc_vramscene = CSVdata[JuncField.VRAMScene] as float
if ((junc_mainavail + junc_vramavail) > 0) then
(
vram_actual = (junc_vramscene - junc_vramavail) / 1024
main_actual = (junc_mainscene - junc_mainavail) / 1024
)
else
(
-- available memory = 0 --> next gen USED at least
-- default to VRAM and Main readin
vram_actual = CSVdata[JuncField.VRAM] as float / 1024
main_actual = CSVdata[JuncField.Main] as float / 1024
)
)
else
(
vram_actual = CSVdata[JuncField.VRAM] as float / 1024
main_actual = CSVdata[JuncField.Main] as float / 1024
)
previousJuncCount += 1
local found = false
local index = 0
while index < active_juncs.count do
(
index += 1
if junc_name == active_juncs[index].name then
(
if found then format "Duplicate junction names in CURRENT CSV : %\n" active_juncs[index].name
foundJuncs += 1 -- could add found test so that overlap never excedes previous count, but useful to have it displayed on the widget as well as the Listener error message above
found = true
active_juncs[index].main_compare = active_juncs[index].main - main_actual
active_juncs[index].vram_compare = active_juncs[index].vram - vram_actual
active_juncs[index].archetypes_compare = active_juncs[index].archetypes - arch_num
PrevSurround.value = (((foundJuncs as float)/ active_juncs.count) * 100) as integer
VersionPrevious.enabled = true
)
)
if found == false then format "Couldn't find % in CURRENT version\n" junc_name -- A bit spammy for some junction files, but probably useful enough debug info to keep this
)
close csv_file
PrevSurround.value = 100
VersionPrevious.enabled = true
PrevFileCount.text = previousJuncCount as string
--PrevFileCount.enabled = true -- Might keep this one disabled depending on whether we go mental with junction counts
DiffSurround.enabled = true
case of
(
(foundJuncs == 0):(DiffSurround.color = [255,30,20])
(active_juncs.count > foundJuncs):(DiffSurround.color = [60,220,60])
(active_juncs.count < foundJuncs):(DiffSurround.color = [255,160,20])
default:(DiffSurround.color = [60,220,60])
)
CompareCount.text = foundJuncs as string
CompareCount.enabled = false ; CompareCount.enabled = true
--CompareCount.enabled = true -- smaller number than the one above... still may have to be enabled
)
)
else
(
PrevFileName.text = " !!! Missing CSV !!!"
) --else Undefined CSV File
)
fn ProcessActiveCSV =
( -- Main processing function... Create missing junction marker boxes, track appropriate stats, set marker values according to track settings (animation doings disabled...)
if active_juncs.count > 0 then
(
ChangePreviousCSV.enabled = true
WorstJunc = -1000.0
BestJunc = 1000.0
WorstCount = 0
DropThresh = case DropJunctions.state of
(
1: (0.0)
2: (WorstThreshold.value)
3: (WorstJunc + 1.0)
)
)
else
(
KillWidgets() -- Probably off already, but no harm in doing it again
)
TrackedMean = 0.0
local ThreshCounts = #(0,0,0,0,0,0,0,0)
--CurrSurround.value = 0
--VersionCurrent.enabled = true
--for junc in active_juncs do
for index = 1 to active_juncs.count do
(
--CurrSurround.value = ((index as float / active_juncs.count) * 100) as integer -- Marginally useful, processing fairly quick... this was slowing it down perceptably
--VersionCurrent.enabled = true
local junc = active_juncs[index]
if (junc.marker == undefined) or (junc.marker.isDeleted) then
(
local next_box =getNodeByName junc.name exact:true
if next_box == undefined then
(
--format "Creating junction marker : %\n" junc.name
next_box = box length:4 width:4 height:4 -- Box is missing, so make a new one
next_box.name = junc.name
next_box.pos = [junc.xcoord, junc.ycoord, junc.zcoord]
) -- end if create missing box
junc.marker = next_box
)
else
(
local next_box = junc.marker
)
if classOf next_box.baseobject == box then
(
if next_box.modifiers.count == 2 then
(
delete next_box -- deleting and re-creating much faster than removing the modifiers
next_box = box length:4 width:4 height:4
next_box.name = junc.name
next_box.pos = [junc.xcoord, junc.ycoord, junc.zcoord]
)
if next_box.material != undefined then
(
next_box.material = undefined
)
local height_actual = 0
local width_actual = 0
case TrackedVersion.state of
(
1:
( -- CURRENT
case HeightOptions.state of
(
1: ( height_actual = junc.main )
2: ( height_actual = junc.vram )
3: ( height_actual = junc.main + junc.vram )
4: ( height_actual = junc.archetypes )
5: ( height_actual = 0.0 )
) -- end case setup Main on height/width
case WidthOptions.state of
(
1: ( width_actual = junc.main )
2: ( width_actual = junc.vram )
3: ( width_actual = junc.main + junc.vram )
4: ( width_actual = junc.archetypes )
5: ( width_actual = 0.0 )
) -- end case setup VRAM on height/width
)
2:
( -- PREVIOUS
case HeightOptions.state of
(
1: ( height_actual = junc.main - junc.main_compare )
2: ( height_actual = junc.vram - junc.vram_compare )
3: ( height_actual = (junc.main - junc.main_compare) + (junc.vram - junc.vram_compare) )
4: ( height_actual = junc.archetypes - junc.archetypes_compare )
5: ( height_actual = 0.0 )
) -- end case setup Main on height/width
case WidthOptions.state of
(
1: ( width_actual = junc.main - junc.main_compare )
2: ( width_actual = junc.vram - junc.vram_compare )
3: ( width_actual = (junc.main - junc.main_compare)+ (junc.vram - junc.vram_compare))
4: ( width_actual = junc.archetypes - junc.archetypes_compare )
5: ( width_actual = 0.0 )
) -- end case setup VRAM on height/width
)
default:
( -- DIFF
case HeightOptions.state of
(
1: ( height_actual = junc.main_compare )
2: ( height_actual = junc.vram_compare )
3: ( height_actual = junc.main_compare + junc.vram_compare )
4: ( height_actual = junc.archetypes_compare )
5: ( height_actual = 0.0 )
) -- end case setup Main on height/width
case WidthOptions.state of
(
1: ( width_actual = junc.main_compare )
2: ( width_actual = junc.vram_compare )
3: ( width_actual = junc.main_compare + junc.vram_compare )
4: ( width_actual = junc.archetypes_compare )
5: ( width_actual = 0.0 )
) -- end case setup VRAM on height/width
)
)
height_actual += HeightOffset.value
width_actual += WidthOffset.value -- !!! Replaced
if ZeroZ.state then ( next_box.pos.z = 0.0 ) else ( next_box.pos.z = junc.zcoord )
local ColVal = 0
case TrackedVersion.state of
(
1:
( -- CURRENT
ColVal = case TrackedStat.state of
(
1: junc.main
2: junc.vram
3: junc.main + junc.vram
4: junc.archetypes
5: 0.0
6: width_actual
7: height_actual
) -- end case choose value for colour from curent values
)
2:
( -- PREVIOUS
ColVal = case TrackedStat.state of
(
1: junc.main - junc.main_compare
2: junc.vram - junc.vram_compare
3: (junc.main - junc.main_compare) + (junc.vram - junc.vram_compare)
4: junc.archetypes - junc.archetypes_compare
5: 0.0
6: width_actual
7: height_actual
) -- end case choose value for colour from comparison values
)
default:
( -- DIFF
ColVal = case TrackedStat.state of
(
1: junc.main_compare
2: junc.vram_compare
3: junc.main_compare + junc.vram_compare
4: junc.archetypes_compare
5: 0.0
6: width_actual
7: height_actual
) -- end case choose value for colour from comparison values
)
)
if PositiveWidths.state then if width_actual < 0 then width_actual = 0
junc.tracked_stat = ColVal
TrackedMean += ColVal
if ColVal > WorstJunc then WorstJunc = ColVal
if ColVal < BestJunc then BestJunc = ColVal
if ColVal > WorstThreshold.value then
(
WorstCount += 1
junc.bad_junc = true
)
else
(
junc.bad_junc = false
)
if ColVal <= DropThresh then
(
next_box.pos.z -= DropAmount.value -- move in-budget boxes down
if HideBest.state then
(
next_box.ishidden = true
)
else
(
next_box.ishidden = false
)
)
else
(
next_box.ishidden = false
)
next_box.height = height_actual
next_box.width = width_actual
next_box.length = width_actual
next_box.scale = [WidthMult.value, WidthMult.value, HeightMult.value]
local VCoord = 0.0 -- not strictly needed
if not SmthGrad.state then
(
case of
(
(ColVal < Col9Thresh.value): (BoxColour = Col9Picker.color) -- dark blue ; UCoord = 0.4375
(ColVal < Col8Thresh.value): (BoxColour = Col8Picker.color ; ThreshCounts[8] += 1) -- blue ; UCoord = 0.4375
(ColVal < Col7Thresh.value): (BoxColour = Col7Picker.color ; ThreshCounts[7] += 1) -- cyan -- 6 swapped to 7 ; UCoord = 0.3125
(ColVal < Col5Thresh.value): (BoxColour = Col6Picker.color ; ThreshCounts[6] += 1) -- grey ; UCoord = 0.1875
(ColVal < Col4Thresh.value): (BoxColour = Col5Picker.color ; ThreshCounts[5] += 1) -- green ; UCoord = 0.0625
(ColVal < Col3Thresh.value): (BoxColour = Col4Picker.color ; ThreshCounts[4] += 1) -- yellow ; UCoord = -0.0625
(ColVal < Col2Thresh.value): (BoxColour = Col3Picker.color ; ThreshCounts[3] += 1) -- orange ; UCoord = -0.1875
(ColVal < Col1Thresh.value): (BoxColour = Col2Picker.color ; ThreshCounts[2] += 1) -- red ; UCoord = -0.3125
(ColVal >= Col1Thresh.value): (BoxColour = Col1Picker.color ; ThreshCounts[1] += 1) -- black ; UCoord = -0.4375
) -- end case wirecolour
) -- end if
else
(
case of
(
(ColVal < Col9Thresh.value): (
BoxColour = color Col9Picker.color.R Col9Picker.color.G Col9Picker.color.B
)
(ColVal < Col8Thresh.value): (
ColRatio = (ColVal - Col8Thresh.value) / (Col9Thresh.value - Col8Thresh.value)
BoxColour = color ((ColRatio * (Col9Picker.color.R - Col8Picker.color.R)) + Col8Picker.color.R) ((ColRatio * (Col9Picker.color.G - Col8Picker.color.G)) + Col8Picker.color.G) ((ColRatio * (Col9Picker.color.B - Col8Picker.color.B)) + Col8Picker.color.B)
ThreshCounts[8] += 1
)
(ColVal < Col7Thresh.value): (
ColRatio = (ColVal - Col7Thresh.value) / (Col8Thresh.value - Col7Thresh.value)
BoxColour = color ((ColRatio * (Col8Picker.color.R - Col7Picker.color.R)) + Col7Picker.color.R) ((ColRatio * (Col8Picker.color.G - Col7Picker.color.G)) + Col7Picker.color.G) ((ColRatio * (Col8Picker.color.B - Col7Picker.color.B)) + Col7Picker.color.B)
ThreshCounts[7] += 1
)
(ColVal < (Col5Thresh.value - LockGap)): (
ColRatio = (ColVal - (Col5Thresh.value - LockGap)) / (Col7Thresh.value - (Col5Thresh.value - LockGap))
BoxColour = color ((ColRatio * (Col7Picker.color.R - Col6Picker.color.R)) + Col6Picker.color.R) ((ColRatio * (Col7Picker.color.G - Col6Picker.color.G)) + Col6Picker.color.G) ((ColRatio * (Col7Picker.color.B - Col6Picker.color.B)) + Col6Picker.color.B)
ThreshCounts[6] += 1
)
(ColVal < Col5Thresh.value): (
ColRatio = (ColVal - Col5Thresh.value) / ((Col5Thresh.value - LockGap) - Col5Thresh.value)
BoxColour = color ((ColRatio * (Col6Picker.color.R - Col5Picker.color.R)) + Col5Picker.color.R) ((ColRatio * (Col6Picker.color.G - Col5Picker.color.G)) + Col5Picker.color.G) ((ColRatio * (Col6Picker.color.B - Col5Picker.color.B)) + Col5Picker.color.B)
ThreshCounts[5] += 1
)
(ColVal < Col4Thresh.value): (
ColRatio = (ColVal - Col4Thresh.value) / (Col5Thresh.value - Col4Thresh.value)
BoxColour = color ((ColRatio * (Col5Picker.color.R - Col4Picker.color.R)) + Col4Picker.color.R) ((ColRatio * (Col5Picker.color.G - Col4Picker.color.G)) + Col4Picker.color.G) ((ColRatio * (Col5Picker.color.B - Col4Picker.color.B)) + Col4Picker.color.B)
ThreshCounts[5] += 1
)
(ColVal < Col3Thresh.value): (
ColRatio = (ColVal - Col3Thresh.value) / (Col4Thresh.value - Col3Thresh.value)
BoxColour = color ((ColRatio * (Col4Picker.color.R - Col3Picker.color.R)) + Col3Picker.color.R) ((ColRatio * (Col4Picker.color.G - Col3Picker.color.G)) + Col3Picker.color.G) ((ColRatio * (Col4Picker.color.B - Col3Picker.color.B)) + Col3Picker.color.B)
ThreshCounts[4] += 1
)
(ColVal < Col2Thresh.value): (
ColRatio = (ColVal - Col2Thresh.value) / (Col3Thresh.value - Col2Thresh.value)
BoxColour = color ((ColRatio * (Col3Picker.color.R - Col2Picker.color.R)) + Col2Picker.color.R) ((ColRatio * (Col3Picker.color.G - Col2Picker.color.G)) + Col2Picker.color.G) ((ColRatio * (Col3Picker.color.B - Col2Picker.color.B)) + Col2Picker.color.B)
ThreshCounts[3] += 1
)
(ColVal < Col1Thresh.value): (
ColRatio = (ColVal - Col1Thresh.value) / (Col2Thresh.value - Col1Thresh.value)
BoxColour = color ((ColRatio * (Col2Picker.color.R - Col1Picker.color.R)) + Col1Picker.color.R) ((ColRatio * (Col2Picker.color.G - Col1Picker.color.G)) + Col1Picker.color.G) ((ColRatio * (Col2Picker.color.B - Col1Picker.color.B)) + Col1Picker.color.B)
ThreshCounts[2] += 1
)
(ColVal >=Col1Thresh.value): (
BoxColour = color Col1Picker.color.R Col1Picker.color.G Col1Picker.color.B
ThreshCounts[1] += 1
)
) -- end case pick colour using smooth gradient
) -- end else
next_box.wirecolor = BoxColour
) -- end if - Valid Box
else
(
format "Skipped % - not a Box primitive \n" junc_name
) -- end else - Invalid Box
)
qsort active_juncs CompareJuncs
if active_juncs.count > 0 then
(
WorstJunction.text = WorstJunc as string
BestJunction.text = BestJunc as string
if WorstCount == 0 then WorstCount = 1 --Happens when switching stat occasionally... needs to be > 0
WorstJunctionCount.range = [1, active_juncs.count, WorstCount]
WorstJunctionCount.enabled = true
WorstThreshold.range.x = BestJunc ; WorstThreshold.range.y = WorstJunc
ActivateWidgets()
TrackedMean = TrackedMean / active_juncs.count
) --end if - set up stat tracking widgets
if AutoSelect.state then
(
case AutoSelectType.state of
(
1:
(
clearselection()
local bad_juncs = #()
for index = 1 to WorstCount do
(
local badbox = active_juncs[index].marker--getnodebyname active_juncs[index].name exact:true
appendIfUnique bad_juncs badbox
)
select bad_juncs
)
2:
(
clearselection()
local badbox = active_juncs[WorstJunctionCount.value].marker--getnodebyname active_juncs[WorstJunctionCount.value].name exact:true
select badbox
if (RAGConnect.text == "CONNECTED") and (RemoteConnection.IsConnected()) then
( -- !!! Not sure this is a good idea... doesn't cause connection problems, so keeping it in...
local warpCoords = (selection[1].pos.x as string)+" "+(selection[1].pos.y as string)+" "+(selection[1].pos.z as string)
RemoteConnection.WriteStringWidget "Debug/Warp Player x y z h vx vy vz" warpCoords
)
)
)
)
Col1Count.text = ThreshCounts[1] as string
Col2Count.text = ThreshCounts[2] as string
Col3Count.text = ThreshCounts[3] as string
Col4Count.text = ThreshCounts[4] as string
Col5Count.text = ThreshCounts[5] as string
Col7Count.text = ThreshCounts[6] as string
Col8Count.text = ThreshCounts[7] as string
Col9Count.text = ThreshCounts[8] as string
)
---- THRESHOLD MANAGEMENT FUNCTIONS ----
fn UpdateThresholds Spinner =
( -- Here Be Horrible Logic... needs to trickle values down from 1 and up from 9 so spinners don't go out of bounds. Behaviour dependant on active spinner, previous state and whether ranges are scaled.
-- Check down from highest threshold...
if (Spinner != 2) then
(
if (Col2Thresh.value > (Col1Thresh.value - ThresholdGap)) then Col2Thresh.value = (Col1Thresh.value - ThresholdGap)
else if ((Col2Thresh.value < PrevThresh[2]) and (ScaleRanges.state == false)) then Col2Thresh.value = RsJunctionViewer.FMin (Col1Thresh.value - ThresholdGap) PrevThresh[2]
)
if (Spinner != 3) then
(
if (Col3Thresh.value > (Col2Thresh.value - ThresholdGap)) then Col3Thresh.value = (Col2Thresh.value - ThresholdGap)
else if ((Col3Thresh.value < PrevThresh[3]) and (ScaleRanges.state == false)) then Col3Thresh.value = RsJunctionViewer.FMin (Col2Thresh.value - ThresholdGap) PrevThresh[3]
)
if (Spinner != 4) then
(
if (Col4Thresh.value > (Col3Thresh.value - ThresholdGap)) then Col4Thresh.value = (Col3Thresh.value - ThresholdGap)
else if ((Col4Thresh.value < PrevThresh[4]) and (ScaleRanges.state == false)) then Col4Thresh.value = RsJunctionViewer.FMin (Col3Thresh.value - ThresholdGap) PrevThresh[4]
)
if (Spinner != 5) then
(
if (Col5Thresh.value > (Col4Thresh.value - ThresholdGap)) then (Col5Thresh.value = (Col4Thresh.value - ThresholdGap) )
else if ((Col5Thresh.value < PrevThresh[5]) and (ScaleRanges.state == false)) then Col5Thresh.value = RsJunctionViewer.FMin (Col4Thresh.value - ThresholdGap) PrevThresh[5]
)
if (Spinner != 7) then
(
if (Col7Thresh.value > (Col5Thresh.value - ThresholdGap)) then Col7Thresh.value = (Col5Thresh.value - ThresholdGap)
else if ((Col7Thresh.value < PrevThresh[7]) and (ScaleRanges.state == false)) then Col7Thresh.value = RsJunctionViewer.FMin (Col5Thresh.value - ThresholdGap) PrevThresh[7]
)
if (Spinner != 8) then
(
if (Col8Thresh.value > (Col7Thresh.value - ThresholdGap)) then Col8Thresh.value = (Col7Thresh.value - ThresholdGap)
else if ((Col8Thresh.value < PrevThresh[8]) and (ScaleRanges.state == false)) then Col8Thresh.value = RsJunctionViewer.FMin (Col7Thresh.value - ThresholdGap) PrevThresh[8]
)
if (Spinner != 9) then
(
if (Col9Thresh.value > (Col8Thresh.value - ThresholdGap)) then Col9Thresh.value = (Col8Thresh.value - ThresholdGap)
else if ((Col9Thresh.value < PrevThresh[9]) and (ScaleRanges.state == false)) then Col9Thresh.value = RsJunctionViewer.FMin (Col8Thresh.value - ThresholdGap) PrevThresh[9]
)
-- And up from lowest threshold
if (Spinner != 8) then
(
if Col8Thresh.value < (Col9Thresh.value + ThresholdGap) then Col8Thresh.value = (Col9Thresh.value + ThresholdGap)
else if ((Col8Thresh.value > PrevThresh[8]) and (ScaleRanges.state == false)) then Col8Thresh.value = RsJunctionViewer.FMax (Col9Thresh.value + ThresholdGap) PrevThresh[8]
)
if (Spinner != 7) then
(
if Col7Thresh.value < (Col8Thresh.value + ThresholdGap) then Col7Thresh.value = (Col8Thresh.value + ThresholdGap)
else if ((Col8Thresh.value > PrevThresh[7]) and (ScaleRanges.state == false)) then Col7Thresh.value = RsJunctionViewer.FMax (Col8Thresh.value + ThresholdGap) PrevThresh[7]
)
if (Spinner != 5) then
(
if Col5Thresh.value < (Col7Thresh.value + ThresholdGap) then (Col5Thresh.value = (Col7Thresh.value + ThresholdGap) )
else if ((Col5Thresh.value > PrevThresh[5]) and (ScaleRanges.state == false)) then Col5Thresh.value = RsJunctionViewer.FMax (Col7Thresh.value + ThresholdGap) PrevThresh[5]
)
if (Spinner != 4) then
(
if Col4Thresh.value < (Col5Thresh.value + ThresholdGap) then Col4Thresh.value = (Col5Thresh.value + ThresholdGap)
else if ((Col4Thresh.value > PrevThresh[4]) and (ScaleRanges.state == false)) then Col4Thresh.value = RsJunctionViewer.FMax (Col5Thresh.value + ThresholdGap) PrevThresh[4]
)
if (Spinner != 3) then
(
if Col3Thresh.value < (Col4Thresh.value + ThresholdGap) then Col3Thresh.value = (Col4Thresh.value + ThresholdGap)
else if ((Col3Thresh.value > PrevThresh[3]) and (ScaleRanges.state == false)) then Col3Thresh.value = RsJunctionViewer.FMax (Col4Thresh.value + ThresholdGap) PrevThresh[3]
)
if (Spinner != 2) then
(
if Col2Thresh.value < (Col3Thresh.value + ThresholdGap) then Col2Thresh.value = (Col3Thresh.value + ThresholdGap)
else if ((Col2Thresh.value > PrevThresh[2]) and (ScaleRanges.state == false)) then Col2Thresh.value = RsJunctionViewer.FMax (Col3Thresh.value + ThresholdGap) PrevThresh[2]
)
if (Spinner != 1) then
(
if Col1Thresh.value < (Col2Thresh.value + ThresholdGap) and (Spinner !=1) then Col1Thresh.value = (Col2Thresh.value + ThresholdGap)
else if ((Col1Thresh.value > PrevThresh[1]) and (ScaleRanges.state == false)) then Col1Thresh.value = RsJunctionViewer.FMax (Col2Thresh.value + ThresholdGap) PrevThresh[1]
)
)
fn ManageThresholds Spinner =
( -- Deals with scaling ranges when Spinner is changing, and calls UpdateThresholds to stop out of bounds spinners
local HighRatio = 0
local LowRatio = 0
local LowSpinner = 9
local HighSpinner = 1
StoreThresholds.enabled = ResetThresholdValues.enabled = true
if ScaleRanges.state then
(
-- Determine affected high/low range from the active spinner, and check if it's gone out of bounds
if LockZero.state then
(
case of
(
(Spinner < 5): ( LowSpinner = 9 ; HighSpinner = Spinner )
(Spinner > 5): ( LowSpinner = Spinner ; HighSpinner = 1 )
(Spinner == 5): ( LowSpinner = 9 ; HighSpinner = 1 )
)
HighRatio = (CurrThresh[HighSpinner] - CurrThresh[5]) / (PrevThresh[HighSpinner] - PrevThresh[5])
LowRatio = (CurrThresh[5] - CurrThresh[LowSpinner]) / (PrevThresh[5] - PrevThresh[LowSpinner])
Col9Thresh.value = ((PrevThresh[9] - PrevThresh[LowSpinner]) * LowRatio) + CurrThresh[LowSpinner]
Col8Thresh.value = ((PrevThresh[8] - PrevThresh[LowSpinner]) * LowRatio) + CurrThresh[LowSpinner]
Col7Thresh.value = ((PrevThresh[7] - PrevThresh[LowSpinner]) * LowRatio) + CurrThresh[LowSpinner]
Col5Thresh.value = CurrThresh[5]
Col4Thresh.value = ((PrevThresh[4] - PrevThresh[HighSpinner]) * HighRatio) + CurrThresh[HighSpinner]
Col3Thresh.value = ((PrevThresh[3] - PrevThresh[HighSpinner]) * HighRatio) + CurrThresh[HighSpinner]
Col2Thresh.value = ((PrevThresh[2] - PrevThresh[HighSpinner]) * HighRatio) + CurrThresh[HighSpinner]
Col1Thresh.value = ((PrevThresh[1] - PrevThresh[HighSpinner]) * HighRatio) + CurrThresh[HighSpinner]
)
else
(
case of
(
(Spinner < 5): ( LowSpinner = HighSpinner = 9 )
(Spinner > 5): ( LowSpinner = HighSpinner = 1 )
(Spinner == 5): ( LowSpinner = 9 ; HighSpinner = 1 )
)
HighRatio = (CurrThresh[HighSpinner] - CurrThresh[Spinner]) / (PrevThresh[HighSpinner] - PrevThresh[Spinner])
LowRatio = (CurrThresh[Spinner] - CurrThresh[LowSpinner]) / (PrevThresh[Spinner] - PrevThresh[LowSpinner])
Col9Thresh.value = ((PrevThresh[9] - PrevThresh[LowSpinner]) * LowRatio) + CurrThresh[LowSpinner]
Col8Thresh.value = ((PrevThresh[8] - PrevThresh[LowSpinner]) * LowRatio) + CurrThresh[LowSpinner]
Col7Thresh.value = ((PrevThresh[7] - PrevThresh[LowSpinner]) * LowRatio) + CurrThresh[LowSpinner]
Col5Thresh.value = ((PrevThresh[5] - PrevThresh[LowSpinner]) * LowRatio) + CurrThresh[LowSpinner]
Col4Thresh.value = ((PrevThresh[4] - PrevThresh[HighSpinner]) * HighRatio) + CurrThresh[HighSpinner]
Col3Thresh.value = ((PrevThresh[3] - PrevThresh[HighSpinner]) * HighRatio) + CurrThresh[HighSpinner]
Col2Thresh.value = ((PrevThresh[2] - PrevThresh[HighSpinner]) * HighRatio) + CurrThresh[HighSpinner]
Col1Thresh.value = ((PrevThresh[1] - PrevThresh[HighSpinner]) * HighRatio) + CurrThresh[HighSpinner]
)
)
UpdateThresholds Spinner
ProcessActiveCSV()
)
fn UpdateThreshArrays =
( -- Called on spinner entered. Updates the previous and current threshold tables (used to deal with scaling ranges)
CurrThresh[9] = Col9Thresh.value
CurrThresh[8] = Col8Thresh.value
CurrThresh[7] = Col7Thresh.value
CurrThresh[6] = Col5Thresh.value - LockGap
CurrThresh[5] = Col5Thresh.value
CurrThresh[4] = Col4Thresh.value
CurrThresh[3] = Col3Thresh.value
CurrThresh[2] = Col2Thresh.value
CurrThresh[1] = Col1Thresh.value
PrevThresh = deepcopy CurrThresh
)
fn RecalculateRange =
( -- Called when tracked stat changes and ScaleRanges is ticked. Used to update the thresholds.
if LockZero.state then (Col5Thresh.value = CurrThresh[5] = 0.0 ) else (Col5Thresh.value = CurrThresh[5] = TrackedMean)
Col9Thresh.value = CurrThresh[9] = BestJunc
Col1Thresh.value = CurrThresh[1] = WorstJunc
ManageThresholds 5
)
---- TRACKING FUNCTIONS ----
fn SelectWorstJuncs =
(
clearselection()
local bad_juncs = #()
if AutoSelectType.state == 1 then
(
for index = 1 to WorstCount do
(
local badbox = active_juncs[index].marker
appendIfUnique bad_juncs badbox
)
)
else
(
local bad_juncs = active_juncs[WorstJunctionCount.value].marker
)
select bad_juncs
)
---- THRESHOLD RESET FUNCTIONS ----
fn ResetValues =
( -- Reset to Default values
Col1Thresh.value = PrevThresh[1] = Threshes[ResetOption.selection].val1
Col2Thresh.value = PrevThresh[2] = Threshes[ResetOption.selection].val2
Col3Thresh.value = PrevThresh[3] = Threshes[ResetOption.selection].val3
Col4Thresh.value = PrevThresh[4] = Threshes[ResetOption.selection].val4
Col5Thresh.value = PrevThresh[5] = Threshes[ResetOption.selection].val5
Col7Thresh.value = PrevThresh[7] = Threshes[ResetOption.selection].val7
Col8Thresh.value = PrevThresh[8] = Threshes[ResetOption.selection].val8
Col9Thresh.value = PrevThresh[9] = Threshes[ResetOption.selection].val9
CurrThresh = deepCopy PrevThresh
ResetThresholdValues.enabled = false
StoreThresholds.enabled = ResetThresholdColours.enabled
ProcessActiveCSV()
)
fn ResetColours =
( -- Reset to Default Colour scheme
Col1Picker.color = Threshes[ResetOption.selection].col1
Col2Picker.color = Threshes[ResetOption.selection].col2
Col3Picker.color = Threshes[ResetOption.selection].col3
Col4Picker.color = Threshes[ResetOption.selection].col4
Col5Picker.color = Threshes[ResetOption.selection].col5
Col6Picker.color = Threshes[ResetOption.selection].col6
Col7Picker.color = Threshes[ResetOption.selection].col7
Col8Picker.color = Threshes[ResetOption.selection].col8
Col9Picker.color = Threshes[ResetOption.selection].col9
ResetThresholdColours.enabled = false
StoreThresholds.enabled = ResetThresholdValues.enabled
ProcessActiveCSV()
)
---- VISUALISER EVENTS ----
---- FILE EVENTS ----
on ChangeCurrentCSV pressed do
(
RsJunctionViewer.currCSVName = getOpenFileName caption:"Select CSV to Visualise" filename:RsJunctionViewer.currCSVName types:"CSV (*.csv)|*.csv|All Files (*.*)|*.*|"
if RsJunctionViewer.currCSVName == undefined then
(
RsJunctionViewer.currCSVName = RsJunctionViewer.DefaultCurrCSVName
CurrFileName.text = filenameFromPath RsJunctionViewer.DefaultCurrCSVName
)
else
(
CurrFileName.text = filenameFromPath RsJunctionViewer.currCSVName
)
CurrFileName.enabled = true
LoadCurrCSV()
ProcessActiveCSV()
if ScaleRanges.state then RecalculateRange()
)
on ChangePreviousCSV pressed do
(
RsJunctionViewer.prevCSVName = getOpenFileName caption:"Select Previous version CSV to Compare" filename:RsJunctionViewer.prevCSVName types:"CSV (*.csv)|*.csv|All Files (*.*)|*.*|"
if RsJunctionViewer.prevCSVName == undefined then
(
RsJunctionViewer.prevCSVName = RsJunctionViewer.DefaultCurrCSVName
PrevFileName.text = filenameFromPath RsJunctionViewer.DefaultPrevCSVName
)
else
(
PrevFileName.text = filenameFromPath RsJunctionViewer.prevCSVName
)
LoadPrevCSV()
ProcessActiveCSV()
if ScaleRanges.state then RecalculateRange()
)
on LoadCurrentCSV pressed do
(
LoadCurrCSV()
ProcessActiveCSV()
if ScaleRanges.state then RecalculateRange()
)
on LoadPreviousCSV pressed do
(
LoadPrevCSV()
ProcessActiveCSV()
if ScaleRanges.state then RecalculateRange()
)
on UseCurrent pressed do
(
if TrackedVersion.state != 2 then
(
CurrSurround.enabled = true ; PrevSurround.enabled = false ; DiffSurround.enabled = false
VersionCurrent.enabled = false ; CompareCount.enabled = false ; VersionCurrent.enabled = true ; VersionPrevious.enabled = false
TrackedVersion.state = 2
ProcessActiveCSV()
if ScaleRanges.state then RecalculateRange()
)
)
on UsePrevious pressed do
(
if TrackedVersion.state != 1 then
(
CurrSurround.enabled = false ; PrevSurround.enabled = true ; DiffSurround.enabled = false
VersionCurrent.enabled = false ; CompareCount.enabled = false ; VersionPrevious.enabled = false ; VersionPrevious.enabled = true
TrackedVersion.state = 1
ProcessActiveCSV()
if ScaleRanges.state then RecalculateRange()
)
)
on UseDiff pressed do
(
if TrackedVersion.state != 3 then
(
CurrSurround.enabled = true ; PrevSurround.enabled = true ; DiffSurround.enabled = true
VersionCurrent.enabled = false ; VersionPrevious.enabled = false ; CompareCount.enabled = false
VersionCurrent.enabled = true ; VersionPrevious.enabled = true ; CompareCount.enabled = true
TrackedVersion.state = 3
ProcessActiveCSV()
if ScaleRanges.state then RecalculateRange()
)
)
---- STAT TRACKING EVENTS ----
on WorstThreshold changed ArgIgnore do ProcessActiveCSV()
on DropAmount changed ArgIgnore do ProcessActiveCSV()
on HideBest changed ArgIgnore do ProcessActiveCSV()
on DropJunctions changed DropType do
( -- Drop Worst Junctions + disable Hide if Off
if (DropType < 3) then
(
HideBest.enabled = true
)
else
(
HideBest.enabled = false
)
ProcessActiveCSV()
)
on WorstJunctionCount changed NewWorstCount do
( -- Gets the Tracked Stat value of the new N Worst Junctions and performs a Process
WorstThreshold.range.z = active_juncs[NewWorstCount].tracked_stat - 0.01
ProcessActiveCSV()
)
on SelectWorst pressed do ( SelectWorstJuncs() )
on AutoSelectType changed ArgIgnore do ( if AutoSelect.checked then SelectWorstJuncs() )
on RAGConnect pressed do
( -- Connect to RAG if it's present
if (RAGConnect.text == "CONNECT") then
(
RemoteConnection.Connect()
if ( RemoteConnection.IsConnected() ) then
(
ZeroZ.state = false
RAGConnect.text = "CONNECTED"
RAGSurround.enabled = true
WarpTo.enabled = true
--Analyse.enabled = true
)
else
(
messageBox "Couldn't connect to game.\nMake sure it's running with RAG..." beep:true
)
)
)
on RAGSurround clicked ArgIgnore do
( -- Draws over RAGConnect - so works as a Disconnect button
RAGSurround.enabled = false
RAGConnect.text = "CONNECT"
WarpTo.enabled = false
Analyse.enabled = false
)
on WarpTo pressed do
( -- Quick version without callback. Only warps to selection[1].pos - Also Auto-Disconnects if RAG is missing.
if (RAGConnect.text == "CONNECTED") and (RemoteConnection.IsConnected()) then
(
if selection.count > 0 then
(
local warpCoords = (selection[1].pos.x as string)+" "+(selection[1].pos.y as string)+" "+(selection[1].pos.z as string)
RemoteConnection.WriteStringWidget "Debug/Warp Player x y z h vx vy vz" warpCoords
)
)
else
(
if (RAGConnect.text == "CONNECTED") then
(
RAGConnect.text = "CONNECT"
RAGSurround.enabled = false
WarpTo.enabled = false
--Analyse.enabled = false
)
)
)
/*
on Analyse pressed do
(
RemoteConnection.Connect()
RemoteConnection.WriteBoolWidget "Scene/Create Scene widgets" true
RemoteConnection.WriteBoolWidget "Renderer/Create Renderer widgets" true
RemoteConnection.WriteBoolWidget "Streaming & Memory/Create streaming memory widgets" true
-- !!!! ANALYSER MOVED TO SEPARATE SCRIPT
)
*/
---- MARKER SCALE/POSITION EVENTS ----
on TrackedStat changed ArgIgnore do
(
if TrackLink.state then
(
case TrackedStat.state of
(
1:(HeightOptions.state = 1 ; WidthOptions.state = 1)
2:(HeightOptions.state = 2 ; WidthOptions.state = 2)
3:(HeightOptions.state = 3 ; WidthOptions.state = 3)
4:(HeightOptions.state = 4 ; WidthOptions.state = 4)
5:(HeightOptions.state = 5 ; WidthOptions.state = 5)
)
)
ProcessActiveCSV()
if ScaleRanges.state then RecalculateRange()
)
on HeightOptions changed ArgIgnore do
(
if TrackLink.state then TrackedStat.state = 7
ProcessActiveCSV()
if ScaleRanges.state then RecalculateRange()
)
on WidthOptions changed ArgIgnore do
(
if TrackLink.state then TrackedStat.state = 6
ProcessActiveCSV()
if ScaleRanges.state then RecalculateRange()
)
on TrackLink changed TrackLinked do
(
if TrackLinked then
(
case TrackedStat.state of
(
1:(HeightOptions.state = 1 ; WidthOptions.state = 1)
2:(HeightOptions.state = 2 ; WidthOptions.state = 2)
3:(HeightOptions.state = 3 ; WidthOptions.state = 3)
4:(HeightOptions.state = 4 ; WidthOptions.state = 4)
5:(HeightOptions.state = 5 ; WidthOptions.state = 5)
)
)
ProcessActiveCSV()
if ScaleRanges.state then ReCalculateRange()
)
on HeightMult changed NewScale do ( if ScaleLink.text == "&" then WidthMult.value = NewScale ; ProcessActiveCSV() )
on WidthMult changed NewScale do ( if ScaleLink.text == "&" then HeightMult.value = NewScale ; ProcessActiveCSV() )
on HeightOffset changed NewOffset do ( if OffsetLink.text == "&" then WidthOffset.value = NewOffset ; ProcessActiveCSV() )
on WidthOffset changed NewOffset do ( if OffsetLink.text == "&" then HeightOffset.value = NewOffset ; ProcessActiveCSV() )
on ScaleLink pressed do
(
if ScaleLink.text == " " then
(
ScaleLink.text = "&"
WidthMult.value = HeightMult.value
ProcessActiveCSV()
)
else
(
ScaleLink.text = " "
)
)
on OffsetLink pressed do
(
if OffsetLink.text == " " then
(
OffsetLink.text = "&"
WidthOffset.value = HeightOffset.value
ProcessActiveCSV()
)
else
(
OffsetLink.text = " "
)
)
on PositiveWidths changed ArgIgnore do ProcessActiveCSV()
on ZeroZ changed ArgIgnore do ProcessActiveCSV()
on MarkerPresets selected Arg do
(
ActivePreset = Arg
WidthOptions.state = RsJunctionViewer.PresetValues[Arg].MWStat
HeightOptions.state = RsJunctionViewer.PresetValues[Arg].MHStat
TrackedStat.state = RsJunctionViewer.PresetValues[Arg].TrackedStat
WidthMult.value = RsJunctionViewer.PresetValues[Arg].WMult
HeightMult.value = RsJunctionViewer.PresetValues[Arg].HMult
WidthOffset.value = RsJunctionViewer.PresetValues[Arg].WOffset
HeightOffset.value = RsJunctionViewer.PresetValues[Arg].HOffset
ScaleLink.text = " " ; OffsetLink.text = " "
if (RAGConnect.text == "CONNECT") then ZeroZ.state = RsJunctionViewer.PresetValues[Arg].ZeroZ
ProcessActiveCSV()
if ScaleRanges.state then RecalculateRange()
)
on SaveNewPreset pressed do
(
RsJunctionViewerPos = GetDialogPos RsJunctionViewer
RFPresetPos = RsJunctionViewerPos
RFPresetPos.x = (RsJunctionViewer.FMax (RsJunctionViewerPos.x - 32) 20) ; RFPresetPos.y = (RsJunctionViewer.FMin (RsJunctionViewerPos.y + RsJunctionViewer.Vis.pos.y + 580) 900)
try ( DestroyDialog RsJunctionRenamePreset ) catch()
CreateDialog RsJunctionRenamePreset width:(ROwidth+32) height:92 style:#(#style_titlebar, #style_border, #style_sysmenu,#style_toolwindow)
setDialogPos RsJunctionRenamePreset RFPresetPos
local NameExists=true
local presetNum = RsJunctionViewer.PresetNames.count + 1
while NameExists do
(
nameTest = "New Preset "+(presetNum as string)
if (findItem RsJunctionViewer.PresetNames nameTest) == 0 then (NameExists = false) else (presetNum += 1)
)
RsJunctionRenamePreset.PresetName.text = nameTest
newPreset = RsJunctionViewer.Preset name:nameTest
newPreset.HMult =HeightMult.value ; newPreset.WMult = WidthMult.value
newPreset.HOffset = HeightOffset.value ; newPreset.WOffset= WidthOffset.value
newPreset.TrackedStat= TrackedStat.state ; newPreset.MWStat= WidthOptions.state ; newPreset.MHStat= HeightOptions.state
newPreset.ZeroZ= ZeroZ.state
append RsJunctionViewer.PresetValues newPreset
append RsJunctionViewer.PresetNames newPreset.name
MarkerPresets.items = RsJunctionViewer.PresetNames
RsJunctionViewer.ActivePreset = RsJunctionViewer.PresetNames.count
MarkerPresets.selection = RsJunctionViewer.ActivePreset
)
---- MARKER COLOUR/THRESHOLD EVENTS ----
-- THRESHOLD VALUE EVENTS --
on Col9Thresh changed newValue do ( CurrThresh[9] = newValue ; ManageThresholds 9 )
on Col8Thresh changed newValue do ( CurrThresh[8] = newValue ; ManageThresholds 8 )
on Col7Thresh changed newValue do ( CurrThresh[7] = newValue ; ManageThresholds 7)
on Col5Thresh changed newValue do ( CurrThresh[5] = newValue ; CurrThresh[6] = newValue - LockGap ; ManageThresholds 5 )
on Col4Thresh changed newValue do ( CurrThresh[4] = newValue ; ManageThresholds 4 )
on Col3Thresh changed newValue do ( CurrThresh[3] = newValue ; ManageThresholds 3 )
on Col2Thresh changed newValue do ( CurrThresh[2] = newValue ; ManageThresholds 2 )
on Col1Thresh changed newValue do ( CurrThresh[1] = newValue ; ManageThresholds 1 )
on Col9Thresh entered do ( UpdateThreshArrays() )
on Col8Thresh entered do ( UpdateThreshArrays() )
on Col7Thresh entered do ( UpdateThreshArrays() )
on Col5Thresh entered do ( UpdateThreshArrays() )
on Col4Thresh entered do ( UpdateThreshArrays() )
on Col3Thresh entered do ( UpdateThreshArrays() )
on Col2Thresh entered do ( UpdateThreshArrays() )
on Col1Thresh entered do ( UpdateThreshArrays() )
-- COLOUR PICKER EVENTS --
on Col1Picker changed NewColour do ( StoreThresholds.enabled = ResetThresholdColours.enabled = true ; ProcessActiveCSV() )
on Col2Picker changed NewColour do ( StoreThresholds.enabled = ResetThresholdColours.enabled = true ; ProcessActiveCSV() )
on Col3Picker changed NewColour do ( StoreThresholds.enabled = ResetThresholdColours.enabled = true ; ProcessActiveCSV() )
on Col4Picker changed NewColour do ( StoreThresholds.enabled = ResetThresholdColours.enabled = true ; ProcessActiveCSV() )
on Col5Picker changed NewColour do ( StoreThresholds.enabled = ResetThresholdColours.enabled = true ; ProcessActiveCSV() )
on Col6Picker changed NewColour do ( StoreThresholds.enabled = ResetThresholdColours.enabled = true ; ProcessActiveCSV() )
on Col7Picker changed NewColour do ( StoreThresholds.enabled = ResetThresholdColours.enabled = true ; ProcessActiveCSV() )
on Col8Picker changed NewColour do ( StoreThresholds.enabled = ResetThresholdColours.enabled = true ; ProcessActiveCSV() )
on Col9Picker changed NewColour do ( StoreThresholds.enabled = ResetThresholdColours.enabled = true ; ProcessActiveCSV() )
on SmthGrad changed ArgIgnore do ProcessActiveCSV()
-- THRESHOLD OVER EVENTS --
on Col9Over pressed do ( WorstThreshold.value = Col9Thresh.value ; ProcessActiveCSV() )
on Col8Over pressed do ( WorstThreshold.value = Col8Thresh.value ; ProcessActiveCSV() )
on Col7Over pressed do ( WorstThreshold.value = Col7Thresh.value ; ProcessActiveCSV() )
on Col5Over pressed do ( WorstThreshold.value = Col5Thresh.value ; ResetThresholdValues.enabled = true ; ProcessActiveCSV() )
on Col4Over pressed do ( WorstThreshold.value = Col4Thresh.value ; ProcessActiveCSV() )
on Col3Over pressed do ( WorstThreshold.value = Col3Thresh.value ; ProcessActiveCSV() )
on Col2Over pressed do ( WorstThreshold.value = Col2Thresh.value ; ProcessActiveCSV() )
on Col1Over pressed do ( WorstThreshold.value = Col1Thresh.value ; ProcessActiveCSV() )
-- THRESHOLD RESET EVENTS --
on ResetThresholdValues pressed do ResetValues()
on ResetThresholdColours pressed do ResetColours()
on ResetOption selected NewOption do
(
if NewOption != ActiveThresh then
(
ActiveThresh = NewOption
ResetValues() ; ResetColours()
ResetThresholdValues.enabled = ResetThresholdColours.enabled = false
)
)
on StoreThresholds pressed do
(
local newThresh = RsJunctionViewer.Thresholds col1:col1Picker.color
newThresh.col2 = col2Picker.color
newThresh.col3 = col3Picker.color
newThresh.col4 = col4Picker.color
newThresh.col5 = col5Picker.color
newThresh.col6 = col6Picker.color
newThresh.col7 = col7Picker.color
newThresh.col8 = col8Picker.color
newThresh.col9 = col9Picker.color
newThresh.val1 = col1Thresh.value
newThresh.val2 = col2Thresh.value
newThresh.val3 = col3Thresh.value
newThresh.val4 = col4Thresh.value
newThresh.val5 = col5Thresh.value
newThresh.val6 = col5Thresh.value - LockGap
newThresh.val7 = col7Thresh.value
newThresh.val8 = col8Thresh.value
newThresh.val9 = col9Thresh.value
append Threshes newThresh
local threshNames = ResetOption.items
local newThreshName = "Settings "+((threshNames.count + 1) as string)+" "
case TrackedStat.state of
(
1:( newThreshName += "(Main)")
2:( newThreshName += "(VRAM)")
3:( newThreshName += "(Main+VRAM)")
4:( newThreshName += "(Archetypes)")
5:( newThreshName += "(None)")
6:
(
case WidthOptions of
(
1:( newThreshName += "(Main)")
2:( newThreshName += "(VRAM)")
3:( newThreshName += "(Main+VRAM)")
4:( newThreshName += "(Archetypes)")
5:( newThreshName += "(None)")
)
)
7:
(
case HeightOptions of
(
1:( newThreshName += "(Main)")
2:( newThreshName += "(VRAM)")
3:( newThreshName += "(Main+VRAM)")
4:( newThreshName += "(Archetypes)")
5:( newThreshName += "(None)")
)
)
)
append threshNames newThreshName
ResetOption.items = threshNames
ResetOption.selection = ActiveThresh = ResetOption.items.count
)
-- THRESHOLD CONTROL BUTTONS EVENTS --
on LockZero changed LockedState do
( -- Lock/Unlock MidPoint value, sets thresholds to stop/permit ranges to pass it (if permitted, OOB prevented by ManageThresholds elsewhere)
Col5Thresh.enabled = not LockedState
if LockedState then
(
Col1Thresh.range.x = Col5Thresh.value + (ThresholdGap*4)
Col2Thresh.range.x = Col5Thresh.value + (ThresholdGap*3)
Col3Thresh.range.x = Col5Thresh.value + (ThresholdGap*2)
Col4Thresh.range.x = Col5Thresh.value + ThresholdGap
Col7Thresh.range.y = Col5Thresh.value - ThresholdGap
Col8Thresh.range.y = Col5Thresh.value - (ThresholdGap*2)
Col9Thresh.range.y = Col5Thresh.value - (ThresholdGap*3)
)
else
(
Col1Thresh.range.x = (ThresholdGap*7) - ThresholdLimit
Col2Thresh.range.x = (ThresholdGap*6) - ThresholdLimit
Col3Thresh.range.x = (ThresholdGap*5) - ThresholdLimit
Col4Thresh.range.x = (ThresholdGap*4) - ThresholdLimit
Col7Thresh.range.y = ThresholdLimit - (ThresholdGap*3)
Col8Thresh.range.y = ThresholdLimit - (ThresholdGap*2)
Col9Thresh.range.y = ThresholdLimit - ThresholdGap
)
)
on EqualizeCount pressed do
( -- Set thresholds so that there are approximately the same number of junctions in each bucket (if middle locked, then the 2 ranges are treaded separately)
if LockZero.state then
(
local HighBucketCount = (Col1Count.text as integer) + (Col2Count.text as integer) + (Col3Count.text as integer) + (Col4Count.text as integer) + (Col5Count.text as integer)
local HighBucketSize = HighBucketCount / 5.0
local LowBucketSize = (active_juncs.count - HighBucketCount) / 4.0
Col1Thresh.value = PrevThresh[1] = CurrThresh[1] = active_juncs[(HighBucketSize as integer)].tracked_stat
Col2Thresh.value = PrevThresh[2] = CurrThresh[2] = active_juncs[((HighBucketSize*2) as integer)].tracked_stat
Col3Thresh.value = PrevThresh[3] = CurrThresh[3] = active_juncs[((HighBucketSize*3) as integer)].tracked_stat
Col4Thresh.value = PrevThresh[4] = CurrThresh[4] = active_juncs[((HighBucketSize*4) as integer)].tracked_stat
-- Mid point shiould be set up already
Col7Thresh.value = PrevThresh[7] = CurrThresh[7] = active_juncs[HighBucketCount+(LowBucketSize as integer)].tracked_stat
Col8Thresh.value = PrevThresh[8] = CurrThresh[8] = active_juncs[HighBucketCount+((LowBucketSize*2) as integer)].tracked_stat
Col9Thresh.value = PrevThresh[9] = CurrThresh[9] = active_juncs[HighBucketCount+((LowBucketSize*3) as integer)].tracked_stat
)
else
(
local bucketSize = active_juncs.count / 9
Col1Thresh.value = PrevThresh[1] = CurrThresh[1] = active_juncs[(bucketSize as integer)].tracked_stat
Col2Thresh.value = PrevThresh[2] = CurrThresh[2] = active_juncs[((bucketSize * 2.0) as integer)].tracked_stat
Col3Thresh.value = PrevThresh[3] = CurrThresh[3] = active_juncs[((bucketSize * 3.0) as integer)].tracked_stat
Col4Thresh.value = PrevThresh[4] = CurrThresh[4] = active_juncs[((bucketSize * 4.0) as integer)].tracked_stat
Col5Thresh.value = PrevThresh[5] = CurrThresh[5] = active_juncs[((bucketSize * 5.0) as integer)].tracked_stat
PrevThresh[6] = CurrThresh[6] = Col5Thresh.value - LockGap
Col7Thresh.value = PrevThresh[7] = CurrThresh[7] = active_juncs[((bucketSize * 6.0) as integer)].tracked_stat
Col8Thresh.value = PrevThresh[8] = CurrThresh[8] = active_juncs[((bucketSize * 7.0) as integer)].tracked_stat
Col9Thresh.value = PrevThresh[9] = CurrThresh[9] = active_juncs[((bucketSize * 8.0) as integer)].tracked_stat
)
StoreThresholds.enabled = ResetThresholdValues.enabled = true
ProcessActiveCSV()
)
on EqualizeSize pressed do
( -- Set thresholds so the gaps between them are equal (if middle locked, then the 2 ranges are treaded separately)
local NewBest = 0
local NewWorst = 0
if ScaleRanges.state then
(
NewBest = BestJunc
NewWorst = WorstJunc
)
else
(
NewBest = Col9Thresh.value
NewWorst = Col1Thresh.value
)
if LockZero.state then
( -- Preserve middle value
local HighBucketSize = (NewWorst - Col5Thresh.value) / 4
local LowBucketSize = (Col5Thresh.value - NewBest) / 3
Col1Thresh.value = PrevThresh[1] = CurrThresh[1] = Col5Thresh.value + (HighBucketSize*4)
Col2Thresh.value = PrevThresh[2] = CurrThresh[2] = Col5Thresh.value + (HighBucketSize*3)
Col3Thresh.value = PrevThresh[3] = CurrThresh[3] = Col5Thresh.value + (HighBucketSize*2)
Col4Thresh.value = PrevThresh[4] = CurrThresh[4] = Col5Thresh.value + HighBucketSize
-- Midpoint should be set up already...
Col7Thresh.value = PrevThresh[7] = CurrThresh[7] = Col5Thresh.value - LowBucketSize
Col8Thresh.value = PrevThresh[8] = CurrThresh[8] = Col5Thresh.value - (LowBucketSize*2)
Col9Thresh.value = PrevThresh[9] = CurrThresh[9] = Col5Thresh.value - (LowBucketSize*3)
)
else
( -- Change middle value
local bucketSize = (NewWorst - NewBest) / 7
Col1Thresh.value = PrevThresh[1] = CurrThresh[1] = NewWorst
Col2Thresh.value = PrevThresh[2] = CurrThresh[2] = NewWorst - bucketSize
Col3Thresh.value = PrevThresh[3] = CurrThresh[3] = NewWorst - (bucketSize*2)
Col4Thresh.value = PrevThresh[4] = CurrThresh[4] = NewWorst - (bucketSize*3)
Col5Thresh.value = PrevThresh[5] = CurrThresh[5] = NewWorst - (bucketSize*4)
PrevThresh[6] = CurrThresh[6] = Col5Thresh.value - LockGap
Col7Thresh.value = PrevThresh[7] = CurrThresh[7] = NewWorst - (bucketSize*5)
Col8Thresh.value = PrevThresh[8] = CurrThresh[8] = NewWorst - (bucketSize*6)
Col9Thresh.value = PrevThresh[9] = CurrThresh[9] = NewWorst - (bucketSize*7)
)
StoreThresholds.enabled = ResetThresholdValues.enabled = true
ProcessActiveCSV()
)
on UseWorst pressed do ( Col1Thresh.value = CurrThresh[1] = WorstJunc ; ManageThresholds 1 ; UpdateThreshArrays() )
on UseBest pressed do ( Col9Thresh.value = CurrThresh[9] = BestJunc ; ManageThresholds 9 ; UpdateThreshArrays() )
on ZeroZero pressed do ( Col5Thresh.value = CurrThresh[5] = 0.0 ; ManageThresholds 5 ; UpdateThreshArrays() )
on ZeroMean pressed do ( Col5Thresh.value = CurrThresh[5] = TrackedMean ; ManageThresholds 5 ; UpdateThreshArrays() )
---- ROLLOUT EVENTS ----
on Visualiser rolledUp Rolled do
(
if Rolled then
(
RsJunctionViewer.Vis.height = RsJunctionViewer.height - (RsJunctionViewer.Vis.pos.y + RsJunctionViewer.Gen.height + 14)
)
else
(
RsJunctionViewer.Vis.height = 26
)
RsJunctionViewer.Gen.pos.y = RsJunctionViewer.Vis.height + RsJunctionViewer.Vis.pos.y + 10
RsJunctionViewer.CompVisSeparator.position.y = RsJunctionViewer.Vis.pos.y - 7
RsJunctionViewer.VisGenSeparator.position.y = RsJunctionViewer.Gen.pos.y - 7
)
)
rollout Generator "Junction Test File Generator" rolledUp:true
( -- Generates an input junction test CSV from current object selection, can run BAT file to output main/vram/archetype data on current platform if args set up properly
local ROwidth = 234
local writeCSVName = "X:\Juncs\LIBERTY_Test_Junctions.csv"
local DefaultWriteCSVLocation = "X:\Juncs\LIBERTY_Test_Junctions.csv"
group "Generate Junction Test From Selection"
(
progressBar CSVSurround "" color:[175,175,175] value:100 width:((ROwidth)-14) height:46 offset:[-4,0] enabled:false
button ChangeWriteCSV "Change Output CSV" width:((ROwidth*0.65)-11) height:22 align:#left offset:[0,-47] tooltip:"Change CSV file to write blank junction test locations to. Use for new junctions or running chunks of existing set."
button DefaultWriteCSV "Use Default" width:((ROwidth*0.35)-11) height:22 align:#right offset:[1,-27]
editText WriteFileName "" text:DefaultWriteCSVLocation width:(ROwidth-18) align:#left offset:[-4,-5] align:#center readonly:true
button SelectUnsetJunctions "Select Default Junction Markers" width:(ROwidth-16) height:30 offset:[0,4] tooltip:"Selects any junction marker with default height and width (taken from the offset values above), which will probably be unset in the current junction file.\nThese will be written out to the CSV when Generate CSV is pressed."
button WriteCSV "Generate CSV" width:(ROwidth-16) height:60 tooltip:"Generate the above junction test file from current selection. Ideally all Max box primitives, since the visualiser expects them..."
)
group "Run Junction Test"
(
progressBar BATSurround "" color:[175,175,175] value:100 width:((ROwidth)-14) height:68 offset:[-4,0] enabled:false
button ChangeBATFile "Change Target .BAT" across:2 align:#left width:((ROwidth*0.66)-12) height:21 offset:[0,-70] tooltip:"Change between PS3/Xbox 360 .BAT files.\nNOTE: .BAT file needs specifically set up with the correct args to output junction test results to a CSV.\nChange this with caution..."
dropdownlist PlatformSelection "" items:RsJunctionViewer.Projects[RsJunctionViewer.ActiveProject].platforms selection:2 width:((ROwidth*0.34)-8) height:20 align:#right offset:[2,-72]-- other options for NG on folder switch... "PS4", "XB1", "PC" (search for CLICK_ME_*_JUNC_TEST)
editText BATFilePath "" text:RsJunctionViewer.Projects[RsJunctionViewer.ActiveProject].folder across:2 align:#left width:((ROwidth*0.66)-8) height:20 offset:[-4,-4] align:#center readonly:true
dropdownlist ProjectSelection "" items:RsJunctionViewer.ProjectNames selection:2 width:((ROwidth*0.34)-8) height:20 align:#right offset:[2,-5]-- other options for NG on folder switch... "PS4", "XB1", "PC" (search for CLICK_ME_*_JUNC_TEST)
editText BATFileName "" text:RsJunctionViewer.BATnames[1] width:(ROwidth-18) height:20 offset:[-4,-6] align:#left readonly:true
progressBar RunSurround "" color:[255,0,0] value:100 width:((ROwidth)-14) height:46 offset:[-4,4] enabled:true
button RunTest "Run Junction Test" width:(ROwidth-22) height:40 offset:[1,-48] tooltip:"Run the junction test .BATon your target PS3/XBox/etc. Needs set up outside this script, so results may vary..."
)
---- GENERATOR FUNCTIONS ----
fn ChangeBatFileName =
(
-- This will need future proofed at some point... !!!
case PlatformSelection.selected of
(
"XBox360":(BATFileName.text = "CLICK_ME_360_JUNC_TEST.bat")
"PS3":(BATFileName.text = "CLICK_ME_PS3_JUNC_TEST.bat")
"PS4":(BATFileName.text = "game_orbis_beta.bat")
"XB1":(BATFileName.text = "game_durango_beta.bat")
"PC":(BATFileName.text = "game_win64_beta.bat")
default:(BATFileName.text = "UNKNOWN FORMAT" ; RunTest.enabled = false ; RunSurround.enabled = false)
)
local batName = BATFilePath.text + BATFileName.text
if doesFileExist batName then
(
RunTest.enabled = true ; RunSurround.enabled = true
)
else
(
RunTest.enabled = false ; RunSurround.enabled = false
)
)
---- GENERATOR EVENTS ----
---- GENERATOR FILE EVENTS ----
on ChangeWriteCSV pressed do
(
RsJunctionViewer.writeCSVName = getSaveFileName caption:"Select CSV To Save Selected Junctions" filename:RsJunctionViewer.writeCSVName types:"CSV (*.csv)|*.csv|All Files (*.*)|*.*|"
if RsJunctionViewer.writeCSVName != undefined then WriteFileName.text = RsJunctionViewer.writeCSVName
) -- end ChangeWriteCSV pressed
on DefaultWriteCSV pressed do ( WriteFileName.text = RsJunctionViewer.DefaultWriteCSVLocation )
on WriteCSV pressed do
(
if selection.count > 0 then
(
if (WriteFileName.text != undefined) and (doesFileExist (getFileNamePath WriteFileName.text)) then
(
local output_file = createfile WriteFileName.text
format "name,x,y,z\n" to:output_file --write header
for marker in selection do
(
format "%,%,%,%\n" marker.name marker.pos.x marker.pos.y marker.pos.z to:output_file
)
format "END,-1079,-3239,6\n" to:output_file --write footer
close output_file
)
)
) -- end WriteCSV pressed
on SelectUnsetJunctions pressed do
(
local defaultWidth = 0
local defaultHeight = 0
clearselection()
if (RsJunctionViewer.PresetValues.count > 0) then (defaultWidth = RsJunctionViewer.PresetValues[1].WOffset ; defaultHeight = RsJunctionViewer.PresetValues[1].WOffset) else (defaultWidth = 8 ; defaultHeight = 8)
select (for obj in objects where classOf obj == box and obj.width == defaultWidth and obj.height == defaultHeight collect obj)
)
---- GENERATOR JUNCTION TEST EVENTS ----
on ChangeBATFile pressed do
(
local batName = BATFilePath.text + BATFileName.text
local batFile = getOpenFileName caption:"Select Junction Test BAT" filename:batName types:"BAT File (Junction Test)|*.bat|" --All Files (*.*)|*.*|" -- Removing the all files filter... may restore later.
if (batFile != undefined) and (doesFileExist batFile) then
(
RunTest.enabled = true ; RunSurround.enabled = true -- assume that this is a valid Junction test file regardless...
BATFileName.text = fileNameFromPath batFile
BATFilePath.text = getFileNamePath batFile
ProjectSelection.selection = PlatformSelection.selection = 1 -- Platform not set until I figure out the best way to change it !!!
for pindex = 2 to Projects.count do
(
if (BATFilePath.text == Projects[pindex].folder) then
(
ProjectSelection.selection = pindex
PlatformSelection.items = Projects[pindex].platforms
)
)
)
)
on PlatformSelection selected newPlatform do
(
RunTest.enabled = true ; RunSurround.enabled = true
ChangeBatFileName()
)
on ProjectSelection selected newProject do
(
PlatformSelection.items = RsJunctionViewer.Projects[newProject].platforms
BATFilePath.text = RsJunctionViewer.Projects[newProject].folder
RunTest.enabled = true ; RunSurround.enabled = true
ChangeBatFileName()
)
on RunSurround clicked ArgIgnore do
( -- RunSurround higher priority than RunTest for some reason...
local batName = BATFilePath.text + BATFileName.text
if doesFileExist batName then
(
local message = "Run this file?\n\n"+batName
if (queryBox message title:"Junction Test Script Launch") then shellLaunch batName "" --Query not strictly neccessary... stops my dodgy mouse from running it on rollout open though
)
else
(
local message = "Can't find BAT file\n"+batName
messageBox message title:"Missing BAT File"
)
)
---- ROLLOUT EVENTS ----
on Generator rolledUp Rolled do
(
if Rolled then ( RsJunctionViewer.Gen.height = 362 ) else ( RsJunctionViewer.Gen.height = 26 )
if (RsJunctionViewer.Vis.height > 26) then (RsJunctionViewer.Vis.height = RsJunctionViewer.height - (RsJunctionViewer.Vis.pos.y + RsJunctionViewer.Gen.height + 14))
RsJunctionViewer.Gen.pos.y = RsJunctionViewer.Vis.pos.y + RsJunctionViewer.Vis.height + 10
RsJunctionViewer.CompVisSeparator.position.y = RsJunctionViewer.Vis.pos.y - 7
RsJunctionViewer.VisGenSeparator.position.y = RsJunctionViewer.Gen.pos.y - 7
)
)
CreateDialog RsJunctionViewer width:256 height:1038 style:#(#style_titlebar, #style_border, #style_sysmenu,#style_toolwindow)
AddSubRollout RsJunctionViewer.Comp Comparison
AddSubRollout RsJunctionViewer.Vis Visualiser
AddSubRollout RsJunctionViewer.Gen Generator