Board index FlightGear Development Scenery

FGBlenderTools - FlightGear Development Tools (Blender)

Questions and discussion about enhancing and populating the FlightGear world.

Re: FGBlenderTools - FlightGear Development Tools (Blender)

Postby xDraconian » Fri Mar 27, 2020 4:52 pm

My AC3D Importer was abandon. We had enough different versions, so I joined with @Necolatis to collaborate on an official version.

I haven't tackled the importing + alignment of airport models yet. Some of the plumbing to support it is already in place, but not yet implemented.
xDraconian
 
Posts: 333
Joined: Sun Jan 21, 2018 5:53 am
Version: Git
OS: Linux Mint

Re: FGBlenderTools - FlightGear Development Tools (Blender)

Postby legoboyvdlp » Fri Mar 27, 2020 9:20 pm

Ok, thank you. Is there anything special to do to export a btg? I attempted deleting the material of AirportArea in order to make some "holes" for the airport. However I am not sure what happened - it appears that I silently failed as there was no visible output. When I tried overwriting the imported file there was no change either but again no error message. This was using the "save" button beside the "load" - I presume that is where exporting is, if not I did not see it elsewhere?
User avatar
legoboyvdlp
 
Posts: 7793
Joined: Sat Jul 26, 2014 1:28 am
Location: Northern Ireland
Callsign: G-LEGO
Version: next
OS: Windows 10 HP

Re: FGBlenderTools - FlightGear Development Tools (Blender)

Postby xDraconian » Fri Mar 27, 2020 10:43 pm

Just make sure you have one of the scenery layers selected. Otherwise, it has no idea what you are trying to save. It pulls the tile id out of the layer name and saves all layers with the same prefix, so don't get too creative with changing the layer names. Making this less ridgid is a future enhancement.
xDraconian
 
Posts: 333
Joined: Sun Jan 21, 2018 5:53 am
Version: Git
OS: Linux Mint

Re: FGBlenderTools - FlightGear Development Tools (Blender)

Postby www2 » Mon Mar 30, 2020 12:58 am

xDraconian thanks for the tool.
But I have a wish list and ideas for improvements
1. I like to see the directory and and xml file as an (sub-) collection.
Image

2. add an global setting for FGROOT path.

3. animation

4. export function
www2
 
Posts: 278
Joined: Thu Apr 16, 2009 1:58 pm
OS: Ubuntu

Re: FGBlenderTools - FlightGear Development Tools (Blender)

Postby legoboyvdlp » Mon Mar 30, 2020 4:37 pm

My issue was I didn't realise it was saving to Blender folder - not trying to overwrite the .btg file!

It now works - and I was able to edit the .btg to fit a new airport into the tile pretty much exactly :)
User avatar
legoboyvdlp
 
Posts: 7793
Joined: Sat Jul 26, 2014 1:28 am
Location: Northern Ireland
Callsign: G-LEGO
Version: next
OS: Windows 10 HP

Re: FGBlenderTools - FlightGear Development Tools (Blender)

Postby xDraconian » Mon Mar 30, 2020 11:18 pm

@legoboyvdlp,
That's great to hear! Thanks for giving FGBlenderTools a try.

@www2,
All very good suggestions.
Subcollections - on my todo list.
FGRoot - If you have it set as an OS environment variable, then FGBlenderTools will pre-populate that field for you.
Animation - on my todo list, but not a focus anytime soon.
Export - BTG export was recently added. You can also convert BTG files into shapefiles. The one big thing not yet exportable is saving back the XML, however, you can save the modified AC3D models.

Some other ideas I want to implement:

Aircraft::
Aircraft Paint - One-click shader generation for fresh paint or weathered paint.
Panel Cutter - Draw where you want an access panel and the script will cut the hole/panel. e.g. Entry doors, Cowling Access Door, Fuel Caps, etc.
Cockpit Panel Layout - Click an asset and where you want it placed and the script handles the alignment.

Scenery::
Scenery Layout - Click an asset and where you want it placed.
Traffic Routes - Visualize and Edit
Shaders - Glass, Lights, etc.

No shortage of ideas - but a big shortage of time.
I'm happy to review pull requests if others wish to help me to expand the functionality of these Blender tools.
xDraconian
 
