Board index FlightGear Development Scenery

FlightGear Object Placement Tool [download first post]

Questions and discussion about enhancing and populating the FlightGear world.

FlightGear Object Placement Tool [download first post]

Postby radi » Mon Jan 03, 2011 11:59 pm

While converting scenery I found that adjusting an object's position and orientation by editing text files is kind of cumbersome. So I started implementing a tool that reads an .stg file, loads the respective objects into FlightGear and lets you adjust the object's properties, such as latitude, longitude, altitude and heading via an easy-to-use GUI. All changes are immediately updated in a separate FlightGear preview window:

Image

Download latest version 0.6:
https://gitlab.com/fg-radi/fgopt.git

It is written in python (requires wxpython for the GUI stuff), developed on Linux, but should run on Windows and Mac, as well. So far, this is merely a proof-of-concept. I will continue development as time permits.

Live update is achieved via a telnet connection to a running FlightGear instance.

Usage:

1. Run FlightGear with telnet enabled on port 5401:
# fgfs --telnet=5401 --aircraft=ufo

2. Run FGopt:
# fgopt.py [file.stg]

Use File -> Import .stg to add objects to the current list. You may also specify an .stg file at the command line.
The .stg file should *not* already be included in FlightGear's scenery search path; otherwise the respective objects will be displayed twice (no other side-effects, though).

You can modify the position of objects by
- entering data directly in list
- use numpad keys

Right click focuses object, mouse drag while right clicked changes view.

Save your work via File -> Export .stg. Currently, this dumps a file called out.stg in current directory.
Last edited by radi on Thu May 26, 2016 3:48 am, edited 9 times in total.
OSM buildings for LOWI, EDDC
Custom scenery for VHXX YMML
Edit .stg via the FG Object Placement Tool
radi
 
Posts: 659
Joined: Mon Aug 25, 2008 5:24 pm
Location: YMML, EDDC

Re: FlightGear Object Placement Tool [download]

Postby Avionyx » Tue Jan 04, 2011 9:17 am

Tom,

Absolutely brilliant, great idea for a tool. Will be trying it out later for sure.

Alex
Avionyx
 
Posts: 531
Joined: Mon Jan 11, 2010 4:07 pm
Location: EGMD
Callsign: G-AVYX
Version: 2020.4
OS: Manjaro

Re: FlightGear Object Placement Tool [download]

Postby ot-666 » Tue Jan 04, 2011 5:32 pm

Sounds like the tool I waited for... give it a try tonight. :D
Could be the perfect tool for my airport light development.
Oliver
Callsign: ot-666
Working on LOWI and other stuff - Custom Scenery Overlay Repo: http://gitorious.org/fgfs-custom-scenery/custom-scenery-overlay/
VMX22 - Osprey... sometimes in 2014
ot-666
 
Posts: 746
Joined: Sun Nov 08, 2009 6:14 pm
Location: Germany, Konstanz
Callsign: ot-666
IRC name: ot666
Version: GIT
OS: win7 64bit

Re: FlightGear Object Placement Tool [download]

Postby fmg » Tue Jan 04, 2011 6:23 pm

Sounds great. For something like this I've waited for long. Hope it will run also on my Mac.
Next week I'm back at my machine so I can try it.

Cheers

Frank
User avatar
fmg
 
Posts: 565
Joined: Tue Jun 29, 2010 6:13 pm
Location: EDDI
Callsign: fotomas
Version: 2
OS: Mac OS X 10.6.8

Re: FlightGear Object Placement Tool [download]

Postby radi » Tue Jan 04, 2011 8:55 pm

fmg wrote:Hope it will run also on my Mac.

Python and wxwidgets are cross-platform, and I did not include any platform-specific code. So it should run on a Mac or Windows, as well. Just give it a try and keep me informed about your results; I'll be happy to fix bugs.
OSM buildings for LOWI, EDDC
Custom scenery for VHXX YMML
Edit .stg via the FG Object Placement Tool
radi
 
Posts: 659
Joined: Mon Aug 25, 2008 5:24 pm
Location: YMML, EDDC

