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 Necolatis » Mon Jan 30, 2017 10:00 pm

Sorry this took awhile, had trouble with my HD.

Works for me in Blender 2.78a
"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: 1872
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 whitav8 » Mon Mar 06, 2017 6:43 pm

I am trying to import AC3D (latest from github file dates 10/21/2016) - into Blender 2.78a and it seems to be installed correctly but when I try to import an AC format model, I get the following error:(I have tried several AC models):
============================================================================================
Traceback (most recent call last):
file "E:/...blender installation location...\2.78\scripts\addons\io_scene_ac3d\_init_.py" line 171, in execute
import_ac3d.ImportAC3D(self,context,**keywords)
file "E:/...blender installation location...\2.78\scripts\addons\io_scene_ac3d\import_ac3d.py" line 697, in _init_self.create_blender_data()
file "E:/...blender installation location...\2.78\scripts\addons\io_scene_ac3d\import_ac3d.py" line 795, in create_blender_data
obj.create_blender_object(self.matlist,"",bUseLink)
............line 489 and then line 374

Attribute Error 'NoneType' object has no attribute parent

location <unknown location>
==============================================================================================
I have a Windows 10 PC
Thanks for any help!!

Dave

NOTE: If it matters/ I don't have Blender installed on the C:\Program Files but on a separate harddrive folder
whitav8
 
Posts: 4
Joined: Mon Mar 06, 2017 6:22 pm

Re: Blender 2.6 AC3D Importer & Exporter

Postby Necolatis » Mon Mar 06, 2017 8:44 pm

Could you give me an example AC file that produce this error? Maybe upload it somewhere, so I can have a look.
"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: 1872
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 whitav8 » Mon Mar 06, 2017 9:39 pm

Thanks much for the very quick response!! Here are a couple of the files - a simple Cessna 172 and a much more complicated DR400: They both load into AC3D 8.0.5a just fine.
from my OneDrive:

DR 400: https://1drv.ms/u/s!Ah-GN1pAHAEHiExkXQktagS7atDD


Cessna: https://1drv.ms/u/s!Ah-GN1pAHAEHiE1yd3y3RkmZ_NiQ

Could you send me an AC file that works for you? Thanks very much!

Dave
====================================

Here is how the Cessna file begins:
AC3Db
MATERIAL "mat0" rgb 0.800000011920929 0.800000011920929 0.800000011920929 amb 0.800000011920929 0.800000011920929 0.800000011920929 emis 0 0 0 spec 0 0 0 shi 0 trans 0
MATERIAL "mat1" rgb 1 1 1 amb 1 1 1 emis 0 0 0 spec 0 0 0 shi 0 trans 0
MATERIAL "mat2" rgb 1 1 1 amb 1 1 1 emis 0 0 0 spec 0 0 0 shi 0 trans 0
OBJECT WORLD
rot 1 0 0 0 0 1 0 -1 0
kids 3
OBJECT POLY
rot 1.00000 0.00000 0.00000 0.00000 1.00000 0.00000 0.00000 0.00000 1.00000
loc 0.00000 0.00000 0.00000
numvert 163
0.00000 5.01200 1.19600
-0.00800 5.01200 1.18800
-0.00400 5.01200 1.19600
-0.01200 5.01200 1.18000
-0.01200 5.01200 1.17200
-0.01200 5.01200 1.16400
-0.00800 5.01200 1.15600
...................
whitav8
 
Posts: 4
Joined: Mon Mar 06, 2017 6:22 pm

Re: Blender 2.6 AC3D Importer & Exporter

Postby Necolatis » Tue Mar 07, 2017 2:08 am

Yes, the token after OBJECT should be lowercase, to adhere to specification.
But I will change script so it will ignore case for that. That will make it able to load it.

The second problem is though that the 'rot' under world is not applied in the script, so the plane will be rotated wrong when opening it in Blender.
I am working on that, hopefully have something in the next days that works.

Did not look at the DR400 yet.
"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: 1872
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 whitav8 » Tue Mar 07, 2017 6:07 am

Thanks much for the help - that seems to fix a lot of it.

Dave
whitav8
 
Posts: 4
Joined: Mon Mar 06, 2017 6:22 pm

