Board index FlightGear Development Aircraft

F-20 development

Questions and discussion about creating aircraft. Flight dynamics, 3d models, cockpits, systems, animation, textures.

Re: F-20 development

Postby TheTom » Tue Sep 10, 2013 4:41 pm

Flying toaster wrote in Tue Sep 10, 2013 4:28 pm:Check just the post above ... right below the screenshot ... :D

Thank you :-)
TheTom
 
Posts: 322
Joined: Sun Oct 09, 2011 11:20 am

Re: F-20 development

Postby TheTom » Fri Sep 13, 2013 10:43 am

Flying toaster wrote in Mon Sep 09, 2013 9:00 pm:Bad news : the loadout menu is broken. Using the del() method on the window destroys the off-screen canvas (since it is attached to no texture) so I tried to work around that ... to no avail.

In the code available you delete the canvas yourself?! You should just delete the dialog with .del() and either create a new canvas each time the dialog is opened or prevent the canvas from being destroyed by adding another placement (It doesn't have to be a real placement. You can eg. just do: canvas.addPlacement({"type": "ref"});)
TheTom
 
Posts: 322
Joined: Sun Oct 09, 2011 11:20 am

Re: F-20 development

Postby Flying toaster » Sat Sep 14, 2013 6:09 pm

TheTom wrote in Fri Sep 13, 2013 10:43 am:You can eg. just do: canvas.addPlacement({"type": "ref"});)


Thanks, that did the trick ! I didn't realise I could increase the reference count that way... I must admit the very lax object model of nasal is a mystery to a dinosaur like me :oops:
Anyway now I must dig into my todo list to end this aircraft. I was definitely optimistic when I thought it could be ended by the summer. Hope you can be patient and enjoy this alpha.
As usual, comments to improve are always welcome

Cheers

Enrique
Flying toaster
 
Posts: 390
Joined: Wed Nov 29, 2006 7:25 am
Location: Toulouse France

Re: F-20 development

Postby Hooray » Sat Sep 14, 2013 6:50 pm

Flying toaster wrote in Sat Sep 14, 2013 6:09 pm:
TheTom wrote in Fri Sep 13, 2013 10:43 am:You can eg. just do: canvas.addPlacement({"type": "ref"});)

Thanks, that did the trick ! I didn't realise I could increase the reference count that way... I must admit the very lax object model of nasal is a mystery to a dinosaur like me :oops:

I haven't looked at the code, but that should have nothing to do with Nasal - it's just the canvas system that you are talking to there via the property tree, in order to tell it not to recycle the canvas texture you have created due to lack of active placements, and you are doing that by passing that hash - Tom ?
In other words, the same construct will NOT work in any other Nasal contexts, i.e. stuff unrelated to the canvas - or Philosopher would have documented it already long ago :lol:

Don't forget, there's nothing Nasal specific here, the canvas is really "just" a property tree-based system with some Nasal-space shim layers to make interaction a bit easier, you could accomplish the same thing by using setprop() or even the property browser, without touching any Nasal directly - and the construct would remain the same, even in JavaScript, Python, Lua, Ruby or C++ :D
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

Re: F-20 development

Postby Flying toaster » Sat Sep 14, 2013 7:59 pm

My understanding is that you create a "fake" placement object (hash) by passing the parameter {"type": "ref"} ...
Since that hash does not correspond to a real placement (e.g. texture or window) I does not render anywhere.
Actually I realised that the Canvas system deleted the canvas data of a window once the reference count of the canvas dropped to zero and since I did not want to reload the SVG file each time the window needed to be displayed, I tried to work around that by rewriting the del() function in my code without the reference count stuff. Didn't work. The increment of reference count with the fake placement did work ! :)

The comment about nasal is that you would have a hard time creating such an object "out of thin air" and get away with it in a strongly typed language (say C++, Ada, Pascal, even Java I think see the jargon file on bondage and discipline languages). Objective-C is more lax, but even then you would have a runtime error.
As you can see from the languages I quote, I am not very familiar with scripting languages. That comes from the fact I was raised in times when CPU frequencies were measured in MHz (and low figures, mind you), and interpreted languages were a wrong thing. I am still wondering how we can crank up such wonderful frame rates in flight gear with such a massive use of Nasal (well I must admit my core 2 E6600 is getting a bit overwhelmed with the latest releases, but my rig is 6 years old). From all this babbling you can easily confirm my status as a dinosaur.
I can always go on with my old rant that a way must be given to implement compiled, dynamically loaded modules in order to get more performance, but the portability issue would be daunting. The need to provide universal binary bundles "à la" Apple, and then have actually access to all the target computers in order to build the modules or have the mother of all cross-compilers is not a good perspective either. Actually, this is open source, so if I am not happy, I just have to implement it myself, which I don't (criticism is all too easy when you're not doing the job). So, I must admit what is there works, and works beautifully even if it beats old timers like me :D