Re: FlightGear Object Placement Tool [download]

Postby radi » Tue Jan 18, 2011 1:13 am

v0.2 released. Changes include

- uses local coordinate system, allows for moving objects in steps of (fractions of) meters
- move/rotate objects by numpad keys (in 1m steps, use Ctrl+ for 0.1m steps), numpad +/- for alt, multiply/divide-keys for heading
- rotate view by right click/drag mouse in list
- undo/redo
- logging

Download http://www.mediafire.com/?8p88dg38wiy6bv2

Bug reports/feedback welcome!
OSM buildings for LOWI, EDDC
Custom scenery for VHXX YMML
Edit .stg via the FG Object Placement Tool
radi
 
Posts: 659
Joined: Mon Aug 25, 2008 5:24 pm
Location: YMML, EDDC

Re: FlightGear Object Placement Tool [download]

Postby radi » Wed Jan 19, 2011 12:04 am

v0.3 released.

- added Import .stg dialog so we no longer require .stg file at command line
- some more logic for FG model import: OBJECT_SHARED should load now, too.

Download http://www.mediafire.com/?cmyeze6nhzgek1g
OSM buildings for LOWI, EDDC
Custom scenery for VHXX YMML
Edit .stg via the FG Object Placement Tool
radi
 
Posts: 659
Joined: Mon Aug 25, 2008 5:24 pm
Location: YMML, EDDC

Re: FlightGear Object Placement Tool [download first post]

Postby VaLeo » Wed Jan 19, 2011 7:21 pm

Code: Select all
self.mainToolbar.AddLabelTool(wx.NewId(), "item", wx.Bitmap("/home/tom/daten/fgfs/my-contrib/fgopt/lib/a.png", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, "", "")


Can you manage it to run at other logins than /home/tom/ ?


And I'm respect how you made stg class. I'm trying write this for my scenery tools too, but have lack of OOP skills :(
VaLeo
 
Posts: 186
Joined: Wed Nov 29, 2006 11:00 am
Location: Ukraine, Dnipropetrovsk
Version: GIT
OS: Debian 7

Re: FlightGear Object Placement Tool [download first post]

Postby radi » Wed Jan 19, 2011 9:01 pm

Thanks for the catch! Just comment out this line, it's only a placeholder anyway. Will be fixed in next release.
OSM buildings for LOWI, EDDC
Custom scenery for VHXX YMML
Edit .stg via the FG Object Placement Tool
radi
 
Posts: 659
Joined: Mon Aug 25, 2008 5:24 pm
Location: YMML, EDDC

Re: FlightGear Object Placement Tool [download first post]

Postby radi » Wed Jan 19, 2011 9:04 pm

VaLeo wrote:And I'm respect how you made stg class. I'm trying write this for my scenery tools too, but have lack of OOP skills :(

Thanks! Feel free to use any of the code for your tools. What are they supposed to do, BTW?
OSM buildings for LOWI, EDDC
Custom scenery for VHXX YMML
Edit .stg via the FG Object Placement Tool
radi
 
Posts: 659
Joined: Mon Aug 25, 2008 5:24 pm
Location: YMML, EDDC

Re: FlightGear Object Placement Tool [download first post]

Postby VaLeo » Wed Jan 19, 2011 9:26 pm

In my .stg's I often leave empty lines to separate one part of scenery from another.
An fgopt cant handle this cases, I think:

Code: Select all
v@leo:~/progs/fgopt-0.3/bin$ ./fgopt.py
(0 0) hdg 0
2.8.10.1 (gtk2-unicode)
DEBUG Importing /home/v/progs/fg-osg/Scenery_TerraSync/Objects/e060n40/e069n41/4088017.stg
dirname /home/v/progs/fg-osg/Scenery_TerraSync/Objects/e060n40/e069n41
Traceback (most recent call last):
  File "./fgopt.py", line 213, in onImportStg
    self.mylist.importStg(os.path.join(self.dirname, self.filename))
  File "/home/v/progs/fgopt-0.3/bin/gui.py", line 214, in importStg
    self.updateListFromObject], self.parent.transform).objs)
  File "/home/v/progs/fgopt-0.3/bin/coordinates.py", line 313, in __init__
    self.objs = self.read(filename, observers, transform)
  File "/home/v/progs/fgopt-0.3/bin/coordinates.py", line 321, in read
    o = Object(transform, observers, line)
  File "/home/v/progs/fgopt-0.3/bin/coordinates.py", line 299, in __init__
    self.type, self.path  = splitted[0:2]
