Board index FlightGear Development

W.I.P. Blender to flightgear

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.

W.I.P. Blender to flightgear

Postby run » Fri Jul 06, 2012 5:38 pm

Hi all,

WIP for using blender for flightgear


http://vimeo.com/45318433
run
 
Posts: 17
Joined: Fri Jul 06, 2012 2:03 pm

Re: W.I.P. Blender to flightgear

Postby TheTom » Fri Jul 06, 2012 10:53 pm

Great work! Looks like I'm not the only one who doesn't want to to everything by hand :) I'm currently also working on a Blender script but the other way round to export animations from Blender to FlightGear...
TheTom
 
Posts: 322
Joined: Sun Oct 09, 2011 10:20 am

Re: W.I.P. Blender to flightgear

Postby mr_no » Sat Jul 07, 2012 12:06 am

Too bad flightgear doesn't support bone animations. Things would be so much easier for designers.
Mosquito-XE JT-5B-autogyro Extra-300s STOL-Ch701
User avatar
mr_no
 
Posts: 362
Joined: Thu Jan 19, 2012 2:20 pm

Re: W.I.P. Blender to flightgear

Postby Hooray » Sat Jul 07, 2012 1:42 am

really impressive!
Please feel invited to add your project to the wiki, or at least to the upcoming FlightGear newsletter (see my signature).
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: 11925
Joined: Tue Mar 25, 2008 8:40 am

Re: W.I.P. Blender to flightgear

Postby run » Sat Jul 07, 2012 1:48 am

The next step is export mesh and bone animation into flightgear.

Two months ago, I made a script (just for me) to export a x-plane fighter with animations into flightgear.
Now, with help of PAF, french plane designer, I write this script. It's the beginning. I make a algorithm to convert parent link in blender, to flightgear animation. I think it's more important to have a good tool for designer, write manualy some xml file it's not the good way.
For FDM, ok you can write xml file, but for 3D meshes, blender is better, more better. I don't know flightgear, but I have a goog knowledge of blender. I'm sure, we can convert blender to a good tools for flightgear. And also blender is a open-source software and a very good software.

Now , with the script the flightgear parameters are save. For example, some new property are present.
bpy.data.objects['Bone'].data.fg.factor
bpy.data.objects['Bone'].data.fg.property=".......
bpy.data.objects['Bone'].data.fg.ac_file="......
And convert keyframe into flightgear interpolation.

Sorry for my bad bad english ...
Bye

Image
Image
Image
run
 
Posts: 17
Joined: Fri Jul 06, 2012 2:03 pm

Re: W.I.P. Blender to flightgear

Postby TheTom » Sat Jul 07, 2012 9:35 am

My plugin is also heavy work in progress, but I have now also uploaded it: https://github.com/tomgey/blender-io_scene_fdm Maybe it helps you :) Currently it is possible to export animations driven by drivers and also automatically create gear spin and strut compression animations and ground_reactions configuration for JSBSim.
TheTom
 
Posts: 322
Joined: Sun Oct 09, 2011 10:20 am

Re: W.I.P. Blender to flightgear

Postby run » Sat Jul 07, 2012 11:51 am

Hi all,

Code: Select all
   if comp.type != 'LIMIT_LOCATION':
      return 'Warning: Wrong type for compression limit...'
   
   if not (       not comp.use_min_x and not comp.use_max_x
                and not comp.use_min_y and not comp.use_max_y
                and       comp.use_min_z and       comp.use_max_z ):
      return 'Warning: Only use z-axis!'
   


Like you, I use 'LIMIT_LOCATION' constraint, but I use 'Local space'. In this space, the axis are always Y. In rotation Y value, is alway the angle around the axis, and in translation, Y value is the translation value. In rotation I use EulerXYZ mode not quaternion. It's a raison, why I create a pop-up menu for creating rotation and translation Armature bone. With this menu I add constraint and rotation mode to the bone, and you can work to your plane with free-mind.

Maybe if we finish own project, we can merge the scripts, in one.

It's important to think, about the name, to avoid collision name. For example, now we have the same name for the panel. :D
The link for my script is in vimeo link:
https://gitorious.org/paf/fg2blender


Bye
run
 
Posts: 17
Joined: Fri Jul 06, 2012 2:03 pm

Re: W.I.P. Blender to flightgear

Postby TheTom » Sat Jul 07, 2012 10:33 pm

run wrote in Sat Jul 07, 2012 11:51 am:Like you, I use 'LIMIT_LOCATION' constraint, but I use 'Local space'. In this space, the axis are always Y. In rotation Y value, is alway the angle around the axis, and in translation, Y value is the translation value. In rotation I use EulerXYZ mode not quaternion.

I also use local space and XYZ euler ;) But why do you limit to the y-axis? Eg. for the landing gear the strut compresses in z direction.