Cheers

PS : the links to the jargon file lexicon ARE intentional. It is a very funny and enlightening reading to any person serious about hacking or superficially interested in computers :wink:
Flying toaster
 
Posts: 390
Joined: Wed Nov 29, 2006 7:25 am
Location: Toulouse France

Re: F-20 development

Postby Hooray » Sat Sep 14, 2013 8:54 pm

the comment about nasal is that you would have a hard time creating such an object "out of thin air" and get away with it in a strongly typed language (say C++, Ada, Pascal, even Java I think

What you are referring to is just an anonymous object/hash, rather than being a named symbol (variable) - but you could just as well use a named hash:

Code: Select all
var foo = {"type": "ref"};
canvas.addPlacement(foo);


In languages like C, C++, Java and Ada, you can also pass temporary heap objects without them having to be named, i.e.:
Code: Select all
foo( new bar() );


While I do understand what you are referring to, it's not so much a language issue here - i.e. static or strong typing vs. weak/duck typing in a scripting language like Nasal/JavaScript - I think it's the anonymous/embedded data structure that's getting passed that's confusing, because that's indeed something that's only really common in modern scripting languages. JavaScript code can look really extreme here, but Java's action listeners can also look pretty nasty if you aren't used to seeing tons of callbacks and functors embedded inline, rather than being separately specified - which is also a common idiom in Nasal, i.e. whenever callbacks (listeners/timers) are registered.
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

Re: F-20 development

Postby Flying toaster » Sat Sep 14, 2013 9:14 pm

See I definitely need to get back to my VT-100 on a remote DEC alpha workstation !!! :D Any plans for a ascii art version of flightgear ?

On a more serious note, I just realised that what worked before, that is, setting a fill color to a group to set the fill color of the paths in the group no longer works. I would not call this a regression since all it takes is to change the fill property of the path rather than the group. It is a nuisance for inkscape generated SVGs, because inkscape creates groups that enclose individual paths. The workaround is to rename the paths themselves rather than the groups in the xml editor. No big deal but it gave me a few headaches
Thought it could help people with the same problem :)

Cheers

Enrique
Flying toaster
 
Posts: 390
Joined: Wed Nov 29, 2006 7:25 am
Location: Toulouse France

Re: F-20 development

Postby Philosopher » Mon Sep 16, 2013 8:54 pm

FWIW, you do not need to load $FG_ROOT/Nasal files in your -set.xml:
Code: Select all
        <file>Nasal/canvas/api.nas</file>
        <file>Nasal/canvas/PropertyElement.nas</file>
        <file>Nasal/canvas/gui.nas</file>

They are guaranteed to be loaded before aircraft files, and you were loading them into the "f20" namespace despite never using them that way. I've tested and it works just fine without those.

Nice aircraft, btw, it flies like a fast jet already. It's an excellent example of 3D and 2D (Canvas) modelling! It's so nice to have a working Canvas HUD, and the 3D model is done so wonderfully!
Philosopher
 
Posts: 1593
Joined: Sun Aug 12, 2012 7:29 pm

Re: F-20 development

Postby Flying toaster » Mon Sep 16, 2013 9:08 pm

Thanks for the heads up, I'll remove it next time. It actually was needed for previous releases, but I guess that's what you get when you use bleeding edge code.
Thanks also for the comments too :D
Flying toaster
 
Posts: 390
Joined: Wed Nov 29, 2006 7:25 am
Location: Toulouse France

Re: F-20 development

Postby Philosopher » Mon Sep 16, 2013 9:27 pm

Full output from a session (using Git over here):
Code: Select all
No path in sim/sound/path
Could not find at least one of the following objects for animation: 'Slat1'
Could not find at least one of the following objects for animation: 'Slat1.001'
Could not find at least one of the following objects for animation: 'Slat2'
Could not find at least one of the following objects for animation: 'Slat2'
Could not find at least one of the following objects for animation: 'LoSpdBrk', 'LoSpdBrkJack1', 'LoSpdBrkJack2', 'LoSpdBrkJack11', 'LoSpdBrkJack22'
Could not find at least one of the following objects for animation: 'CanopyInside'
environment init
Animated jetways ... initialized
Nasal runtime error: undefined symbol: DefaultStyle
  at /Users/philosopher/Documents/FlightGear/fgdata/Nasal/canvas/gui.nas, line 16
