Author Topic: Help with blender import/export  (Read 4076 times)

Archmage

  • Guest
Help with blender import/export
« on: 27 March 2008, 19:43:36 »
I downloaded the g3dimport_export_beta.zip. I did every thing correctly (placing the file where it needs to go) I was able to open a model, and save my modded unit as .blend (just a horse without the rider (for testing)) and then tried saving using the wizard as g3d, but it didn't. Also how do I edit the animation of the unit?
« Last Edit: 1 January 1970, 00:00:00 by Archmage »

weedkiller

  • Draco Rider
  • *****
  • Posts: 277
    • View Profile
(No subject)
« Reply #1 on: 27 March 2008, 20:45:12 »
there are some issues you need to know:

glests animation-format g3d saves the modell only in several positions, so you have "many" meshes which represent the modell in several states during the animation. Within the game glest can interpolate these modells so the movement can be made smooth if needed.

So if you import the modell into blender you have not really a animated modell but the different modells as several shapekeys. This are things to morph a mesh between different states... so nearly something like glest does with the g3d.

Normally Humans are animated with armatures in blender. Explaining this needs some time... Think of a skeleton which can move the body's meat...

So you kan do two things:
- only changing texture and uv and use shapekeys to export original animation
- build a new armature into the mesh and try animating on your own. you can try reconstructing the animation of the shapekeys but it will be hard.

//EDIT: oh and only use this wizard for importing; for exporting you need another exportskript
 and glexemple which convertes the xml-file which the script creates into an g3d... ;) ask when you have a question
« Last Edit: 1 January 1970, 00:00:00 by weedkiller »

Archmage

  • Guest
(No subject)
« Reply #2 on: 27 March 2008, 21:10:55 »
I downloaded the xml exporter and th xml to gd3. I xported my model into xml what do I do? How do I use the xml to gd3 program?
« Last Edit: 1 January 1970, 00:00:00 by Archmage »

ZaggyDad

  • Guest
(No subject)
« Reply #3 on: 27 March 2008, 21:11:59 »
As weedkiller said above, the g3d import\export script hasn't got export yet. You have to use the xml-g3d exporter and glexemel.

You have to rig (a rig is basically a manipulatable skeleton) the model (the rig is called an armature.)to animate it.

