When I excute script in editor, the output will be blocking。
During excuting, I can't see only output log which I use octane.common.print or print function to print in the script。
If the script exit, the all output log can display in the Output pannel together。
My script will excute with a long time。 Even I output the log to a log file,the output content still be blocked unitl the script exit。
How can I avoid this?
HELP!!lua script and "open editor" problem。
- stratified
- Posts: 945
- Joined: Wed Aug 15, 2012 6:32 am
- Location: Auckland, New Zealand
Yes, when a script is executing, the user interface is disable. This is by design, we don't want users fiddling around with the nodes while a script is executing because this can lead to unexpected behaviour.
You cannot avoid this. Some users work around this by displaying a progress bar.
cheers,
Thomas
You cannot avoid this. Some users work around this by displaying a progress bar.
cheers,
Thomas
- butterhuang
- Posts: 11
- Joined: Mon Jun 01, 2015 5:10 am
yeah, you can just block the editor toolbar and input area, but now the output area is blocked. it is not writable!stratified wrote:Yes, when a script is executing, the user interface is disable. This is by design, we don't want users fiddling around with the nodes while a script is executing because this can lead to unexpected behaviour.
You cannot avoid this. Some users work around this by displaying a progress bar.
cheers,
Thomas
You might want to consider usingbutterhuang wrote:When I excute script in editor, the output will be blocking。
During excuting, I can't see only output log which I use octane.common.print or print function to print in the script。
If the script exit, the all output log can display in the Output pannel together。
My script will excute with a long time。 Even I output the log to a log file,the output content still be blocked unitl the script exit。
How can I avoid this?
octane.gui.dispatchGuiEvents(1)
to flush output to the output window of the script editor. Something like the following:Code: Select all
local ffi = require("ffi")
if ffi.os ~= "Windows" then
print("This script is only for windows")
return
end
ffi.cdef [[
void Sleep(int ms);
int poll(struct pollfd *fds, unsigned long nfds, int timeout);
]]
function sleep(t)
ffi.C.Sleep(t*1000)
end
co = coroutine.create(function()
for i=0,100 do
if i == 50 then
coroutine.yield()
end
print(i)
io.flush()
end
end)
coroutine.resume(co)
octane.gui.dispatchGuiEvents(3)
sleep(5)
coroutine.resume(co)
- butterhuang
- Posts: 11
- Joined: Mon Jun 01, 2015 5:10 am
such an ugly solution.
mist wrote:You might want to consider usingbutterhuang wrote:When I excute script in editor, the output will be blocking。
During excuting, I can't see only output log which I use octane.common.print or print function to print in the script。
If the script exit, the all output log can display in the Output pannel together。
My script will excute with a long time。 Even I output the log to a log file,the output content still be blocked unitl the script exit。
How can I avoid this?octane.gui.dispatchGuiEvents(1)
to flush output to the output window of the script editor. Something like the following:
Code: Select all
local ffi = require("ffi") if ffi.os ~= "Windows" then print("This script is only for windows") return end ffi.cdef [[ void Sleep(int ms); int poll(struct pollfd *fds, unsigned long nfds, int timeout); ]] function sleep(t) ffi.C.Sleep(t*1000) end co = coroutine.create(function() for i=0,100 do if i == 50 then coroutine.yield() end print(i) io.flush() end end) coroutine.resume(co) octane.gui.dispatchGuiEvents(3) sleep(5) coroutine.resume(co)
Use this line only:
Code: Select all
octane.gui.dispatchGuiEvents(3)