Jump to content


Photo

Export Gm6.1 Models From Blender


  • Please log in to reply
42 replies to this topic

#1 biggoron

biggoron

    dura lex sed lex

  • New Member
  • 652 posts

Posted 08 April 2007 - 08:58 PM

Where?
export_GM6.py

What?
This is a Python script that should allow Blender to export GM6.1 model files.

What it does:
  • Exports vertex positions (obviously)
  • Exports face normals or vertex normals (you choose)
  • Exports UV coordinates (or not, you choose)
What it doesn't do:
  • Export colours/alpha
  • Export unconnected vertices/edges (at least, not correctly)
  • Make tea
How?
To use this, go open this folder:
C:\Program Files\Blender Foundation\Blender\.blender\scripts\

And put the script in there. Open Blender and open a scripts window. Click "Scripts -> Update Menus". Now make a model and export it. There should be a new option called "GM6.1 (*.d3d)". Click this and save it somewhere. A popup will show with some options. It's easy to understand, but I'll go through them anyway.

The options are:
Vertex Normals
Face Normals
Export UV coord

The first two options are mutually exclusive: You can only choose one. Well you can choose both or neither, but in the exporting it will choose one. The third option is whether or not to export UV coordinates. I don't think this needs any explanation.

I hope this is an acceptable topic for this forum. Sorry if it's not.

[edit]
Forgot to say that I'm a complete noob at Python. I actually just started learning basic Python the day before I made this script, so if anyone more experienced would like to improve my script please feel free to do so.

Edited by biggoron, 29 April 2007 - 08:03 PM.

  • 0

#2 Schreib

Schreib

    Valen Shadowbreath

  • GMC Member
  • 1455 posts

Posted 08 April 2007 - 09:02 PM

Direct convertion? Even UV-data? Woohoo!
  • 0

#3 the_doominator

the_doominator

    Eight Star

  • New Member
  • 925 posts

Posted 09 April 2007 - 12:37 AM

I think it should belong in Graphics Anyway VERY awesome!
  • 0

#4 royboyjoytoy2

royboyjoytoy2

    GMC Member

  • New Member
  • 308 posts

Posted 09 April 2007 - 02:03 AM

Where?
export_GM6.py

What?
This is a Python script that should allow Blender to export GM6.1 model files.

What it does:

  • Exports vertex positions (obviously)
  • Exports face normals or vertex normals (you choose)
  • Exports UV coordinates (or not, you choose)
What it doesn't do:
  • Export colours/alpha
  • Export unconnected vertices/edges (at least, not correctly)
  • Make tea
How?
To use this, go open this folder:
C:\Program Files\Blender Foundation\Blender\.blender\scripts\

And put the script in there. Open Blender and open a scripts window. Click "Scripts -> Update Menus". Now make a model and export it. There should be a new option called "GM6.1 (*.d3d)". Click this and save it somewhere. A popup will show with some options. It's easy to understand, but I'll go through them anyway.

The options are:
Vertex Normals
Face Normals
Export UV coord

The first two options are mutually exclusive: You can only choose one. Well you can choose both or neither, but in the exporting it will choose one. The third option is whether or not to export UV coordinates. I don't think this needs any explanation.

I hope this is an acceptable topic for this forum. Sorry if it's not.

[edit]
Forgot to say that I'm a complete noob at Python. I actually just started learning basic Python the day before I made this script, so if anyone more experienced would like to improve my script please feel free to do so.

<{POST_SNAPBACK}>

Nice works in
  • 0

#5 xygthop3

xygthop3

    GMC Member

  • GMC Member
  • 2448 posts

Posted 09 April 2007 - 02:51 AM

You don't need to quote all the time,it makes the topic to big, just reply.
  • 0

#6 Schreib

Schreib

    Valen Shadowbreath

  • GMC Member
  • 1455 posts

Posted 09 April 2007 - 10:38 AM

It is also written with the Holy language! Hooray!
  • 0

#7 biggoron

biggoron

    dura lex sed lex

  • New Member
  • 652 posts

Posted 10 April 2007 - 03:14 PM

Oh, man, am I an idiot... I had the old script uploaded. Download it again for the proper one.
  • 0

#8 the_doominator

the_doominator

    Eight Star

  • New Member
  • 925 posts

Posted 25 April 2007 - 07:42 PM

oh i was replying to the first..... anyway the real one is much better.
  • 0

#9 IceWind91

IceWind91

    GMC Member

  • New Member
  • 491 posts