To rig the model, you have to create the armature. First, press space. It'll bring up a menu. Go into add, and then (hopefully (I'm doing this from memory))press armature. Then, position the bone that appears where the bottom backbone should be (I usually use wireframe mode to position the bones, because the bones manipulate vertices on the model, and you don't want it to mess up the model during the animation).  To add on bones, select one end of the bone (a little ball on whichever end of the bone you want another bone sticking off of)and press e, and move the mouse to position the end of the new bone. Then left-click.

Edit: Oops! I didn't even finish it!

Name the bones (by selecting them and in the editing panel on the bottom, and in a little text box a bit to the right, write the name of the bone. Do that on all of them.

To make the armature manipulate the mesh, select the armature (preferably in object mode (hope you know how to switch modes...))and THEN select the mesh (you HAVE to do it in this order.) and then press Ctrl + P and then press armature in the menu that comes up. Then it'll bring up another menu (lots of menus in blender, eh?). In it, press create groups. Then select the model, and go into edit mode. Select the vertices that you want one of the bones to move. Then on the left in the editing panel, bring up the menu on the vertex groups section of link and materials. In it, select the name of the bone that you want to modify the part of the mesh with. then click assign. Do that on the rest of the mesh. To make sure that you made all of the vertices move when you move the bones, select the bones (in object mode, of course)and move them around a bit (a bit in this case means far enough that it will reveal any unmoving vertices). If a vertice is hanging behind, find out which one it is. Then find a bone to move it, and add it to it's vertex group.

Now, for animation! (YAY! I love this part! ;) )

I use the nla editor for animation. (Get it up by splitting the 3d view in half (right-click on the separator thing and click split view. (You can drag around the "separators" with the mouse.)

To add an animation key, (in the nla editor they're marked by diamonds)click i, (only the selected bones get marked with the properties)and it'll bring up a menu. I usually use LocRotScale (saves Location, Rotation, and Scaling)

To move around in the frames of the animation, use the arrow keys.

And remember, you don't have to make every frame. Blender makes in-between frames on it's own (though sometimes they're unsatisfactory, in which case you should make a frame there (i.e. if your character has shifting feet in the animation (which happens a TON). ). ).

I hope this helps. And sorry about all the parentheses. I'm no good at writing tutorials.

~Zaggy
« Last Edit: 1 January 1970, 00:00:00 by ZaggyDad »

Archmage

  • Guest
(No subject)
« Reply #4 on: 28 March 2008, 01:19:08 »
Thans for the blender toturial. I don't know how to make it g3d, I made the model into .xml but how do I make it into a g3d?
« Last Edit: 1 January 1970, 00:00:00 by Archmage »

ZaggyDad

  • Guest
(No subject)
« Reply #5 on: 28 March 2008, 02:54:12 »
Use glexemel (you should save the xml to the glexemel/bin folder). To do so, bring up a command line. Then type in cd and then the path of the bin folder, and press enter. Then type in xml2g xmlfilename.xml savedg3dfilename.g3d, and press enter again. If you don't understand, then just type in xml2g, and it'll show a manual thing. Then it'll output a g3d file of the name you typed in.

If it gets an error, then tell me what it is, and I'll hopefully be able to figure out what it is.

~Zaggy
« Last Edit: 1 January 1970, 00:00:00 by ZaggyDad »

modmaker

  • Guest
(No subject)
« Reply #6 on: 2 April 2008, 03:47:35 »
So I've been researching like crazy to try to figure out how to work on this project and make some amazing mods in my free time, and I finally tested my first blender figure to see if the whole export process worked.  It exported, so I ran the win32 XML->g3d converter in the windows XP command prompt, and out popped a g3d file.  So I viewed it in the g3d viewer that comes with Glest, and it was blank.  Completely blank.  It listed 8 vertices (which was correct; my test figure was just a cube) and zero triangles (needless to say, this was not correct;  it should have been 2 for each side, or 12).  Here are some noteworthy things that I suspect may have something to do with it.

-I am using blender version 2.45, I believe, and I've only found confirmed reports of blender working up to version 2.43 I think.

-I did very little preparation of my figure before exporting it (I only made sure it was starting frame 1 and ending frame 1, and that it was made of triangles).

-When I ran the converter in the command prompt, it put out the g3d file, but also printed this error:
"square.xml:50: element indices: validity error: Element Indices content does not follow the DTD, expecting <Ix>+, got <>
     </Indices>
                     ^
"

These are the only things I can think of.  Can someone help me?
« Last Edit: 1 January 1970, 00:00:00 by modmaker »

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,239
    • View Profile
    • http://www.titusgames.de
(No subject)
« Reply #7 on: 2 April 2008, 12:00:06 »
Read the comments in the head of the export script!

What's probably the problem in your case is the following:
To export a model you must be in object mode.
Select the object(s) you want to export to xml.
export it.

You should see something in glest now and the xml should be fine. If you still don't see anything in glest, but the xml looks ok, the model is probabaly much too big or the position is completely wrong ( its in the ground or something like this. )
« Last Edit: 1 January 1970, 00:00:00 by titi »
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

ZaggyDad

  • Guest
(No subject)
« Reply #8 on: 2 April 2008, 14:34:00 »
@Modmaker:

1. I use 2.45, too, and it works perfectly. (Sometimes. :? I think it's because it needs indices, but it can't find them for the vertices (or faces)in the model. (Or else it just doesn't like the fact that it doesn't have indices at all...)How do you convert it to triangles? The way you should is press space bar, and then go into edit/faces and then press convert to triangles.

~Zaggy
« Last Edit: 1 January 1970, 00:00:00 by ZaggyDad »

modmaker

  • Guest
(No subject)
« Reply #9 on: 2 April 2008, 20:07:49 »
I was in object mode, I selected the object, and the way I converted it to triangles in the first place was to use the spacebar/convert to triangles option.  I'll go back and do it all again, but I expect the same results this time.  Maybe somebody could give me a live walkthrough sometime?  I'll be debugging on my own 'till I hear back, and if I get it figured out, I'll let you guys know.  Thanks for the prompt responses!
« Last Edit: 1 January 1970, 00:00:00 by modmaker »

ZaggyDad

  • Guest
(No subject)
« Reply #10 on: 2 April 2008, 20:31:51 »
It's just a plain cube, right? I just made one and it exported fine. One thing that just MIGHT be worth a try is doing remove doubles. (In the editing panel)

~Zaggy
« Last Edit: 1 January 1970, 00:00:00 by ZaggyDad »

modmaker

  • Guest
(No subject)
« Reply #11 on: 3 April 2008, 02:44:15 »
Okay, so I got that all sorted out, and even got a figure imported to work on/play with.  I guess I'll move on to another forum topic now.  Thanks everyone!
« Last Edit: 1 January 1970, 00:00:00 by modmaker »