Board index FlightGear Development

Blender 2.6 AC3D Importer & Exporter

FlightGear is opensource, so you can be the developer. In the need for help on anything? We are here to help you.
Forum rules
Core development is discussed on the official FlightGear-Devel development mailing list.

Bugs can be reported in the bug tracker.

Re: Blender 2.6 AC3D Importer & Exporter

Postby mr_no » Sun Apr 29, 2012 10:34 am

They replaced faces with polygons.They also created a new uv mapping system.
Mosquito-XE JT-5B-autogyro Extra-300s STOL-Ch701
User avatar
mr_no
 
Posts: 360
Joined: Thu Jan 19, 2012 3:20 pm

Re: Blender 2.6 AC3D Importer & Exporter

Postby mr_no » Sun Apr 29, 2012 12:07 pm

Well here are bugs I had in my importer:
First when setting a smooth face (facesm.use_smooth = True) I needed to use "newmesh.polygons" in :"facesm in newmesh.faces".

Second the uv mapping has changed. You can no longer use uv1 uv2 uv3. I put the new uv maps like this:
Code: Select all
if local_mesh.uv!=[]:
      #Loading UV tex coords
      uvtex1 = newmesh.uv_textures.new()#create uvset
      if uvtex1:
         uvtex = newmesh.uv_layers.active.data[:]
         j=0
         for i in range(len(local_mesh.faces)):
            nb = len(local_mesh.faces[i])

            # triangle or  quad
            if nb >= 3:
               uvtex[j+0].uv = local_mesh.uv[j+0]
               uvtex[j+1].uv = local_mesh.uv[j+1]
               uvtex[j+2].uv = local_mesh.uv[j+2]
            #quad
            if nb == 4:
               uvtex[j+3].uv = local_mesh.uv[j+3]

            j += len(local_mesh.faces[i])

            found = False
            
            if local_mesh.tex_name != "":   
                     imgname = local_mesh.tex_name
                     imgpath = os.path.dirname(path_file_name)  +"/" +imgname
                     img = bpy.data.images.load( imgpath )
                     uvtex1.data[i].image = img
                     found = True


Note that I don't import ngons. I have a bit of code that converts them to triangles together with their uv maps.

That's all for the importer. It works so far. Later I'll take a look at the exporter. Needless to say it has bugs.
Mosquito-XE JT-5B-autogyro Extra-300s STOL-Ch701
User avatar
mr_no
 
Posts: 360
Joined: Thu Jan 19, 2012 3:20 pm

Re: Blender 2.6 AC3D Importer & Exporter

Postby mr_no » Sun Apr 29, 2012 2:16 pm

Blender 2.63 has ngons, bevel, vertex connect, vertex slide and lets not forget the new improved knife tool. 8)
Mosquito-XE JT-5B-autogyro Extra-300s STOL-Ch701
User avatar
mr_no
 
Posts: 360
Joined: Thu Jan 19, 2012 3:20 pm

Re: Blender 2.6 AC3D Importer & Exporter

Postby helijah » Sun Apr 29, 2012 3:55 pm

AAAAHHHH The new knife tool :)
Image
Image

Regards Emmanuel
Some planes (and other) for FlightGear
http://helijah.free.fr
and
http://embaranger.free.fr
User avatar
helijah
 
Posts: 1339
Joined: Wed Dec 27, 2006 1:35 pm
Location: Chartres (France)
Callsign: helijah
IRC name: helijah
Version: GIT
OS: GNU/Linux

Re: Blender 2.6 AC3D Importer & Exporter

Postby mr_no » Sun Apr 29, 2012 7:41 pm

Looks like a duck! :mrgreen:
Also there are: insert faces, dissolve, edge collapse and edge slide. Very useful.
Now Blender has matured into a really powerful tool.
Mosquito-XE JT-5B-autogyro Extra-300s STOL-Ch701
User avatar
mr_no
 
Posts: 360
Joined: Thu Jan 19, 2012 3:20 pm

Re: Blender 2.6 AC3D Importer & Exporter

Postby El Flauta » Sun Apr 29, 2012 8:05 pm

Image
Vive FlightGear! Have you a Ñ on your keyboard? Spain-LatinAmerica FlightGear community!
--
PZL M18B Dromader
CASA C-101 Aviojet
Cessna 337G Skymaster
User avatar
El Flauta
 
Posts: 426
Joined: Fri Mar 14, 2008 1:09 am
Location: SCVM, Chile
Callsign: CC-FLT
Version: 3
OS: Windows 7 SP1