Posts: 333
Joined: Sun Jan 21, 2018 5:53 am
Version: Git
OS: Linux Mint

Re: FGBlenderTools - FlightGear Development Tools (Blender)

Postby www2 » Tue Mar 31, 2020 2:49 am

@xDraconian
Thanks there is already an add-ons for the Panel Cutter for this call Jmesh or at least is close to you idea
www2
 
Posts: 278
Joined: Thu Apr 16, 2009 1:58 pm
OS: Ubuntu

Re: FGBlenderTools - FlightGear Development Tools (Blender)

Postby ctesc356 » Thu Apr 02, 2020 9:28 am

Hello,
some news...
The export of modified btg scene files works pretty well, with a few minor bugs. We'll come back to that later...

But I can't export airport files.
Even without modification the file is not exported, we get a file <icao>.btg.gz of ~40 bytes with the message:
Warning: Active object is required. Aborting.
output: /home/tt/.config/blender/2.82/terrain/LFIF.btg.gz
Info: BTG export time: 0.0006 seconds
Info: Export successful

There is one active object
Same for a grass airfield or an international airport.

I think I have the updated version of the script? :
git log
commit ef97930cfaa6217be6965c2bf7445cd5a057c538 (HEAD -> master, origin/master, origin/HEAD)
Author: Scott Giese <scttgs0@gmail.com>
Date: Mon Feb 17 21:34:41 2020 -0600
ctesc356
 
Posts: 63
Joined: Wed Aug 25, 2010 8:20 am

Re: FGBlenderTools - FlightGear Development Tools (Blender)

Postby xDraconian » Thu Apr 02, 2020 3:52 pm

Airport BTGs have not been implemented yet. Now that some folks have begun to use the tool, I will begin to work on airport file handling.
xDraconian
 
Posts: 333
Joined: Sun Jan 21, 2018 5:53 am
Version: Git
OS: Linux Mint

Re: FGBlenderTools - FlightGear Development Tools (Blender)

Postby Hooray » Thu Apr 02, 2020 4:04 pm

It would be great if some of the screen shots posted here could be uploaded to the wiki so that they can be added to the FGBlenderTools wiki page at: http://wiki.flightgear.org/FGBlenderTools
While this is currently still a draft obviously, doing so will make it much easier to copy forum announcements over to the wiki page/newsletter and include corresponding screen shots.
Please also feel free to post a few youtube videos here, to illustrate how the tool looks/works - this will ensure that more people will get involved in testing and reporting issues/feature requests, and ultimately get involved in contributing to FlightGear scenery.
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: 11992
Joined: Tue Mar 25, 2008 8:40 am

Re: FGBlenderTools - FlightGear Development Tools (Blender)

Postby ctesc356 » Thu Apr 02, 2020 9:14 pm

xDraconian wrote in Thu Apr 02, 2020 3:52 pm:Airport BTGs have not been implemented yet. Now that some folks have begun to use the tool, I will begin to work on airport file handling.

Okay, thanks for the reply. I'll wait then.
ctesc356
 
Posts: 63
Joined: Wed Aug 25, 2010 8:20 am

Re: FGBlenderTools - FlightGear Development Tools (Blender)

Postby ctesc356 » Wed Apr 08, 2020 9:08 am

Hello,
some findings on the import-export of btg files.

I took as an example the file "Terrain/e000n40/e006n46/3056179.btg.gz" from terrasync.

Import in Blender (v2.82) the original file is 1MB
We get:
Vertices: 40,562.
Faces: 79,478
with weird faces (< 2vertices?) Can we avoid those faces?
Image
image of a section of road.
Selection: 8/2,699 vertex, 11/5,929 edges, 12/5,396 faces.

Export in btg (without any modification), we obtain a file of 1.6MB
If we re-import that file:
Vertices: 135,597.
Faces: 44,199
the weird faces have disappeared, the remaining faces are independent, no common vertex between 2 adjacent faces. This can be remedied by a "vertex merge by distance", but I think the script could do it?
Image
Selection:15/9,666 vertex, 15/9,666 edges, 5/3,222 faces

This re-imported file cannot be exported again. No error message.
ctesc356
 
Posts: 63
Joined: Wed Aug 25, 2010 8:20 am