parsesvg: skipping unknown element 'defs'
parsesvg: skipping unknown element 'sodipodi:namedview'
parsesvg: skipping unknown element 'sodipodi:guide'
parsesvg: skipping unknown element 'sodipodi:guide'
parsesvg: skipping unknown element 'sodipodi:guide'
parsesvg: skipping unknown element 'sodipodi:guide'
parsesvg: skipping unknown element 'sodipodi:guide'
parsesvg: skipping unknown element 'sodipodi:guide'
parsesvg: skipping unknown element 'sodipodi:guide'
parsesvg: skipping unknown element 'metadata'
Initializing Liveries
Nasal runtime error: method called on object of wrong type: is 'unknown' expected 'canvas.Window'
  at /Users/philosopher/Documents/FlightGear/fgdata/Nasal/canvas/gui.nas, line 224
  called from: /Users/philosopher/Documents/FlightGear/fgdata/Nasal/canvas/gui.nas, line 181
  called from: /Users/philosopher/Documents/FlightGear/fgdata/Nasal/canvas/gui.nas, line 165
  called from: /Users/philosopher/Documents/FlightGear/fgdata/Nasal/canvas/gui.nas, line 65
  called from: /Users/philosopher/Documents/FlightGear/fgdata/Aircraft/F-20/Nasal/GUI/stores.nas, line 71
  called from: , line 1


The last one (the Nasal error) happens when opening the "clipboard" (loadout dialog) after closing it – I get a big white screen and nothing else.
Philosopher
 
Posts: 1593
Joined: Sun Aug 12, 2012 7:29 pm

Re: F-20 development

Postby Flying toaster » Mon Sep 16, 2013 9:40 pm

Hum I had the white screen before. It was addressed by a post from TheTom in the Canvas Forum.
You can download a fixed version from the link on the previous page. Also I use the 2.12rc version. That might explain a few things
Flying toaster
 
Posts: 390
Joined: Wed Nov 29, 2006 7:25 am
Location: Toulouse France

Re: F-20 development

Postby Hooray » Tue Sep 17, 2013 12:15 pm

Flying toaster wrote in Mon Sep 16, 2013 9:08 pm:Thanks for the heads up, I'll remove it next time. It actually was needed for previous releases, but I guess that's what you get when you use bleeding edge code.
Thanks also for the comments too :D


right, around ~2.8 I think - meanwhile, it's no longer necessary, and actuallly problematic ... I don't know if we still have any tutorials suggesting this ??
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

Re: F-20 development

Postby Flying toaster » Tue Sep 17, 2013 8:07 pm

Hooray wrote in Tue Sep 17, 2013 12:15 pm:right, around ~2.8 I think - meanwhile, it's no longer necessary, and actually problematic ... I don't know if we still have any tutorials suggesting this ??

Don't worry ... if you look at how old this thread is, you'll realise I have been developing this aircraft for quite some time, so no wonder why a few things are indeed deprecated.
At some point, when I end it up, I expect computers to be VR glasses running a 3THz CPU on a miniature fuel cell and Linux kernel 5.13 :D
Flying toaster
 
Posts: 390
Joined: Wed Nov 29, 2006 7:25 am
Location: Toulouse France

Re: F-20 development

Postby Hooray » Wed Sep 18, 2013 6:30 am

which goes to show that you are really dedicated to long-term maintenance :D
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

Re: F-20 development

Postby Philosopher » Sat Sep 21, 2013 3:57 am

Whoa! I am really liking this jet! Had a lot of fun with it today, I've taken over 50 screenies with it since I've had it. (Wish I could post some of them.) One comment is that the afterburner/petal animations still work after the engine is turned off – because of that, it was even more weird when my aircraft didn't move, besides the fact that I didn't expect Shift+Q to work :lol:. Starting it up again was a bit of a hassle since it seemed like the start button needed to be pressed while resupplying fuel flow – I personally would like delay deactivating the starter by a bit (that's just a little bit of binding work), but I don't know how other JSBSim jets do it.

In general, it could use a bit of updating the help (e.g. "o" is the drag chute, which doesn't do anything despite having nice coding ;)) and some finishing work in areas, but it's pretty darn good! I have no idea of what is on your todo list, but I was wondering if I could help out some? Projects work better with two :)
Philosopher
 
Posts: 1593
Joined: Sun Aug 12, 2012 7:29 pm

PreviousNext

Return to Aircraft

Who is online

Users browsing this forum: wlbragg and 12 guests