You have definitely some good ideas which I'd also like to use (eg. the property selection is really well done). After exploring the possibilities creating a single addon seems like a good idea :)
TheTom
 
Posts: 322
Joined: Sun Oct 09, 2011 10:20 am

Re: W.I.P. Blender to flightgear

Postby run » Sat Jul 07, 2012 11:50 pm

Hi Tom,

TheTom wrote in Sat Jul 07, 2012 10:33 pm:But why do you limit to the y-axis? Eg. for the landing gear the strut compresses in z direction.


Because, you have the vector with the bone. V = tail-head
And, in the local space Y it's the good value. Your translation vector is only tr = (delta Y) * V
It's more simply for designer, and simply is bettter. If you normalize the vecteur, Y can be inch, meter, or what you want !

Remember, I am, definitely, not a specialist of flightgear

The designer use blender with 3D cursor, and (SHIFT-S) tools. He set up the bone in the space. Use keyframe, in "pose mode". And the script compute the differents values.

Bye
run
 
Posts: 17
Joined: Fri Jul 06, 2012 2:03 pm

Re: W.I.P. Blender to flightgear

Postby mr_no » Sun Jul 08, 2012 1:41 pm

Notice, if you are dealing with YASim, coordinates must be rotated 180 degrees around Z axis.
Mosquito-XE JT-5B-autogyro Extra-300s STOL-Ch701
User avatar
mr_no
 
Posts: 362
Joined: Thu Jan 19, 2012 2:20 pm

Re: W.I.P. Blender to flightgear

Postby run » Thu Jul 12, 2012 2:03 pm

Thanks, mr_no


Now , I post a screen-capture, it's the begnning of export

At the left side the new xml file, and in th right side the original xml_file


Image

Image
run
 
Posts: 17
Joined: Fri Jul 06, 2012 2:03 pm

Re: W.I.P. Blender to flightgear

Postby run » Fri Jul 13, 2012 11:26 pm

run
 
Posts: 17
Joined: Fri Jul 06, 2012 2:03 pm

Re: W.I.P. Blender to flightgear

Postby xiii » Sat Jul 14, 2012 12:59 am

Hi run,

Very impressive ! I wish I could learn blender as fast as I model landing gears kinematics with some circles in AC3D, a clever grouping and a pen writing the back side of an envelope :-) I'm a bit "old school".

But well, with parents and children bones and then auto generated XML, this look like a wonderful tool. For me using it would also add something great that AC3D hasn't: no need to fire FG to check every little change in the kinematics. (xiii once again pondering learning blender...) I tried starting a tutorial several tine but was afraid by the complexity of the GUI (you know, a pen and an envelope...)

Anyway, here a nice (yet another) drawing of the E-2C main gear so we can remember the good ol' times :-)

Image

And about bones for mr_no:
Grouping objects following the 'hierachy' (in AC3D or with xml goups) does the trick quite simply. Move the group Whole_System, so the group Sub_System axis is/are also moved in the animation tree, and then you can move the group Sub_System relatively to its parent, Whole_System, that is in its already moved frame.... I wonder if this is clear enough :-D

Anyway, it is late here, cheers,

Alexis
If the engines are Pratt and Whitney, the seats best be Martin Baker
xiii
 
Posts: 472
Joined: Tue Jan 08, 2008 10:04 pm

Re: W.I.P. Blender to flightgear

Postby F-JJTH » Sat Jul 14, 2012 11:32 am

This script is fabulous ! Now we can read and create FlightGear animation without FlightGear. In addition we can use the accuracy provided by Blender for animations creation.
Congratulation for this works run.

Cheers,
Clément
User avatar
F-JJTH
 
Posts: 697
Joined: Fri Sep 09, 2011 11:02 am

Re: W.I.P. Blender to flightgear

Postby run » Sat Jul 14, 2012 2:36 pm

Hi all

xiii wrote in Sat Jul 14, 2012 12:59 am:Anyway, here a nice (yet another) drawing of the E-2C main gear so we can remember the good ol' times :-)


:D :D :D
Yes it the good ol'time.
But it' a complicated time.

It's more easy to create animation with blender. It's the reason why blender and other software exist.

It's a nice work with landing gear of the E2C.

Image

F-JJTH wrote in Sat Jul 14, 2012 11:32 am:Now we can read and create FlightGear animation without FlightGear.


Not exactely now , but in a future ... yes ... it's a work in progress ..

Thanks you all for your support .... I work hard for this, and there is many many bug. And a special thank to Clement, Alexis(from france) and all other member of french'team PAF.
If there is another person who want to help us .... also welcome ....

Bye
run
 
Posts: 17
Joined: Fri Jul 06, 2012 2:03 pm

Next

Return to Development

Who is online

Users browsing this forum: No registered users and 2 guests