Re: FGBlenderTools - FlightGear Development Tools (Blender)

Postby xDraconian » Wed Apr 08, 2020 4:22 pm

I'm aware of those and share your desire to improve upon it.
At one point I was clean the model during import, but that slows down import a lot.
I've got some work in progress code to further improve the cleansing of the model on export.

Failing to export a re-imported model is a new issue report... I'll see if I can replicate it.
xDraconian
 
Posts: 333
Joined: Sun Jan 21, 2018 5:53 am
Version: Git
OS: Linux Mint

Re: FGBlenderTools - FlightGear Development Tools (Blender)

Postby ctesc356 » Mon Jun 08, 2020 8:59 am

Hello,
Some progress... or not... :wink:
- for the problem of exporting a re-imported file,
In "fg_btg_io.py" I suppressed the test:
Code: Select all
if not os.path.exists(filename):
        return 

in "def save_btg..." Not very elegant, but now I can export.

I tried to go back to your 4c6458fb version (before "Performance improvement"). The result is good, but indeed, it's a bit long... :(
- So, to get a "clean" mesh, I import, export, re-import and apply "remove doubles" with the following script:
Code: Select all
import bpy

for ob in bpy.context.selected_objects:
    #print(ob.name)
    if ob.type =="MESH":       
        bpy.context.view_layer.objects.active = ob
        print("ACTIVE", bpy.context.active_object.name)       
        bpy.ops.object.mode_set(mode='EDIT')
        bpy.ops.mesh.select_all(action='SELECT')
        bpy.ops.mesh.remove_doubles(threshold=0.03)
        bpy.ops.object.mode_set(mode='OBJECT')

I tried to integrate it in "fg_btg_io.py", but without success... I don't understand why... anyway, we can run it in blender and it does the job.

The modification of the "mesh" and even the "objects" is going well and everything is fine in fg as long as we stay with the textures present in the original btg.
Problems start if you want to add a new object (landclass) with a texture not present in the original one.
Oddly enough it works with some textures, randomly. I respect the "material/texture" couples of "btg_materials.dat", although if I understand correctly, this file is only consulted on import.
I don't understand how the relation material-texture is done in blender (I don't find anything understandable in the bpy docs),
and how it went into the btg structure.
If you can help me solve this texture thing, it would be a welcome advance for my project.
ctesc356
 
Posts: 63
Joined: Wed Aug 25, 2010 8:20 am

Re: FGBlenderTools - FlightGear Development Tools (Blender)

Postby miquelllosas » Mon Jun 15, 2020 6:27 am

Hello,

I imported a btg, modified the scene slightly, and I tried exporting it again but I'm getting the following error:
Code: Select all
Traceback (most recent call last):
  File "/home/miquel/data/blender/2.83/2.83/scripts/addons/io_scene_flightgear/__init__.py", line 414, in execute
    generate_log=True)
  File "/home/miquel/data/blender/2.83/2.83/scripts/modules/bpy/ops.py", line 199, in __call__
    ret = op_call(self.idname_py(), C_dict, kw, C_exec, C_undo)
RuntimeError: Error: Traceback (most recent call last):
  File "/home/miquel/data/blender/2.83/2.83/scripts/addons/io_scene_flightgear/__init__.py", line 352, in execute
    fg_btg_io.save_btg(self.filepath, self.generate_log)
  File "/home/miquel/data/blender/2.83/2.83/scripts/addons/io_scene_flightgear/fg_btg_io.py", line 1208, in save_btg
    extract_from_scene(btg_data)
  File "/home/miquel/data/blender/2.83/2.83/scripts/addons/io_scene_flightgear/fg_btg_io.py", line 970, in extract_from_scene
    radius = serializedOrigin["radius"]
KeyError: 'radius'

location: /home/miquel/data/blender/2.83/2.83/scripts/modules/bpy/ops.py:199



location: <unknown location>:-1


I still get the same error if i import the btg and export it again without changing anything.
I don't really understand what the error is or if I did something wrong, any help would be greatly appreciated :)
miquelllosas
 
Posts: 3
Joined: Sun Jun 14, 2020 5:56 pm
Location: Switzerland
OS: Linux Mint

PreviousNext

Return to Scenery

Who is online

Users browsing this forum: No registered users and 2 guests