Author Topic: exporter/Blender 2.5/2.6 series  (Read 57175 times)

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: exporter/Blender 2.5 series
« Reply #50 on: 28 November 2011, 03:20:07 »
Sorry for this noob question.... But don't I need a .py file? All I get when I click Yggdrasil's link is a big page of code...
Uh, that is the python file. Save it as .py and place it in the scripts/addons folder, then enable it in the addons menu of user preferences.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

Psychedelic_hands

  • Guest
Re: exporter/Blender 2.5 series
« Reply #51 on: 28 November 2011, 03:26:57 »
Sorry for this noob question.... But don't I need a .py file? All I get when I click Yggdrasil's link is a big page of code...
Uh, that is the python file. Save it as .py and place it in the scripts/addons folder, then enable it in the addons menu of user preferences.

Yes I got that... just how do I save it as .py file  :-[? Sorry. I haven't really touched Blender scripts before.

Coldfusionstorm

  • Golem
  • ******
  • Posts: 868
    • View Profile
Re: exporter/Blender 2.5 series
« Reply #52 on: 28 November 2011, 11:19:44 »
You need to mark the entire code section and copy paste it into a .txt document, when you have done that rename the file to blender_exporter_v2.5.py

any name tho should be fine as long as the file ending is .py

Then put it into the /blender/script/addon

folder
WiP Game developer.
I do danish translations.
"i break stuff"

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: exporter/Blender 2.5 series
« Reply #53 on: 29 November 2011, 01:23:15 »
Sorry for this noob question.... But don't I need a .py file? All I get when I click Yggdrasil's link is a big page of code...
Uh, that is the python file. Save it as .py and place it in the scripts/addons folder, then enable it in the addons menu of user preferences.

Yes I got that... just how do I save it as .py file  :-[? Sorry. I haven't really touched Blender scripts before.
Save it in any text editor? Just like xml, c++, etc etc.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: exporter/Blender 2.5 series
« Reply #54 on: 6 December 2011, 05:04:51 »
I just tried this script (From this URL: http://glestae.git.sourceforge.net/git/gitweb.cgi?p=glestae/glestae;a=blob_plain;f=source/glexemel/g3d_support.py;hb=HEAD) and when importing g3d's into blender 2.57 (the latest release) i see no proper animation sequences when i 'play' the model. Has anyone been able to confirm animations work (without them this is kindof useless).

Thanks

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: exporter/Blender 2.5 series
« Reply #55 on: 6 December 2011, 05:56:41 »
I just tried this script (From this URL: http://glestae.git.sourceforge.net/git/gitweb.cgi?p=glestae/glestae;a=blob_plain;f=source/glexemel/g3d_support.py;hb=HEAD) and when importing g3d's into blender 2.57 (the latest release) i see no proper animation sequences when i 'play' the model. Has anyone been able to confirm animations work (without them this is kindof useless).

Thanks
Wait, no longer? When did it ever import animations? There was shape keys in the past, but they were pretty useless, and G3D doesn't contain bones (yet another reason why MD5 should replace it), so those can't be imported.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

Coldfusionstorm

  • Golem
  • ******
  • Posts: 868
    • View Profile
Re: exporter/Blender 2.5 series
« Reply #56 on: 6 December 2011, 08:36:18 »
Im pretty sure _importing_ bones just dosnt work
WiP Game developer.
I do danish translations.
"i break stuff"

Yggdrasil

  • GAE Team
  • Ornithopter
  • ********
  • Posts: 408
    • View Profile
Re: exporter/Blender 2.5 series
« Reply #57 on: 6 December 2011, 11:34:23 »
I haven't touched the importer in any way besides tiny fixes because they still make small changes to their API. It's still the importer from loveheaven which doesn't support animations. There's no way to restore the armature but as Omega said, shape keys are probably possible.

Btw, the latest Blender is 2.60a. Please use that one.

Yggdrasil

  • GAE Team
  • Ornithopter
  • ********
  • Posts: 408
    • View Profile
Re: exporter/Blender 2.5 series
« Reply #58 on: 25 December 2011, 23:36:07 »
Sorry for double post.

I made another fix. I switched the values of the mesh properties teamcolor and double sided. The format spec described in this thread:
https://forum.megaglest.org/index.php?topic=713
is wrong. Every glest has it the other way around, even vanilla. This is probably one cause why the old exporter used double sided to trigger teamcolor.

Can some moderator please edit the old post by martino and change it to this:
Code: [Select]
enum MeshPropertyFlag{
mpfCustomColor= 1,
mpfTwoSided= 2
};

Here the link again:
http://glestae.git.sourceforge.net/git/gitweb.cgi?p=glestae/glestae;a=blob_plain;f=source/glexemel/g3d_support.py;hb=HEAD
(Right-click 'Save As', name it g3d_support.py, in blender: File->User Preferences -> Addons -> Install Addon (bottom), pick the downloaded file, enable it)

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: exporter/Blender 2.5 series
« Reply #59 on: 26 December 2011, 02:08:07 »
I made another fix. I switched the values of the mesh properties teamcolor and double sided. The format spec described in this thread:
https://forum.megaglest.org/index.php?topic=713
is wrong. Every glest has it the other way around, even vanilla. This is probably one cause why the old exporter used double sided to trigger teamcolor.

Can some moderator please edit the old post by martino and change it to this:
Code: [Select]
enum MeshPropertyFlag{
mpfCustomColor= 1,
mpfTwoSided= 2
};

Here the link again:
http://glestae.git.sourceforge.net/git/gitweb.cgi?p=glestae/glestae;a=blob_plain;f=source/glexemel/g3d_support.py;hb=HEAD
Done.

(Right-click 'Save As', name it g3d_support.py, in blender: File->User Preferences -> Addons -> Install Addon (bottom), pick the downloaded file, enable it)
Oh, and the wiki has a new page detailing this script, including installation and preparation.
« Last Edit: 18 June 2016, 16:40:37 by filux »
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

Yggdrasil

  • GAE Team
  • Ornithopter
  • ********
  • Posts: 408
    • View Profile
Re: exporter/Blender 2.5 series
« Reply #60 on: 2 January 2012, 15:25:36 »
I worked a bit on the importer. I fixed the mesh properties as they were wrong there too and added all frames as shape keys to the meshes. However there's still no animation as i've no clue how to do that. If someone knows a way how one gets an animation out of the shape keys and can give me a step by step instruction how it's done in the GUI, i might be able get this into the python script.

Otherwise one could add a special case where the exporter exports shape keys as frames, but that sounds quite hacky.

John.d.h

  • Moderator
  • Airship
  • ********
  • Posts: 3,757
  • I have to go now. My planet needs me.
    • View Profile
Re: exporter/Blender 2.5 series
« Reply #61 on: 29 January 2012, 22:44:00 »
I've finally started playing around with the newer Blender versions, so this script has been very good to have.  I've noticed two shortcomings so far, though: it doesn't seem to respect object scaling, and it exports all meshes instead of just what you select, so (AFAIK) there's no way to have a particular mesh present in one animation but not another without using separate files (like how the worker switches between an axe and a hammer).

By the way, where's the option that toggles transparency vs. team color?  This new UI is still over my head. :confused: (Edit: found it.)
« Last Edit: 18 June 2016, 16:35:17 by filux »

Yggdrasil

  • GAE Team
  • Ornithopter
  • ********
  • Posts: 408
    • View Profile
Re: exporter/Blender 2.5 series
« Reply #62 on: 4 February 2012, 16:36:27 »
I changed the script to respect your selection. If nothing is selected it's still exporting all meshes.

I don't really know what you mean with scaling and how i should fix it. Could you please provide a blend file which illustrates this problem?

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: exporter/Blender 2.5 series
« Reply #63 on: 4 February 2012, 17:40:43 »
I changed the script to respect your selection. If nothing is selected it's still exporting all meshes.
Cool, I updated the wiki page and its links.
« Last Edit: 18 June 2016, 15:49:31 by filux »
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

John.d.h

  • Moderator
  • Airship
  • ********
  • Posts: 3,757
  • I have to go now. My planet needs me.
    • View Profile
Re: exporter/Blender 2.5 series
« Reply #64 on: 5 February 2012, 01:47:08 »
I changed the script to respect your selection. If nothing is selected it's still exporting all meshes.
Perfect. :)

Quote
I don't really know what you mean with scaling and how i should fix it. Could you please provide a blend file which illustrates this problem?
If you scale or move something in object mode, the export script acts as if the change weren't made... or at least that's what I was experiencing with one of my blend files.  When I tried it on a new scene, scaling a moving a cube in object mode, it stayed moved and scaled properly in the g3d.  Upon further testing, it seems that the exporter does take the object-mode transformations into account, but they have a tendency to turn out wrong.  Basically, this makes it so you have to apply all your object data before exporting, which isn't a big problem but isn't exactly ideal either.  This also makes it so you can't reliably use object transformations for animation -- i.e. if you want to make a wheel rotate, it needs an armature.

In the first screen shot, you see the gallowglass as he normally is.  In the second, his weapon is moved down.  In the third, the two versions when exported.  Instead of being moved down by about a foot, it is moved forward by a few inches.


(click for full size)

The blend file with both g3ds for comparison: http://www.mediafire.com/?rlxedj2xh9i3c43
« Last Edit: 5 February 2012, 01:59:46 by John.d.h »

Psychedelic_hands

  • Guest
Re: exporter/Blender 2.5 series
« Reply #65 on: 5 February 2012, 02:57:10 »
Maybe it's because the script is using the center of the scene as the center of the G3D, unlike the old script which used the center of the active object?

Edit: No, actually thats probably not it...... hmmmmmm.
« Last Edit: 5 February 2012, 03:10:05 by Psychedelic_hands »

Yggdrasil

  • GAE Team
  • Ornithopter
  • ********
  • Posts: 408
    • View Profile
Re: exporter/Blender 2.5 series
« Reply #66 on: 5 February 2012, 13:34:44 »
Thanks John.d.h. I pushed a fix, but i'm not sure if this is correct for all possible transformations. Let me know if something is still wrong.

Yggdrasil

  • GAE Team
  • Ornithopter
  • ********
  • Posts: 408
    • View Profile
Re: exporter/Blender 2.5 series
« Reply #67 on: 29 April 2012, 14:28:30 »
I added some more error handling to the script (checking for object mode and texture unwrap). Warnings and errors are now displayed in blender. Should prevent you from making stupid mistakes. If an error occurs there might be a partly written g3d file waiting for deletion. I don't really want to change the script to check everything beforehand.

Here the link again:
http://glestae.git.sourceforge.net/git/gitweb.cgi?p=glestae/glestae;a=blob_plain;f=source/glexemel/g3d_support.py;hb=HEAD
(Right-click 'Save As', name it g3d_support.py, in blender: File->User Preferences -> Addons -> Install Addon (bottom), pick the downloaded file, enable it)

MuwuM

  • Ornithopter
  • *****
  • Posts: 426
  • No Game without Move(ment)
    • View Profile
    • MuwuM - Lexicons
Re: exporter/Blender 2.5 series
« Reply #68 on: 24 May 2012, 22:15:23 »
I got an error using 2.63 with the Blender 2.6x script (http://glestae.git.sourceforge.net/git/gitweb.cgi?p=glestae/glestae;a=blob_plain;f=source/glexemel/g3d_support.py;hb=HEAD)

Code: [Select]
    G3DSaver(self.filepath, context, self)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.63\scripts\ad
dons\source_glexemel_g3d_support.py", line 534, in G3DSaver
    for face in mesh.faces:
AttributeError: 'Mesh' object has no attribute 'faces'

Now Exporting File: C:\Glest-mods\untitled.g3d
Traceback (most recent call last):
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.63\scripts\ad
dons\source_glexemel_g3d_support.py", line 683, in execute
    G3DSaver(self.filepath, context, self)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.63\scripts\ad
dons\source_glexemel_g3d_support.py", line 534, in G3DSaver
    for face in mesh.faces:
AttributeError: 'Mesh' object has no attribute 'faces'

Coldfusionstorm

  • Golem
  • ******
  • Posts: 868
    • View Profile
Re: exporter/Blender 2.5 series
« Reply #69 on: 24 May 2012, 22:45:13 »
Im pretty sure i had this too, Im REALLY REALLY busy tho, so it might get some time before i get a actual output or confirmation on this. from my side.
WiP Game developer.
I do danish translations.
"i break stuff"

Yggdrasil

  • GAE Team
  • Ornithopter
  • ********
  • Posts: 408
    • View Profile
Re: exporter/Blender 2.5 series
« Reply #70 on: 25 May 2012, 10:44:15 »
API changes ftw. They probably had to because of their new BMesh system supporting n-sided polygons. I pushed a fix which hopefully works for all cases. As i only have a few models this is quite untested, especially n-polygons with n > 4. This fix breaks the script for Blender versions older than 2.63.

Coldfusionstorm

  • Golem
  • ******
  • Posts: 868
    • View Profile
Re: exporter/Blender 2.5 series
« Reply #71 on: 25 May 2012, 16:54:09 »
Nice yggdrasil, But when you uhmm, say oushed the fix, where exactly?
WiP Game developer.
I do danish translations.
"i break stuff"

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: exporter/Blender 2.5 series
« Reply #72 on: 25 May 2012, 17:01:01 »
Nice yggdrasil, But when you uhmm, say oushed the fix, where exactly?
Same link, bro. That's the link to the "head" version, which is always up to date. The diff can be seen here.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

Yggdrasil

  • GAE Team
  • Ornithopter
  • ********
  • Posts: 408
    • View Profile
Re: exporter/Blender 2.5 series
« Reply #73 on: 16 June 2012, 23:23:07 »
I've updated the exporter to add a new panel for g3d mesh properties. If you open the mesh properties and scroll down you'll find a new panel labeled 'G3D properties' which contains 'team color' and 'non-selectable'. So, please take note that you have to use 'team color' from now on and not 'face texture alpha'. 'non-selectable' makes a mesh non-selectable, surprise, surprise. It's the same as in g3dhack and currently only supported by GAE. Other engines should ignore it.

Here the link again:
http://glestae.git.sourceforge.net/git/gitweb.cgi?p=glestae/glestae;a=blob_plain;f=source/glexemel/g3d_support.py;hb=HEAD
(Right-click 'Save As', name it g3d_support.py, in blender: File->User Preferences -> Addons -> Install Addon (bottom), pick the downloaded file, enable it)

Coldfusionstorm

  • Golem
  • ******
  • Posts: 868
    • View Profile
Re: exporter/Blender 2.5 series
« Reply #74 on: 17 June 2012, 08:33:58 »
IM pretty sure the non-select flag also works in MG, i just used the G3D hack the other day, and it def made clicking on one of my buildings/units easier
WiP Game developer.
I do danish translations.
"i break stuff"

 

anything