Board index FlightGear Development Canvas

"nil used in numeric context" when loading SVG  Topic is solved

Canvas is FlightGear's new fully scriptable 2D drawing system that will allow you to easily create new instruments, HUDs and even GUI dialogs and custom GUI widgets, without having to write C++ code and without having to rebuild FlightGear.

"nil used in numeric context" when loading SVG

Postby Gijs » Thu Aug 21, 2014 9:53 pm

Hi,

since some time (don't know the exact day it started), whenever I load the 744's PFD.svg file, I get the follow error:
Code: Select all
'nil used in numeric context' 'C:/flightgear/fgdata/Nasal/canvas/svg.nas'

The SVG fails to load, so I'm stuck with a black screen. I've tried reverting to an old (known to work) version of my SVG file, but I got the same error. When I revert Nasal/canvas/svg.nas to the release/3.0 branch (that is, revert commit fe6b053), all works fine.

I don't get the error with any of the other SVG files.

Cheers,
Gijs
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9549
Joined: Tue Jul 03, 2007 3:55 pm
Location: Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: "nil used in numeric context" when loading SVG

Postby TheTom » Thu Aug 21, 2014 10:14 pm

I currently can not start the 744 at all?

Code: Select all
./fgfs --aircraft=747-400

Code: Select all
Could not open system file: systems.xml in path $FG_DATA/Aircraft/Generic/JSBSim/Systems/ or $FG_DATA/Aircraft/747-400/Systems/
No filename given.
Error loading file

Aircraft system element has problems in file $FG_DATA/747-400/747-400.xml
Unknown exception in the main loop. Aborting...
Possible cause: No such file or directory
TheTom
 
Posts: 322
Joined: Sun Oct 09, 2011 11:20 am

Re: "nil used in numeric context" when loading SVG  

Postby Gijs » Sat Aug 23, 2014 1:11 pm

Ouch, forgot to commit a file. Should be fine now. I've got lots of updates coming, but the PFD is still the one that's currently in Git, so you should be able to verify the issue.

EDIT: No idea what I did, but I saved the SVG from Inkscape and now it works...
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9549
Joined: Tue Jul 03, 2007 3:55 pm
Location: Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: "nil used in numeric context" when loading SVG

Postby TheTom » Sun Aug 24, 2014 1:06 pm

Should be fixed now. There were some non rectangular clip-paths defined which are not supported by the Canvas. The svg parser now simply ignores them and prints a warning they are not used.

Btw. there are probably some more files missing:
Code: Select all
Duplicate autopilot component Altitude Hold (Altimeter based) Stage 1, renamed to Altitude Hold (Altimeter based) Stage 1_0
Duplicate autopilot component heading bug error clamper, renamed to heading bug error clamper_0
Duplicate autopilot component Glideslope Hold: ground-mode fallback to vertical speed hold with throttle, renamed to Glideslope Hold: ground-mode fallback to vertical speed hold with throttle_0
Duplicate autopilot component Pitch hold, renamed to Pitch hold_0
Duplicate autopilot component Stall speed margin computer, renamed to Stall speed margin computer_0
Duplicate autopilot component Stall speed margin computer, renamed to Stall speed margin computer_1
Duplicate autopilot component PFD preprocessor (spd command), renamed to PFD preprocessor (spd command)_0
Duplicate autopilot component PFD preprocessor (spd command), renamed to PFD preprocessor (spd command)_1
Duplicate autopilot component PFD preprocessor (spd command), renamed to PFD preprocessor (spd command)_2
Cannot find image file ""
Cannot find image file ""
duplicate init of SGEventMgr
osgDB ac3d reader: could not find texture "overhead_switches.png"

osgDB ac3d reader: could not find texture "overhead_switches.png"

osgDB ac3d reader: could not find texture "overhead_switches.png"

osgDB ac3d reader: could not find texture "overhead_switches.png"

osgDB ac3d reader: could not find texture "overhead_switches.png"

osgDB ac3d reader: could not find texture "overhead_switches.png"

osgDB ac3d reader: could not find texture "overhead_switches.png"

osgDB ac3d reader: could not find texture "overhead_switches.png"

osgDB ac3d reader: could not find texture "overhead_switches.png"

osgDB ac3d reader: could not find texture "overhead_switches.png"

osgDB ac3d reader: could not find texture "overhead_switches.png"

osgDB ac3d reader: could not find texture "overhead_switches.png"

osgDB ac3d reader: could not find texture "overhead_switches.png"

osgDB ac3d reader: could not find texture "overhead_switches.png"

osgDB ac3d reader: could not find texture "overhead_switches.png"

osgDB ac3d reader: could not find texture "overhead_switches.png"

osgDB ac3d reader: could not find texture "overhead_switches.png"

osgDB ac3d reader: could not find texture "overhead_switches.png"

osgDB ac3d reader: could not find texture "overhead_switches.png"

osgDB ac3d reader: could not find texture "overhead_switches.png"

osgDB ac3d reader: could not find texture "overhead_switches.png"

osgDB ac3d reader: could not find texture "overhead_switches.png"

Could not find at least one of the following objects for animation: 'panel.electric'
Could not find at least one of the following objects for animation: 'panel.hydraulic'
Could not find at least one of the following objects for animation: 'stbypwr'
Could not find at least one of the following objects for animation: 'utility.l'
Could not find at least one of the following objects for animation: 'utility.l.ON'
Could not find at least one of the following objects for animation: 'utility.l.OFF'
Could not find at least one of the following objects for animation: 'utility.l', 'utility.l.ON', 'utility.l.OFF'
Could not find at least one of the following objects for animation: 'utility.r'
Could not find at least one of the following objects for animation: 'utility.r.ON'
Could not find at least one of the following objects for animation: 'utility.r.OFF'
Could not find at least one of the following objects for animation: 'utility.r', 'utility.r.ON', 'utility.r.OFF'
Could not find at least one of the following objects for animation: 'apu_gen.2'
Could not find at least one of the following objects for animation: 'apu_gen.2.AVAIL'
Could not find at least one of the following objects for animation: 'apu_gen.2.ON'
Could not find at least one of the following objects for animation: 'pack_hi_flow', 'pack_hi_flow.ON'
Could not find at least one of the following objects for animation: 'pack_hi_flow.ON'
Could not find at least one of the following objects for animation: 'pack_rst.SYSFAULT'
Could not find at least one of the following objects for animation: 'bleed_apu', 'bleed_apu.ON', 'bleed_apu.VALVE'
Could not find at least one of the following objects for animation: 'bleed_apu.ON'
Could not find at least one of the following objects for animation: 'bleed_apu.VALVE'
Texture file not found: 'Aircraft/747-400/Models/Effects/lightmap_overhead_switches.png'
Could not find at least one of the following objects for animation: 'stab.trim.greenband'
TheTom
 
Posts: 322
Joined: Sun Oct 09, 2011 11:20 am

Re: "nil used in numeric context" when loading SVG

Postby Gijs » Sun Aug 24, 2014 1:52 pm

Great, thanks! I'll have a look at the missing files.
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9549
Joined: Tue Jul 03, 2007 3:55 pm
Location: Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: "nil used in numeric context" when loading SVG

Postby Hooray » Sun Aug 24, 2014 4:45 pm

I'd suggest not to add too much new stuff to the pfd.nas file, its structure is going to cause challenges in the future if we continue building onto it as is - it would be better to either look at TorstenD's recent PFD work and reuse certain SVG/animation building blocks from there, or at least adopt the suggestions detailed at: http://wiki.flightgear.org/Howto:Coding ... _Framework

Overall, there's no reason why shouldn't be able to generalize navdisplay.mfd a little better and reuse the same method to also allow PFDs, and other MFDs, to be scripted like this - back-end wise, we could then adopt either Torsten's or Philosopher's Canvas/animation helpers. Creating single-instance MFDs with global state is not a good idea, and will lock out any other aircraft developers who could normally reuse the same code for their own aircraft/instruments.

I don't think there's too much missing to allow most MFDs to be developed primarrly in Inkscape, and scripted via Nasal extension hooks, analogous to those developed by Torsten for the ZivkoEdge - if we want to support styling and customization, we can still use the ND method until better methods become available.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU


Return to Canvas

Who is online

Users browsing this forum: No registered users and 3 guests