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

Coldfusionstorm

  • Golem
  • ******
  • Posts: 868
    • View Profile
Re: exporter/Blender 2.5 series
« Reply #25 on: 1 November 2011, 23:19:39 »
now we're on it we really need a new exporter for 2.5
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 #26 on: 8 November 2011, 11:04:23 »
I had some time the other day and started hacking on it. It's based on loveheaven's import script and not finished yet. Animation is missing and some other things are wrong (two sided, alpha). Expect problems.

You can get the script here:
http://glestae.git.sourceforge.net/git/gitweb.cgi?p=glestae/glestae;a=blob_plain;f=source/glexemel/g3d_support.py;hb=HEAD
Just install it as addon and enable it. I only briefly tested it on blender 2.60a with an imported archmage model.

Can someone please provide a blend file with texture and animation? Otherwise i can't finish it.

Coldfusionstorm

  • Golem
  • ******
  • Posts: 868
    • View Profile
Re: exporter/Blender 2.5 series
« Reply #27 on: 8 November 2011, 17:52:12 »
im currently looking for one of my models, worst case senari il just texture a cube and animate it to spin

EDIT: Aparantly i need to orintate myself about animation again, if anyone can provide a animaiton before me please do so.

« Last Edit: 8 November 2011, 19:25:01 by Coldfusionstorm »
WiP Game developer.
I do danish translations.
"i break stuff"

Coldfusionstorm

  • Golem
  • ******
  • Posts: 868
    • View Profile
Re: exporter/Blender 2.5 series
« Reply #28 on: 8 November 2011, 19:36:42 »
There a box with UV and Animation

http://hotfile.com/dl/134526683/91e85a4/box_uv_ani.7z.html

EDIT: Texture wiev does not work, but it is textured and when rendered it shows up
EDIT2: Alpha defines teamcolour in the image file.
« Last Edit: 8 November 2011, 19:42:15 by Coldfusionstorm »
WiP Game developer.
I do danish translations.
"i break stuff"

Coldfusionstorm

  • Golem
  • ******
  • Posts: 868
    • View Profile
Re: exporter/Blender 2.5 series
« Reply #29 on: 9 November 2011, 08:09:22 »
Yggdrasil, Can you use my box?, if you need anything elles please let me know.
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 #30 on: 9 November 2011, 21:37:17 »
Thanks. I added animation support (at least i hope so) but your cube looks a bit weird. Texture seems to be wrong too. Do you have another model which is textured correctly in blender (texture view)? Exporting an imported archmage model looks correct.

Btw, customcolor aka 'make alpha appear in teamcolor' is now always enabled. How do you set it in blender? Or was it always on?

PS: The link above always points to the newest version of the script.

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 #31 on: 10 November 2011, 19:39:28 »
Currently in the 2.49 version, it is set by making the object single or double sided. This is definitely not the right way. I don't have a copy of 2.5 on hand but 2.49 has a switch in the map-to section of the material settings for that. Alternatively, the main material section has a switch for using the alpha channel in tex face images, so I think that would also be suitable.

Coldfusionstorm

  • Golem
  • ******
  • Posts: 868
    • View Profile
Re: exporter/Blender 2.5 series
« Reply #32 on: 11 November 2011, 01:42:43 »
Thanks. I added animation support (at least i hope so) but your cube looks a bit weird. Texture seems to be wrong too. Do you have another model which is textured correctly in blender (texture view)? Exporting an imported archmage model looks correct.

Btw, customcolor aka 'make alpha appear in teamcolor' is now always enabled. How do you set it in blender? Or was it always on?

PS: The link above always points to the newest version of the script.

I will try to fix the texture on the cube, i will also download the script and test out the exporter.

PS: as far i am aware, The game engine was the one making the team colurs appear, with just default blender settings. just be sure that your texture had alpha in it.
« Last Edit: 11 November 2011, 02:02:44 by Coldfusionstorm »
WiP Game developer.
I do danish translations.
"i break stuff"