Re: Blender 2.6 AC3D Importer & Exporter

Postby Necolatis » Tue Mar 07, 2017 7:49 pm

Okay, I have made sort of a release candidate. There were so many changes to how matrices are applied and such that I am not sure it has not broken some use cases.

I must say those 2 models you had, seemed to to reveal many things that the script had trouble with. For instance the dr400 has scaling in its rotation matrix, which strickly spoken, I think is not supported in the AC3D standard. But nevermind, I have now build in support for that too, also the OpenSceneGraph eats it also.

Changelog:
Fixed if importing would encounter a uppercase OBJECT token, it would fail.
Fixed if world OBJECT has loc/rot specified, it should now be proper applied.
Exporting no longer applies the rotations of groups before exporting, they are now exported as they are.
The export option for what kind of coordinate system is requested in export options will now no longer be applied to each mesh, but instead be set into world OBJECT.
Since the other approach was flawed this now should be better way of applying world rot/loc to top-level groups.
Import now uses matrix calc to set location and rotation, in order to also import scale.
If negative scaling is detected when importing, it will now be applied so that normals don't get flipped.
Importing: Delay applying negative scaling till full scene is loaded.



You can try it out here, please report any issues: (notice this link is not the usual link)

https://github.com/NikolaiVChr/Blender-AC3D/tree/importWorldWithMatrix
"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: 1872
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 whitav8 » Wed Mar 08, 2017 5:47 am

Your newest version seems to work fine with my dr400 model - thanks much and I hope this might help other folks.

Dave
whitav8
 
Posts: 4
Joined: Mon Mar 06, 2017 6:22 pm

Re: Blender 2.6 AC3D Importer & Exporter

Postby Necolatis » Sat Mar 11, 2017 11:26 pm

I did some further updates to that branch:

Changelog Part 2
Enable use of Blenders Diffuse Intensity.
Make use of full 0-2 range of Blenders' Emit.
Importer now supports AC3D fileformat version 12. (header: 'AC3Dc') This came with Inivis AC3D 8.0
Export: Packed textures are now saved smarter at export, and will be in PNG format.
Export: Parent inverse matrix is now accounted for when children are written.
Export: If a materials texture coord is not set to UV at time of export, it will still be exported as UV. (might not always work, best to use UV when making your Blender model)
Export: Added option to export hidden objects. (newer AC3D feature, not supported in many old loaders)
Remove redundant matrix operations.
Importer now reads matrices the correct Inivis way.
Exporter now write matrices the correct Inivis way.
Exporter: added export option if matrices should be output or applied. (use applied for Flightgear, since Flightgear interprets the matrices wrongly)
Increased default crease angle to 40 degrees.
The scrips now supports import and export of lamps.
Export default is now not to merge materials.
Exporter will no longer export DefaultWhite unless needed.
Exporter will now round material values to 3 decimals instead of 4, to make the lines shorter. (and who needs to specify a color with 10000 fraction precision anyway..)
Importer now supports the 'subdiv' token.

Unless some bugs are found, I will soon merge that branch into regular master branch.

Edit: Added more more commits.
Last edited by Necolatis on Mon Mar 13, 2017 12:42 am, edited 1 time in total.
"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: 1872
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 Necolatis » Sun Mar 12, 2017 11:52 pm

I have compiled an expanded version of the AC3D file format guide for those of you that like to tinker directly with the files:

https://sites.google.com/view/ac3dfileformat/home
"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: 1872
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 Necolatis » Tue Mar 14, 2017 4:53 am

The script (master branch) is now updated to version 2.14.

Some things to notice:
    Import: If an object has no crease angle in AC3D, Object smooth will no longer be set.
    Import: There are now less import options, if I removed your favorite option and you want it back, let me know.
    Import: If objects are hidden in the AC3D file, they will now always also be hidden after import into Blender.
    Import: Can now handle the new version 12 AC3Dc format. (the exporter will always write AC3Db though.)
    Export: Diffuse intensity is now multiplied to the diffuse color before export. For example white color, and intensity of 0.8 will result in rgb 0.8 0.8 0.8

