@@ -6,11 +6,12 @@ processHandleConfigDir = nil
66processHandleLogFile = nil
77logfileExist = false
88updateCounter = 0
9- scriptIdx = 0
9+ scriptIdx = 1
1010mtfgVersion = "0.0.0"
1111status = "MTFG not running"
1212multiaxis = false
1313tmpFileName = "funscript_actions.json"
14+ tmpFileExists = false
1415scriptNames = {}
1516scriptAssignment = {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)
181182end
182183
183184
@@ -338,6 +339,17 @@ function update_script_names()
338339 end
339340end
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
342354function 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
353366end
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