Coldfusionstorm

  • Golem
  • ******
  • Posts: 868
    • View Profile
Re: exporter/Blender 2.5 series
« Reply #33 on: 11 November 2011, 02:52:25 »
Allright, i gave a shot couldnt get the export to work.

1. The script is listed under both Export and import, Neither works for me.
2. I use Windows 64 bit.
3. i use Blender version 2.59, Unkown Bit version can't find that info, (currently download 2.60 and testing with that).
4.When exporting my models,it does use the glexml.exe and converts the file however the converted file is ALLWAYS and ONLY 7Kb.
5. i tried the script also in Blender 2.57 in this version the script won't activate in the control interface.

this is the error i get when trying to open the exported model in the .g3d format.
http://pastebin.com/PJ5KT4jv

this is in both 2.59, and 260a

In Blender 2.60a, I get that the exported .g3d file is 7Kb if i Ctrl-T them,(that means making every triangles.)
however one time i got a larger file out of it.

EDIT:2.60a Importing work i tried the Archmage like you and it worked, but i could not export him again.

EDIT2:
This is the output from megaglestg3dviewer When i tro to open a Initate.g3d file i have IMPORTED From game Folder then EXPORTED (with a resulting file size of..134KB.
the Original File size is 126

TEH OUTPUT
http://pastebin.com/ZKuvY7tN

I can't however remeber when my glexml.exe file is from, it might be old and outdated, but it havent been updated in a loooong time anyways

Also if a try to export a cube made of triangles it gives this error in blenders command promt.

Code: [Select]
Now Exporting File: C:\Users\Frederick\Desktop\Cube.g3d
Traceback (most recent call last):
  File "C:\Program Files (x86)\Blender Foundation\Blender\2.60\scripts\addons\ex
portg3d.py", line 607, in execute
    G3DSaver(self.filepath, context)
  File "C:\Program Files (x86)\Blender Foundation\Blender\2.60\scripts\addons\ex
portg3d.py", line 495, in G3DSaver
    texname = bpy.path.basename(material.active_texture.image.filepath)
AttributeError: 'Texture' object has no attribute 'image'

So, Summariation

2.60a:
Importing Works but have some quirks when i imported some of my own models it sorta imports some weird ghost particles or something like that model file link is here Propetary model mind you. So i grant you liscense to use it for study purposes.( just so you can feel secure about it :).
Also this model have correct textureing in blenders texture view.

Exporting does not work with, and the Megaglest_g3dviewer comes with the bad allocation something error wich i have listed above.

Done with edits for this time.



« Last Edit: 11 November 2011, 03:53:28 by Coldfusionstorm »
WiP Game developer.
I do danish translations.
"i break stuff"

Psychedelic_hands

  • Guest
Re: exporter/Blender 2.5 series
« Reply #34 on: 11 November 2011, 10:20:41 »
Nice word Yggdrasil! I would help but seems CFS got there first. 
I've been waiting for this a long time now, thank you :).

Currently in the 2.49 version, it is set by making the object single or double sided. This is definitely not the right way. I don't have a copy of 2.5 on hand but 2.49 has a switch in the map-to section of the material settings for that. Alternatively, the main material section has a switch for using the alpha channel in tex face images, so I think that would also be suitable.

I agree with this, if it's not too much work that is.

Coldfusionstorm

  • Golem
  • ******
  • Posts: 868
    • View Profile
Re: exporter/Blender 2.5 series
« Reply #35 on: 11 November 2011, 11:17:21 »
I do not know about the material thing, but I make team colours by adding Alpha to the texture.png
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 #36 on: 11 November 2011, 15:07:25 »
Just to make something clear: The script is for the newest version of blender 2.60a. I won't fix it for older versions. It contains both an importer and an exporter for g3d. glexemel isn't needed anymore. Everything is done in python.

In Blender 2.60a, I get that the exported .g3d file is 7Kb if i Ctrl-T them,(that means making every triangles.)
however one time i got a larger file out of it.
All faces need to be triangles otherwise they're ignored. There is no warning shown yet as i haven't found an easy way to do that.

EDIT:2.60a Importing work i tried the Archmage like you and it worked, but i could not export him again.
There was a problem with the mesh count if you deleted a mesh before exporting. Should be fixed now.

This is the output from megaglestg3dviewer When i tro to open a Initate.g3d file i have IMPORTED From game Folder then EXPORTED (with a resulting file size of..134KB.
the Original File size is 126

TEH OUTPUT
http://pastebin.com/ZKuvY7tN
Looks like the texture couldn't be found. I'm no MG dev... In GAE you get a default texture.

Also if a try to export a cube made of triangles it gives this error in blenders command promt.
Code: [Select]
Now Exporting File: C:\Users\Frederick\Desktop\Cube.g3d
Traceback (most recent call last):
  File "C:\Program Files (x86)\Blender Foundation\Blender\2.60\scripts\addons\ex
portg3d.py", line 607, in execute
    G3DSaver(self.filepath, context)
  File "C:\Program Files (x86)\Blender Foundation\Blender\2.60\scripts\addons\ex
portg3d.py", line 495, in G3DSaver
    texname = bpy.path.basename(material.active_texture.image.filepath)
AttributeError: 'Texture' object has no attribute 'image'
I added a check to make sure the active texture in the (first) material is an image texture. Texture is ignored if it's not the case.

Importing Works but have some quirks when i imported some of my own models it sorta imports some weird ghost particles or something like that model file link is here
Works fine for me. I don't see any "particles".

Currently in the 2.49 version, it is set by making the object single or double sided. This is definitely not the right way. I don't have a copy of 2.5 on hand but 2.49 has a switch in the map-to section of the material settings for that. Alternatively, the main material section has a switch for using the alpha channel in tex face images, so I think that would also be suitable.
Do you mean something like that (Face Textures):

It's in the material's options. There's another one hidden behind the tooltip regarding face texture alpha. I don't know what's really meant with face texture. If i have a texture ofcourse it should replace the other color. I don't really get the point of this option. Anyway should i use that one?

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 #37 on: 11 November 2011, 17:36:34 »
Regarding triangles, is there a way to have the export script automatically convert quads to triangles? Quads are vastly easier to work with because they preserve edge loops.

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: exporter/Blender 2.5 series
« Reply #38 on: 11 November 2011, 20:29:59 »
Alright, this was in need of testing, so I brought out Blender 2.60a (I downloaded it a while ago, and have been meaning to fully (re)learn it, the lack of an exporter was the biggest hurdle).

Firstly, to install the script, I placed it in %installation_directory%/Blender 2.60a/2.60/scripts/addons, then in Blender, go to user preferences > addons > Import-export, and find "G3D Mesh Importer" (that should really be renamed to "Exporter") and tick the checkbox. Note that this, like all user preferences, will only persist for the current session unless you create a new default session (with Ctrl+U, which will make the current window locations, user settings, model, etc, the default).

Anyway, I encountered a few problems. Firstly, I was unable to get the texture on my cube to export correctly when I tried, despite it rendering correctly (F12), and being set to map to "UV" (though with past exporters, they always exported the texture coords by the UV, regardless of what you have set for Blender's internal renderer. The image is very much properly linked as it would be necessary with the older exporter. It still does export, but the UV coords (which tell where each point of the 3D model's faces should be "mapped" to the 2D image) seem messed up, as seen in the image to to the right (the left cube is the G3D viewer, the right cube is the rendered Blender version, showing how it should look).

In addition, when I tried to apply bone animation (which the majority of animated models will use), the exporter totally ignored the bones and exported the mesh as though they didn't exist, yet the G3D viewer recognizes there are multiple frames, just the exact same unchanged model in every frame. I think this may be because you were working with an imported archmage. Imported models use shape keys, instead of bones (since bones are not preserved in the G3D model). This sadly is a huge limitation, as bones are crucial for glest modeling.

And of course, here is the zip file from my test, containing the blend file with a textured and animated cube, the PNG for the texture (Blender defaults to PNG now!), and the exported G3D:

[big]Download ZIP (60.5 KB)[/big]
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 #39 on: 11 November 2011, 22:26:44 »
Just to clarify, the game has never recognized bones and the exporter is agnostic regarding animation methods. It has only ever cared about where each vertex is located on each frame.

Yggdrasil

  • GAE Team
  • Ornithopter
  • ********
  • Posts: 408
    • View Profile
Re: exporter/Blender 2.5 series
« Reply #40 on: 12 November 2011, 14:36:18 »
I made some more fixes and added support for armature animation. Both cubes, Coldfusionstorm's and Omega's, work now. An imported archmage model works too. customcolor is still hardcoded.

Regarding triangles, is there a way to have the export script automatically convert quads to triangles? Quads are vastly easier to work with because they preserve edge loops.
Yeah, i can do that if it's needed. But don't expect the importer to make quads again.

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: exporter/Blender 2.5 series
« Reply #41 on: 12 November 2011, 18:40:58 »
I made some more fixes and added support for armature animation. Both cubes, Coldfusionstorm's and Omega's, work now. An imported archmage model works too. customcolor is still hardcoded.
Awesome job! I can confirm that both the textures and animations worked flawlessly.
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 #42 on: 13 November 2011, 07:20:52 »
Thanks Yggdrasil!
 :thumbup:

:).

If there was a larger ! sign i would use it,

EDIT:would you look at that, there is!
WiP Game developer.
I do danish translations.
"i break stuff"

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: exporter/Blender 2.5 series
« Reply #43 on: 16 November 2011, 13:07:45 »
Thanks Yggdrasil!!!!!
Man how could I have missed this great news? I must test it! ( but I still have my problems with the new blender  :angel: )
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

Psychedelic_hands

  • Guest
Re: exporter/Blender 2.5 series
« Reply #44 on: 18 November 2011, 06:47:09 »
Great news! Finally able to un-install Blender 2.49b from my computer is great feeling. :)

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: exporter/Blender 2.5 series
« Reply #45 on: 18 November 2011, 08:16:19 »
Great job Yggdrasil, that was definitely not an easy achievement!