Full changelog since last stable:
Fixed if importing would encounter a uppercase OBJECT token, it would fail.
Fixed if world OBJECT has loc/rot specified, it should now be proper applied.
Exporting no longer applies the rotations of groups before exporting, they are now exported as they are.
The export option for what kind of coordinate system is requested in export options will now no longer be applied to each mesh, but instead be set into world OBJECT.
Since the other approach was flawed this now should be better way of applying world rot/loc to top-level groups.
Import now uses matrix calc to set location and rotation, in order to also import scale.
If negative scaling is detected when importing, it will now be applied so that normals don't get flipped.
Importing: Delay applying negative scaling till full scene is loaded.
Enable use of Blenders Diffuse Intensity.
Make use of full 0-2 range of Blenders' Emit.
Importer now supports AC3D fileformat version 12. (header: 'AC3Dc') This came with Inivis AC3D 8.0
Export: Packed textures are now saved smarter at export, and will be in PNG format.
Export: Parent inverse matrix is now accounted for when children are written.
Export: If a materials texture coord is not set to UV at time of export, it will still be exported as UV. (might not always work, best to use UV when making your Blender model)
Export: Added option to export hidden objects. (newer AC3D feature, not supported in many old loaders)
Remove redundant matrix operations.
Importer now reads matrices the correct Inivis way.
Exporter now write matrices the correct Inivis way. (sadly this is not the same way that Flightgear interprets them)
Exporter: added export option if matrices should be output or applied. (use 'applied' for Flightgear, since OpenSceneGraph interprets the matrices wrongly, a bug report has been filed to them)
Increased default crease angle to 40 degrees.
The scrips now supports import and export of lamps.
Export default is now not to merge materials.
Exporter will no longer export DefaultWhite unless needed.
Exporter will now round material values to 3 decimals instead of 4, to make the lines shorter. (and who needs to specify a color with 10000 fraction precision anyway..)
Importer now supports the 'subdiv' token. It will apply a SubSurf modifier (non applied). Exported files will have such modifiers applied though.
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.
"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: 1872
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 » Tue Aug 15, 2017 9:42 am

Hi there,
i try to get into modelling with blender.

However i face a installation problem on debian stretch that i cannot solve myself.

When i copy the python files to the desired locations, i cannot activate the module in the dialog. The entry "Import-Export: AC3D (.ac)" is not shown at all.
I also tried zipping the files and "install from ZIP" but with the same result.

I followed the instructions on https://github.com/NikolaiVChr/Blender-AC3D

My versions are:
Code: Select all
beni@segin:~$ blender -v
Blender 2.78 (sub 0)

beni@segin:~$ apt-cache show blender | grep Version
Version: 2.78.a+dfsg0-4

beni@segin:~$ uname -a
Linux segin 4.9.0-3-amd64 #1 SMP Debian 4.9.30-2+deb9u3 (2017-08-06) x86_64 GNU/Linux

beni@segin:~$ grep ^deb /etc/apt/sources.list
deb http://ftp.de.debian.org/debian/ stretch main contrib non-free
deb http://security.debian.org/ stretch/updates main contrib non-free


What am i doing wrong and how can i solve this? Thank you very much
benih
 
Posts: 96
Joined: Tue Aug 15, 2017 9:34 am

Re: Blender 2.6 AC3D Importer & Exporter

Postby Necolatis » Wed Aug 16, 2017 3:29 am

I do not use Linux so cannot help you much.

But I do remember others having trouble in linux and getting help.
If you search this topic for "linux install" or something similar I think you will find some help.
"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: 1872
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 Aug 16, 2017 3:42 am

In Linux Debian I simply copy the io_scene_ac3d folder into
/usr/share/blender/scripts/addons/
folder and then open the Blender file/user preferences - addons tab and activate the import/export script by checking the check box.

I'm on Blender v2.78
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
User avatar
wlbragg
 
Posts: 4183
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 benih » Wed Aug 16, 2017 7:06 pm

Thank you wlbragg, that did the trick!

Some intermediate install attempt tried to link the plugin sources with a symlink instead of a direct copy.
It looks like blender does not follow links here (probably for safety reasons to avoid executing of arbitary python code through symlink attack)
benih
 
Posts: 96
Joined: Tue Aug 15, 2017 9:34 am

PreviousNext

Return to Development

Who is online

Users browsing this forum: No registered users and 12 guests