Posted 27 April 2007 - 02:21 AM

The link seems to be broken. I hope it works again soon, because this sounds extremely useful!
  • 0

#10 biggoron

biggoron

    dura lex sed lex

  • New Member
  • 652 posts

Posted 27 April 2007 - 06:36 PM

I changed it to a permanent storage place. Honestly, this is quite poorly written. I was busy when I was writing it and when I got some time I forgot completely about it.

I promise I'll write a much better one on the weekend. Python isn't my forté so excuse any gross errors. As I say in my original post, if anyone knows Python better than I then please feel free to make improvements.
  • 0

#11 IceWind91

IceWind91

    GMC Member

  • New Member
  • 491 posts

Posted 27 April 2007 - 09:21 PM

Yes! Thank you so much!

Sorry, but once a model is exported, how do you load it into the game? Here's the code I have so far:

Create Event:
d3d_model_create()
d3d_model_load(0,working_directory+"/ModelName.d3d")

Draw Event:
d3d_model_draw(0,x,y,0,TextureName)

It doesn't give an error or anything, it just doesnt show the model. I'm pretty new to 3D with Game Maker, so I'm probably forgetting something important.
  • 0

#12 Schreib

Schreib

    Valen Shadowbreath

  • GMC Member
  • 1455 posts

Posted 27 April 2007 - 09:34 PM

You need to specify a variable to hold the model. So:

model1 = d3d_model_create();
d3d_model_load(model1,........);

d3d_model_draw(model1,x,y,0,texturename);
  • 0

#13 Fimbulfamb

Fimbulfamb

    GMC Member

  • New Member
  • 24 posts

Posted 27 April 2007 - 09:47 PM

IceWind, you are loading the model with the index zero. When you create the model it returns the index. Either you do this in the create event, and then you can use the variable again in the draw event, or you make it global.

In the create event:
model_id = d3d_model_create();
d3d_model_draw(model_id, x, y, z, tex);

  • 0

#14 Tobs

Tobs

    GMC Member

  • New Member
  • 599 posts

Posted 28 April 2007 - 07:59 AM

Lots of error checking, very nice!
I tried this once, about a year/2 ago, but I could never export the UV maps correctly, so kudos to you!

Tobs
  • 0

#15 biggoron

biggoron

    dura lex sed lex

  • New Member
  • 652 posts

Posted 29 April 2007 - 08:04 PM

I changed it again. It should work a lot more cleanly this time. I haven't tested to see if it exports UVs correctly so you'll have to find out for yourselves.

Thanks, Tobs :lol:

Edited by biggoron, 29 April 2007 - 08:04 PM.

  • 0

#16 NEED HELP sorta

NEED HELP sorta

    GMC Member

  • New Member
  • 1501 posts

Posted 04 May 2007 - 07:19 AM

Man...
I couldn't get the download ink to work...
I'll probably use this eventually though.
  • 0

#17 biggoron

biggoron

    dura lex sed lex

  • New Member
  • 652 posts

Posted 04 May 2007 - 06:58 PM

If the link doesn't work for anyone just PM me and I'll email it or provide a temporary upload.
  • 0

#18 IceWind91

IceWind91

    GMC Member

  • New Member
  • 491 posts

Posted 05 May 2007 - 08:53 PM

Thanks for explaining that, Schreib and Fimbulfamb!

Can this script export models that are animated with armatures and have them animate in Game Maker? If not, that might be a good feature to have in later versions, if you can figure out how to do it.

Also, you don't need to have the texture/UVmap as an external file, do you? I tried using a background as the texture, but it didn't show the texture.
  • 0

#19 Schreib

Schreib

    Valen Shadowbreath

  • GMC Member
  • 1455 posts

Posted 05 May 2007 - 10:27 PM

Thanks for explaining that, Schreib and Fimbulfamb!

Can this script export models that are animated with armatures and have them animate in Game Maker? If not, that might be a good feature to have in later versions, if you can figure out how to do it.

Also, you don't need to have the texture/UVmap as an external file, do you? I tried using a background as the texture, but it didn't show the texture.

<{POST_SNAPBACK}>

Sorry, it's impossible to export animations. Game Maker can't handle such animations.
  • 0

#20 Ruud v A

Ruud v A

    Games programmer

  • New Member
  • 417 posts

Posted 06 May 2007 - 08:06 AM

Animations should be possible in GM if you export a model for each frame and draw the right one in GM. But that would take a lot of memory.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users