New Lua error inOctane Standalone version 3.06

Forums: New Lua error inOctane Standalone version 3.06
Forum for OctaneRender Lua scripting examples, discussion and support.

New Lua error inOctane Standalone version 3.06

Postby MB » Tue May 23, 2017 8:50 pm

MB Tue May 23, 2017 8:50 pm
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
Attachments
Lua Error.PNG
Windows 7 Enterprise, 2x Intel Xeon X5650 2.66 GHz, 24GB Ram, GTX 590, Quadro 5000, Quadro K4200
User avatar
MB
Licensed Customer
Licensed Customer
 
Posts: 119
Joined: Tue Jan 15, 2013 3:41 am
Location: Washington, D.C.

Re: New Lua error inOctane Standalone version 3.06

Postby roeland » Wed May 24, 2017 1:20 am

roeland Wed May 24, 2017 1:20 am
Your suspicion is correct, that error is actually raised by a call to 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
User avatar
roeland
OctaneRender Team
OctaneRender Team
 
Posts: 1741
Joined: Wed Mar 09, 2011 10:09 pm

Re: New Lua error in Octane Standalone version 3.06

Postby MB » Wed May 24, 2017 3:42 pm

MB Wed May 24, 2017 3:42 pm
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.
Attachments
Lua Error 2.PNG
Windows 7 Enterprise, 2x Intel Xeon X5650 2.66 GHz, 24GB Ram, GTX 590, Quadro 5000, Quadro K4200
User avatar
MB
Licensed Customer
Licensed Customer
 
Posts: 119
Joined: Tue Jan 15, 2013 3:41 am
Location: Washington, D.C.

Re: New Lua error inOctane Standalone version 3.06

Postby roeland » Wed May 24, 2017 11:29 pm

roeland Wed May 24, 2017 11:29 pm
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 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
User avatar
roeland
OctaneRender Team
OctaneRender Team
 
Posts: 1741
Joined: Wed Mar 09, 2011 10:09 pm

Re: New Lua error inOctane Standalone version 3.06

Postby MB » Thu May 25, 2017 7:08 pm

MB Thu May 25, 2017 7:08 pm
Roeland,

I got that to work by using your advice, now it is falling over elsewhere. Please see image below.
This could be very slow fixing one line every 24hr hours. Is there a better way?

thx
Attachments
Lua Error 3.PNG
Windows 7 Enterprise, 2x Intel Xeon X5650 2.66 GHz, 24GB Ram, GTX 590, Quadro 5000, Quadro K4200
User avatar
MB
Licensed Customer
Licensed Customer
 
Posts: 119
Joined: Tue Jan 15, 2013 3:41 am
Location: Washington, D.C.

Re: New Lua error inOctane Standalone version 3.06

Postby roeland » Thu May 25, 2017 10:40 pm

roeland Thu May 25, 2017 10:40 pm
That looks like an error which should also pop up in previous versions. Anyway, if you can send me a simple scene so I can reproduce this issue here I can have a look. (probably you can strip all the geometry & materials).
User avatar
roeland
OctaneRender Team
OctaneRender Team
 
Posts: 1741
Joined: Wed Mar 09, 2011 10:09 pm

Re: New Lua error inOctane Standalone version 3.06

Postby MB » Fri May 26, 2017 1:53 pm

MB Fri May 26, 2017 1:53 pm
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
Windows 7 Enterprise, 2x Intel Xeon X5650 2.66 GHz, 24GB Ram, GTX 590, Quadro 5000, Quadro K4200
User avatar
MB
Licensed Customer
Licensed Customer
 
Posts: 119
Joined: Tue Jan 15, 2013 3:41 am
Location: Washington, D.C.

Return to Lua Scripting


Who is online

Users browsing this forum: No registered users and 0 guests

Sat Dec 14, 2019 1:29 pm [ UTC ]