ValueError: need more than 0 values to unpack
Traceback (most recent call last):
  File "./fgopt.py", line 239, in onTest
    self.mylist.objs[1].alt += 10.
IndexError: list index out of range
VaLeo
 
Posts: 186
Joined: Wed Nov 29, 2006 11:00 am
Location: Ukraine, Dnipropetrovsk
Version: GIT
OS: Debian 7

Re: FlightGear Object Placement Tool [download first post]

Postby VaLeo » Wed Jan 19, 2011 9:55 pm

radi wrote: What are they supposed to do, BTW?


Converter from MSFS traffic *.conf files to FG' .xml (for using msfs traffic generating programs with FG)
Visual parking - places parking objects from groundnet.xml - nice visualizer to edit park pos
Separator of *.ac file by objects - it need for me to convert MSFS scenery, and another tool to give that object right elevation...
Converter from latest AIRAC data to fix.dat, nav.dat, awy dat :oops:

Later I'll compile my suggestion for your fgopt.
VaLeo
 
Posts: 186
Joined: Wed Nov 29, 2006 11:00 am
Location: Ukraine, Dnipropetrovsk
Version: GIT
OS: Debian 7

Re: FlightGear Object Placement Tool [download first post]

Postby radi » Wed Jan 19, 2011 10:59 pm

VaLeo wrote:In my .stg's I often leave empty lines to separate one part of scenery from another.
An fgopt cant handle this cases, I think:

Fixed in v0.4
http://www.mediafire.com/?07c3txb4dlw0rph

I'm happy to hear suggestions for further development. I've got a pretty long TODO list already, but further input is always welcome.

I might be interested in the .ac seperator tool for my own (X-Plane) scenery conversion works.

another tool to give that object right elevation

Are you aware of find_elevations.pl to query elevation at given lat/lon?
OSM buildings for LOWI, EDDC
Custom scenery for VHXX YMML
Edit .stg via the FG Object Placement Tool
radi
 
Posts: 659
Joined: Mon Aug 25, 2008 5:24 pm
Location: YMML, EDDC

Re: FlightGear Object Placement Tool [download first post]

Postby Farmboy » Sat Jan 22, 2011 12:37 am

Tom,

I jumped in and was able to make it all work, so thank you very much.

One question - being a Mac user I can't find any keystrokes to move the object 1m at a time, and I don't have a number pad. The arrows don't work, and my guesses at key combo's with the arrows don't apply. You may not know either, but if anyone does that'd be great.

Thanks,
Peter
Horsepower is just an illusion. Torque is the true answer.
User avatar
Farmboy
 
Posts: 436
Joined: Wed Jan 14, 2009 11:10 pm
Location: NorthEast New York State, and the rest of New England....

Re: FlightGear Object Placement Tool [download first post]

Postby radi » Sat Jan 22, 2011 6:59 pm

Peter,

great to hear could make it work on a Mac. Did you have to do anything fancy? I guess you had to install wxpython at least?

Unfortunately, I don't have access to a Mac. But I'll release a new version with alternative key bindings tomorrow. If you can't wait, look in gui.py for WXK_NUMPAD* and replace with something like WXK_A for 'a' etc. :wink:
OSM buildings for LOWI, EDDC
Custom scenery for VHXX YMML
Edit .stg via the FG Object Placement Tool
radi
 
Posts: 659
Joined: Mon Aug 25, 2008 5:24 pm
Location: YMML, EDDC

Next

Return to Scenery

Who is online

Users browsing this forum: No registered users and 7 guests