Please see screen shot from script editor.
I am getting an error in the following code, which is the line setting the title value in a table holding PROPS_FILE_DIALOG attributes. I'm suspicious its not really being caused by that line. This script worked in versions prior to 3.06. any help would be appreciated.
thx.
-- choose an output file
local ret = octane.gui.showDialog
{
type = octane.gui.dialogType.FILE_DIALOG,
title = "Select a file of saved camera moves.",
wildcards = "*.txt",
save = false,
}
-- If a file is chosen
if ret.result ~= "" then
New Lua error inOctane Standalone version 3.06
Your suspicion is correct, that error is actually raised by a call to
--
Roeland
octane.gui.createGroup
. It expects a 2D table with components — technically a sequence of sequences of components , eg. {{label1, slider1}, {label2, texteditor2}, {label3, button3}}
. This represents how the components are laid out in a 2D grid.--
Roeland
Roeland,
Thanks for the help, I think there is something going on at your end.
This code works.
-- Creates a group and retuns it
function ui.createGroup(name, children, border, rows, cols, width, height, text, padding, inset, center)
return octane.gui.create
{
type = octane.gui.componentType.GROUP, -- type of the component
name = name, -- name of component
children = children, -- list of children components
border = border, -- boolean flag to show border
rows = rows, -- number of rows in group grid
cols = cols, -- number of cols in group grid
width = width, -- width in pixels
height = height, -- height in pixels
text = text, -- text to display at top of group
padding = padding, -- internal padding in each cell
inset = inset, -- inset of the group component
centre = center, -- center the group
}
end
this code which I'm assuming is more modern, does not
-- Creates a group and retuns it
function ui.createGroup(name, children, border, rows, cols, width, height, text, padding, inset, center)
return octane.gui.createGroup
{
--type = octane.gui.componentType.GROUP, -- type of the component
name = name, -- name of component
children = children, -- list of children components
border = border, -- boolean flag to show border
rows = rows, -- number of rows in group grid
cols = cols, -- number of cols in group grid
width = width, -- width in pixels
height = height, -- height in pixels
text = text, -- text to display at top of group
padding = padding, -- internal padding in each cell
inset = inset, -- inset of the group component
centre = center, -- center the group
}
end
Having used the code that works to solve the original issue, I now get this error.
The OLE Ready Cam lua script is failing in v3.06 with the same error apparently, as someone has recently asked you to repair it.
Thanks for your help.
Thanks for the help, I think there is something going on at your end.
This code works.
-- Creates a group and retuns it
function ui.createGroup(name, children, border, rows, cols, width, height, text, padding, inset, center)
return octane.gui.create
{
type = octane.gui.componentType.GROUP, -- type of the component
name = name, -- name of component
children = children, -- list of children components
border = border, -- boolean flag to show border
rows = rows, -- number of rows in group grid
cols = cols, -- number of cols in group grid
width = width, -- width in pixels
height = height, -- height in pixels
text = text, -- text to display at top of group
padding = padding, -- internal padding in each cell
inset = inset, -- inset of the group component
centre = center, -- center the group
}
end
this code which I'm assuming is more modern, does not
-- Creates a group and retuns it
function ui.createGroup(name, children, border, rows, cols, width, height, text, padding, inset, center)
return octane.gui.createGroup
{
--type = octane.gui.componentType.GROUP, -- type of the component
name = name, -- name of component
children = children, -- list of children components
border = border, -- boolean flag to show border
rows = rows, -- number of rows in group grid
cols = cols, -- number of cols in group grid
width = width, -- width in pixels
height = height, -- height in pixels
text = text, -- text to display at top of group
padding = padding, -- internal padding in each cell
inset = inset, -- inset of the group component
centre = center, -- center the group
}
end
Having used the code that works to solve the original issue, I now get this error.
The OLE Ready Cam lua script is failing in v3.06 with the same error apparently, as someone has recently asked you to repair it.
Thanks for your help.
Windows 11, 2x Intel I9, 64GB Ram, 2x GTX 1080 TI, 1 x RTX 380 TI, Oculus Quest 2
This is due to new behaviour in Lua 5.3. This version introduced a separate integer type, and where previously floating point numbers were implicitly rounded to integers, now this rounding will raise an error if the number in question is not an exact integer. For some situations (like array indices or type IDs) that's probably a good thing, but in other situations where this rounding kind of works OK (UI component sizes in the script above) it will break scripts.
You can fix this script by looking for instances of
We can emulate the old behaviour in a few places, so more scripts will still work.
--
Roeland
You can fix this script by looking for instances of
width=(cameraFile.group.width * .97)
and replacing them with width=math.floor(cameraFile.group.width * .97)
We can emulate the old behaviour in a few places, so more scripts will still work.
--
Roeland
Figured that one out, I was running the script inside a project that was packaged as an orbix file, and dropped into a scene. I guess that means the script needs to do a bit more testing up front to understand its environment, which i have no clue how to do.
thx
thx
Windows 11, 2x Intel I9, 64GB Ram, 2x GTX 1080 TI, 1 x RTX 380 TI, Oculus Quest 2