Yggdrasil

  • GAE Team
  • Ornithopter
  • ********
  • Posts: 408
    • View Profile
Re: exporter/Blender 2.5 series
« Reply #46 on: 19 November 2011, 15:35:39 »
Hui, looks like this was needed.

I added support for quads. They are converted on the fly to triangles. For customcolor aka 'alpha appears in teamcolor' you have to check 'face texture alpha' in the material's options. It's normally greyed out but you can still click it. 'double sided' is in Object Data -> Normals of the mesh. In most cases you won't need it. Only things like the cape of the archmage model need it.

The only thing which is still completely untested is an animated model with multiple meshes. The importer doesn't support animations. Can someone please test it?

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 #47 on: 19 November 2011, 17:20:25 »
Awesome! Just what many of us have been waiting for.  :D

Coldfusionstorm

  • Golem
  • ******
  • Posts: 868
    • View Profile
Re: exporter/Blender 2.5 series
« Reply #48 on: 22 November 2011, 12:49:15 »
I just tought about it, and the work you made with this is impressive, you removed the need for a entire programe added animations, and made it all into ONE script!, Modelling have never been this easy for Glest!.
WiP Game developer.
I do danish translations.
"i break stuff"

Psychedelic_hands

  • Guest
Re: exporter/Blender 2.5 series
« Reply #49 on: 28 November 2011, 02:24:55 »
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...