Re: Blender 2.6 AC3D Importer & Exporter

Postby helijah » Thu May 03, 2012 12:55 pm

No news for 2.63 ?

Regards Emmanuel
Some planes (and other) for FlightGear
http://helijah.free.fr
and
http://embaranger.free.fr
User avatar
helijah
 
Posts: 1339
Joined: Wed Dec 27, 2006 1:35 pm
Location: Chartres (France)
Callsign: helijah
IRC name: helijah
Version: GIT
OS: GNU/Linux

Re: Blender 2.6 AC3D Importer & Exporter

Postby TheTom » Thu May 03, 2012 3:43 pm

Exporting works without problems. I haven't found any time for the importer yet. If you need importing now, you could import in an older version of blender and import the .blend with Blender 2.63.
TheTom
 
Posts: 322
Joined: Sun Oct 09, 2011 11:20 am

Re: Blender 2.6 AC3D Importer & Exporter

Postby helijah » Thu May 03, 2012 6:09 pm

Oh ok :) Thank TheTom,

Import is less important that export (for me :) ). But I had to do something wrong :( I did not export texture :

git clone https://github.com/majic79/Blender-AC3D.git
cd Blender-AC3D
git checkout bl-svn
git pull

and copy io_scene_ac3d in .blender/2.63/scripts/addons/

What is my mistake ?

Regards Emmanuel
Some planes (and other) for FlightGear
http://helijah.free.fr
and
http://embaranger.free.fr
User avatar
helijah
 
Posts: 1339
Joined: Wed Dec 27, 2006 1:35 pm
Location: Chartres (France)
Callsign: helijah
IRC name: helijah
Version: GIT
OS: GNU/Linux

Re: Blender 2.6 AC3D Importer & Exporter

Postby TheTom » Thu May 03, 2012 6:47 pm

Strange. Can't see any mistake. Does it create an error or is just the model incomplete? For me exporting textures still works. Maye you can give me the .blend which doesn't work...
TheTom
 
Posts: 322
Joined: Sun Oct 09, 2011 11:20 am

Re: Blender 2.6 AC3D Importer & Exporter

Postby pjedvaj » Thu May 03, 2012 7:09 pm

Have you tried to enable/disable Export/Import AC3D in File>User Preferences>Addons?
Retired
User avatar
pjedvaj
 
Posts: 682
Joined: Thu Mar 18, 2010 9:32 pm

Re: Blender 2.6 AC3D Importer & Exporter

Postby TheTom » Thu May 03, 2012 8:03 pm

I've pushed a new version which also imports materials and textures. For me it works, but there can be problems with more then 4 vertices per face and just edges without faces.
TheTom
 
Posts: 322
Joined: Sun Oct 09, 2011 11:20 am

Re: Blender 2.6 AC3D Importer & Exporter

Postby helijah » Thu May 03, 2012 10:17 pm

TheTom wrote in Thu May 03, 2012 8:03 pm:I've pushed a new version which also imports materials and textures. For me it works, but there can be problems with more then 4 vertices per face and just edges without faces.


Wow ! Fantastic ! Import work fine (just, for me, not for faces with 2 vertices, but it is not very serious :)

TheTom, you are my savior !

Regards Emmanuel
Some planes (and other) for FlightGear
http://helijah.free.fr
and
http://embaranger.free.fr
User avatar
helijah
 
Posts: 1339
Joined: Wed Dec 27, 2006 1:35 pm
Location: Chartres (France)
Callsign: helijah
IRC name: helijah
Version: GIT
OS: GNU/Linux

Re: Blender 2.6 AC3D Importer & Exporter

Postby mr_no » Thu May 03, 2012 11:29 pm

I've got a working code for all of that. If you need any tips ask. For exporting ngons' uv maps I needed to rewrite exporting uvmaps.
Mosquito-XE JT-5B-autogyro Extra-300s STOL-Ch701
User avatar
mr_no
 
Posts: 360
Joined: Thu Jan 19, 2012 3:20 pm

Re: Blender 2.6 AC3D Importer & Exporter

Postby mr_no » Fri May 04, 2012 6:27 pm

I've managed to import and export ngons as well as normal edges and everything else.
If you want to check it out you can get it here:
mr_no_blender263_AC3D_04052012.zip
That's what I use for my work.
Mosquito-XE JT-5B-autogyro Extra-300s STOL-Ch701
User avatar
mr_no
 
Posts: 360
Joined: Thu Jan 19, 2012 3:20 pm

PreviousNext

Return to Development

Who is online

Users browsing this forum: No registered users and 12 guests