11
2- processHandle = nil
2+ processHandleMTFG = nil
33processHandleConfigDir = nil
4+ processHandleLogFile = nil
5+ logfileExist = false
6+ updateCounter = 0
47scriptIdx = 0
58status = " MTFG not running"
69
@@ -26,15 +29,15 @@ function start_funscript_generator()
2629 print (" nextAction: " , next_action and tostring (script .actions [next_action ].at ) or " nil" )
2730
2831 if next_action then
29- processHandle = ofs .CreateProcess (
32+ processHandleMTFG = ofs .CreateProcess (
3033 cmd , " --generator" ,
3134 " -s" , tostring (currentTimeMs ),
3235 " -e" , tostring (script .actions [next_action ].at ),
3336 " -i" , video ,
3437 " -o" , tmpFile
3538 )
3639 else
37- processHandle = ofs .CreateProcess (
40+ processHandleMTFG = ofs .CreateProcess (
3841 cmd , " --generator" ,
3942 " -s" , tostring (currentTimeMs ),
4043 " -i" , video ,
7881
7982
8083function update (delta )
81- if processHandle and not ofs .IsProcessAlive (processHandle ) then
84+ updateCounter = updateCounter + 1
85+ if processHandleMTFG and not ofs .IsProcessAlive (processHandleMTFG ) then
8286 print (' funscript generator completed import result' )
83- processHandle = nil
87+ processHandleMTFG = nil
8488 import_funscript_generator_result ()
8589 end
90+ if math.fmod (updateCounter , 1000 ) then
91+ local f = io.open (" C:/Temp/funscript_editor.log" )
92+ if f then
93+ logfileExist = true
94+ else
95+ logfileExist = false
96+ end
97+ end
8698end
8799
88100
89101function gui ()
90102 ofs .Text (status )
91- if not processHandle then
103+ if not processHandleMTFG then
92104 ofs .SameLine ()
93105 if ofs .Button (" Start MTFG" ) then
94106 start_funscript_generator ()
95107 end
96108 end
97109 ofs .SameLine ()
98- if ofs .Button (" Open Config Directory " ) then
110+ if ofs .Button (" Open Config" ) then
99111 processHandleConfigDir = ofs .CreateProcess (" explorer.exe" , ofs .ExtensionDir ().. " \\ funscript-editor\\ funscript_editor\\ config" )
100112 end
113+
114+ if logfileExist then
115+ ofs .SameLine ()
116+ if ofs .Button (" Open Log" ) then
117+ processHandleLogFile = ofs .CreateProcess (" notepad.exe" , " C:/Temp/funscript_editor.log" )
118+ end
119+ end
101120end
0 commit comments