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 benih » Wed Aug 16, 2017 8:05 pm

Ok, i run into another problem.
I was able to import an existing .ac file but when i try to export it it is only 66 bytes long. Is this a problem with my model or do i something wrong?

my modified version as blender file:
https://github.com/hbeni/c182s/blob/liv ... mmat.blend
benih
 
Posts: 94
Joined: Tue Aug 15, 2017 9:34 am

Re: Blender 2.6 AC3D Importer & Exporter

Postby Necolatis » Wed Aug 16, 2017 8:30 pm

That blend file seem corrupt or something. I cannot click on the mesh icon in the explorer window, so something is off. But the geometry shows fine.

Could you link me the ac file you imported?
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore


Hangar: https://sites.google.com/site/fghangar/
User avatar
Necolatis
 
Posts: 1860
Joined: Mon Oct 29, 2012 12:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2018.2.2
OS: Windows 10 Pro

Re: Blender 2.6 AC3D Importer & Exporter

Postby benih » Wed Aug 16, 2017 9:09 pm

Yes, it is the one from the c172p: https://github.com/c172p-team/c172p-det ... t/immat.ac

What i did:
- Made new file in blender (fresh start)
- deleted camera, sun and initial cube objects
- imported the inmat.ac
- switched to other layers and imported the airplane and interior models for reference
- transformed the inmat objects to the correct positions and angles
- deleted the objects of the other layers
- tried the export wit no success
benih
 
Posts: 94
Joined: Tue Aug 15, 2017 9:34 am

Re: Blender 2.6 AC3D Importer & Exporter

Postby Necolatis » Wed Aug 16, 2017 10:31 pm

Okay, its the layer thing that makes the export go wrong.

If you check off "Only render layers" in export options it exports.
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore


Hangar: https://sites.google.com/site/fghangar/
User avatar
Necolatis
 
Posts: 1860
Joined: Mon Oct 29, 2012 12:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2018.2.2
OS: Windows 10 Pro

Re: Blender 2.6 AC3D Importer & Exporter

Postby benih » Thu Aug 17, 2017 7:38 pm

Confirmed, it works and loads correctly in flightgear now.
Thank you very much!
benih
 
Posts: 94
Joined: Tue Aug 15, 2017 9:34 am

Re: Blender 2.6 AC3D Importer & Exporter

Postby Necolatis » Tue Oct 03, 2017 1:41 am

The add-on is now at version 2.20.

Changelog since 2.14
Pruned import options. If this bothers anyone please let me know.
Importer: If no crease angle is set, Object smooth will now also not be set.
Exported lines will now inherit double-sided flag from object.
Fixed that exporter would sometimes export extra lines when 'export lines' option was checked.
When exporting lines they will now only have the DefaultWhite material if their Blender object has more or less than 1 material.
Importer will now, after import, make only all top-level objects that was imported selected.
Exporter: remove trailing zeros when outputting floats and doubles to keep file-size down.
Exporter: Fixed runtime error if texture was not found, even though Blender has proper path to not present texture.
Export: Added option: Amb same as Diff. It will set ambient color same as diffuse.
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore


Hangar: https://sites.google.com/site/fghangar/
User avatar
Necolatis
 
Posts: 1860
Joined: Mon Oct 29, 2012 12:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2018.2.2
OS: Windows 10 Pro

Re: Blender 2.6 AC3D Importer & Exporter

Postby abassign » Mon Oct 23, 2017 8:13 am

Import names with spaces

Freecad, when converting a file in mesh to export it with .obj format and then with Blender obtaining a definitive .ac file, adds the text " (Meshed)" to the bottom of the converted object name.
The .ac format correctly supports file names with spaces, exports them smoothly, and is handled correctly by FGFS. But if we run the reverse operation, or by .ac we want to import them into Blender, the "Blender-AC3D" converter truncates object names, making it impossible a correct re-export to .ac format.

The reason is in the way in which parsing is followed.

I think the best solution is to rebuild the correct name in the function that extracts the object name. I would not do otherwise, otherwise much code would have to be modified, with a likely slowdown in import.

I solved this problem by changing the code of the "name" token reading method:

This is the original code found in https://github.com/majic79/Blender-AC3D/blob/master/io_scene_ac3d/import_ac3d.py
Code: Select all
   def read_name(self, ac_file, toks):
     self.name=toks[1].strip('"')
     return False

I change the code in this form:
Code: Select all
  def read_name(self, ac_file, toks):
    sizeToks = len(toks)
    self.name = toks[1].strip('"')
    if (sizeToks) > 2:
      for i in range(sizeToks - 2):
        self.name += " " + toks[i + 2].strip('"')
    return False


Now it works properly :)
I think it's a useful change to include in AC3D code.
abassign
 
Posts: 725
Joined: Mon Feb 27, 2012 5:09 pm
Location: Italy (living 5 Km from airport LIME)
Callsign: I-BASSY
Version: 2018.3
OS: Linux Mint 19. x

Re: Blender 2.6 AC3D Importer & Exporter

Postby Necolatis » Mon Oct 23, 2017 5:37 pm

"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore


