Skip to content

Commit 1651272

Browse files
author
arch
committed
add force import tu lua next
1 parent cff9426 commit 1651272

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

contrib/Installer/assets/main.lua.next

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ processHandleConfigDir = nil
66
processHandleLogFile = nil
77
logfileExist = false
88
updateCounter = 0
9-
scriptIdx = 0
9+
scriptIdx = 1
1010
mtfgVersion = "0.0.0"
1111
status = "MTFG not running"
1212
multiaxis = false
1313
tmpFileName = "funscript_actions.json"
14+
tmpFileExists = false
1415
scriptNames = {}
1516
scriptAssignment = {x={idx=1}, y={idx=1}, roll={idx=1}}
1617

@@ -177,7 +178,7 @@ function import_funscript_generator_json_result()
177178
end
178179

179180
-- delete json file
180-
os.remove(tmpFile)
181+
-- os.remove(tmpFile)
181182
end
182183

183184

@@ -338,6 +339,17 @@ function update_script_names()
338339
end
339340
end
340341

342+
function update_tmp_file_exists()
343+
local tmpFile = ofs.ExtensionDir() .. "/" .. tmpFileName
344+
local f = io.open(tmpFile)
345+
if f then
346+
tmpFileExists = true
347+
f:close()
348+
else
349+
tmpFileExists = false
350+
end
351+
end
352+
341353

342354
function update(delta)
343355
updateCounter = updateCounter + 1
@@ -349,6 +361,7 @@ function update(delta)
349361
if math.fmod(updateCounter, 100) == 1 then
350362
update_logfile_exists()
351363
update_script_names()
364+
update_tmp_file_exists()
352365
end
353366
end
354367

@@ -388,10 +401,10 @@ function gui()
388401

389402
if logfileExist then
390403
if platform == "Windows" then
391-
-- ofs.SameLine()
392-
-- if ofs.Button("Open Log") then
393-
-- processHandleLogFile = ofs.CreateProcess("notepad.exe", "C:/Temp/funscript_editor.log")
394-
-- end
404+
ofs.SameLine()
405+
if ofs.Button("Open Log") then
406+
processHandleLogFile = ofs.CreateProcess("notepad.exe", "C:/Temp/funscript_editor.log")
407+
end
395408
else
396409
ofs.SameLine()
397410
if ofs.Button("Open Log") then
@@ -400,6 +413,14 @@ function gui()
400413
end
401414
end
402415

416+
if tmpFileExists then
417+
ofs.SameLine()
418+
if ofs.Button("Force Import") then
419+
scriptIdx = ofs.ActiveIdx()
420+
import_funscript_generator_json_result()
421+
end
422+
end
423+
403424
ofs.Separator()
404425

405426
multiaxis, valueChanged = ofs.Checkbox("multiaxis", multiaxis)

0 commit comments

Comments
 (0)