Hangar: https://sites.google.com/site/fghangar/
User avatar
Necolatis
 
Posts: 1860
Joined: Mon Oct 29, 2012 12:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2018.2.2
OS: Windows 10 Pro

Re: Blender 2.6 AC3D Importer & Exporter

Postby qman787 » Sun Nov 19, 2017 6:51 pm

Hello,

I've got the following problem.
After the model has been exported from Blender 2.79 as .ac there seem to be no smoothing information (Face-Normals are gone)
Is there any way to preserve smoothing groups information while exporting with the script?
qman787
 
Posts: 2
Joined: Sun Nov 19, 2017 6:35 pm

Re: Blender 2.6 AC3D Importer & Exporter

Postby Necolatis » Sun Dec 31, 2017 11:47 am

AC3D does not support normal directly. Only indirect by making a face clockwise or counter-clockwise.

That being said that's probably not your problem.

Smoothing should work fine though. Can you explain what you do in Blender with regards to smoothing, Blender supports several ways of doing that. Do you use cycles or anything like that?

Do you use the latest version of the script (version 2.23)?
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore


Hangar: https://sites.google.com/site/fghangar/
User avatar
Necolatis
 
Posts: 1860
Joined: Mon Oct 29, 2012 12:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2018.2.2
OS: Windows 10 Pro

Re: Blender 2.6 AC3D Importer & Exporter

Postby wlbragg » Wed May 09, 2018 6:15 pm

Question about .group as it pertains to the export script.
Background: the c172p used to use .group in some of the instruments for a pick animation. Anything in that group could be part of the pick simply by using the group name.
It appears that functionality was removed at some point in time?
I would appreciate a little history lesson if anyone knows and possibly how the original .group hierarchy was or is supposed to work?

From the c172p dev thread, quote from me...
I think some of this malfunction is due to the exporter being used is not supporting the .group function. Both the toggle switch and its base were in a group called PowerSwitch. So I think both PowerSwitch.Lever and PowerSwitch.Base were acting as PowerSwitch in that particular pick code block. I don't like the idea of having to use an "older" .AC importer to export our .ac files. Over time new functionality is added to the current AC exporter and it would be of no benefit if we have to use an antiquated .ac exporter. I am curious though as to why this functionality was removed from the import/export script in the first place?
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
User avatar
wlbragg
 
Posts: 4076
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Debain/nVGT640

Re: Blender 2.6 AC3D Importer & Exporter

Postby Necolatis » Wed May 09, 2018 6:28 pm

The current exporter supports groups.

When you say '.group', what do you mean? why do you prefix it with a dot?

If you have a plane like:

Code: Select all
mainstuff/fuselage
          tail
otherstuff/gear1
           gear2


So 2 groups called mainstuff and otherstuff.

Say you want to apply a livery on fuselage and tail. All you have to do is apply it on mainstuff. More efficient, and less code.
That works fine.

Not sure about pick though, never tried that on a group.

Are you sure you did not rearrange the hierachy in blender and thereby lost the groupings that was used for the pick?

If you show me the blender file and tell me the name of the group, maybe I can take a look, and see if its name is exported correctly.
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore


Hangar: https://sites.google.com/site/fghangar/
User avatar
Necolatis
 
Posts: 1860
Joined: Mon Oct 29, 2012 12:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2018.2.2
OS: Windows 10 Pro

Re: Blender 2.6 AC3D Importer & Exporter

Postby wlbragg » Wed May 09, 2018 6:56 pm

Ah, I think figured it out. It must have been an older naming convention. The Blend group was named PowerSwitch.group. The xml used only PowerSwitch. There were two objects in the PowerSwitch.group, PowerSwitch.Lever and PowerSwitch.Base respectively. If I rename the group heading in the Blend to PowerSwitch then the xml pick using PowerSwitch as the group name for PowerSwitch.Lever and PowerSwitch.Base works.
I guess it was simply an .ac legacy issue.

Thanks for helping me clear this up.
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
User avatar
wlbragg
 
Posts: 4076
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Debain/nVGT640

Re: Blender 2.6 AC3D Importer & Exporter

Postby WoodSTokk » Thu May 31, 2018 11:46 pm

I have updated my Debian testing/sid and now i have Blender 2.79.
Is it possible to install the AC3D Im-/Exporter in Blender 2.79, or should i downgrade to Blender 2.78 ?
WoodSTokk
 
Posts: 52
Joined: Tue Oct 17, 2017 2:30 pm
Location: Milky Way/Sol/Earth/Europe
Callsign: OE-WST
IRC name: WoodSTokk
Version: 2018.2.2
OS: Debian Buster/Sid

Re: Blender 2.6 AC3D Importer & Exporter

Postby Necolatis » Fri Jun 01, 2018 12:11 am

It works in 2.79 also.
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore


Hangar: https://sites.google.com/site/fghangar/
User avatar
Necolatis
 
Posts: 1860
Joined: Mon Oct 29, 2012 12:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2018.2.2
OS: Windows 10 Pro

PreviousNext

Return to Development

Who is online

Users browsing this forum: No registered users and 1 guest