Difference between revisions of "Exportscript"

From MegaGlest
Jump to navigation Jump to search
(Adding categories)
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
back to [[blendermodelling|Modelling with Blender]]
 
back to [[blendermodelling|Modelling with Blender]]
 
+
==The Blender xml-Exportscript==
'''The Blender xml-Exportscript'''
 
  
 
The exportscript is needed to export the model to an g3d-xml-reprensentation.
 
The exportscript is needed to export the model to an g3d-xml-reprensentation.
 
This export can be converted to .g3d using the [[converter]].
 
This export can be converted to .g3d using the [[converter]].
  
Newest version: Download at  
+
Newest version: Download at [http://www.titusgames.de/news.html#blenderscript titusgames] or  
[http://www.titusgames.de/blender/g3d_xml_exporter_v0.1.7.zip titusgames] or
+
usually older version at [http://www.glest.org/files/contrib/tools/ glest.org]
[http://www.glest.org/files/contrib/tools/ glest.org]
+
==Direct Export to G3D:==
 +
Frank Tetzel (Yggdrasil) made a direct export to .g3d possible. If you copy g3d.dtd and xml2g(.exe) from [[converter|glexemel]] next to this script it will export to .g3d. If not, it will export to .xml like before. In case of windows you have to add the dlls too!
 +
 
 +
'''
 +
 
 +
From the export file header:'''
  
'''From the export file header:'''
+
''INSTALLATION :''
  
INSTALLATION :
+
Copy this Script into your .blender\scripts directory. If you want direct .g3d support unpack all needed glexemel files to this directory too:
      Copy this Script into your .blender\scripts directory
 
      In Blender, open a Script Window and in the menu choose "Update Menus"
 
      Export with File->Export->G3D XML Exporter
 
  
PREPARE THE MODEL :
 
      Each of your meshes' faces must be a triangle (3 vertex)
 
      In Edit mode, you can press Space, edit>faces>Convert to Triangles
 
      Create and place all your meshes before texturing or animating.
 
      The X axe is the floor and the Y axe is the elevation.  The center
 
      of the Blender's 3D space will be the center of you object, at the
 
      ground level.  Before exporting your model, apply the transformations
 
      to each of your mesh (In the 3D space window's menu :
 
                          Object->Clear/Apply->Apply ... )
 
      This will place the center of your mesh (the yellow or pink dot)
 
      at the center of the Blender 3D space.
 
  
      !!!!!!!!!!!!!!     
+
''LINUX:''
      !!!new in 0.1.4: !!!
+
In case of linux its only: xml2g and g3d.dtd ( included is a binary for linux32 bit). The sourcecode can be found here: http://www.glest.org/files/contrib/tools/glexemel-0.1a.zip
      If you have a non animating model, you have to set the start frame
+
''WINDOWS:''
      and the end frame to '1' in blenders 'timeline'-window. Otherwise a non
+
If you are using windows, all files from the "bin" directory from the following zip files are needed: http://www.glest.org/files/contrib/tools/glexemel_win32_0.1a.zip. In Blender, open a Script Window and in the menu choose "Update Menus".
      animating animation will be exported, containing a lot of frames and your
 
      model gets really big. ([[how to export non animating models]])
 
      !!!!!!!!!!!!!!
 
  
      Before doing any texturing or animation, try to export your model and
 
      check your python console (the terminal which opens Blender) to see
 
      if there is a warning about the number of used faces in the summary.
 
      If there is, try to delete "false" faces (which use only 2 vertices)
 
      and transform all your faces in triangle.
 
     
 
EXPORTING :
 
      You MUST select the meshes you want to export.
 
      Only meshes are exported among the selected objects.
 
  
      The diffuse color of the mesh will be it's (first) material's color.
+
Export with File->Export->G3D XML Exporter
      The opacity of the mesh will be it's material's alpha.
+
==Preparing the model==
      Double sided property of the mesh is exported (see F9).
+
*Each of your meshes' faces must be a triangle (3 vertex)
      If you want to use custom color in the texture, your mesh must be
+
*In Edit mode, you can press Space, edit>faces>Convert to Triangles
      double sided. If you don't want custom color to be activated for the
+
*Create and place all your meshes before texturing or animating.
      mesh, add a new boolean property to it (F4) named customColor and with
+
*The X axe is the floor and the Y axe is the elevation.  The center of the Blender's 3D space will be the center of you object, at the ground level.  Before exporting your model, apply the transformations  to each of your mesh (In the 3D space window's menu : ''Object->Clear/Apply->Apply ... ''This will place the center of your mesh (the yellow or pink dot) at the center of the Blender 3D space.
      the false value. Custom Color set if the alpha of the texture is
+
*If you have a non animating model, you have to set the start frame and the end frame to '1' in blenders 'timeline'-window. Otherwise a non animating animation will be exported, containing a lot of frames and your model gets really big.
      replaced for the color of the player.
+
*Before doing any texturing or animation, try to export your model and check your python console (the terminal which opens Blender) to see if there is a warning about the number of used faces in the summary. If there is, try to delete "false" faces (which use only 2 vertices) and transform all your faces in triangle.
     
+
   
TEXTURING :
+
==Exporting==
      To use a texture for the mesh, you must add a texture at the FIRST
+
*You MUST select the meshes you want to export.
      position to the mesh's material. The texture type must be 'image'
+
*Only meshes are exported among the selected objects.
      and you should insert the real image.  In fact, only the filename
+
*The diffuse color of the mesh will be it's (first) material's color.
      of the image is used.  After having mapped the image on the
+
*The opacity of the mesh will be it's material's alpha.
      mesh with UV Face selection, you don't need anymore to "stick"
+
*Double sided property of the mesh is exported (see F9).
      the coordinates to the vertices.
+
*f you want to use custom color in the texture, your mesh must be double sided. If you don't want custom color to be activated for the mesh, add a new boolean property to it (F4) named customColor and with the false value. Custom Color set if the alpha of the texture is replaced for the color of the player.
      Your texture's format must be TGA, without compression and with the origin
+
==Texturing==
      at the bottom left position.  The side of the image must be a multiple
+
To use a texture for the mesh, you must add a texture at the FIRST position to the mesh's material. The texture type must be 'image' and you should insert the real image.  In fact, only the filename of the image is used.  After having mapped the image on the mesh with UV Face selection, you don't need anymore to "stick" the coordinates to the vertices. Your texture's format must be TGA, without compression and with the origin at the bottom left position.  The side of the image must be a multiple of 2.  In practice, you must use only one image for all your meshes.
      of 2.  In practice, you must use only one image for all your meshes.
+
==Animation==
 +
You can export all animations made with blenders armature system. You have to set the start frame and the end frame in the 'timeline'-window  to define the animation which will be exported.
  
ANIMATING :
 
      You can export all animations made with blenders armature system.
 
      You have to set the start frame and the end frame in the 'timeline'-window
 
      to define the animation which will be exported.
 
      If you animate without using the armatures it will not work!!
 
  
      LINKS :
+
If you animate without using the armatures it will not work!!
      Animating with armatures
 
              http://www.blender.org/documentation/htmlI/x1829.html
 
      Map an image on your mesh with UV Face selection :
 
              http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/UV_Map_Basics
 
              http://download.blender.org/documentation/htmlI/ch11s05.html
 
  
CONVERT TO .G3D
+
Animating with armatures
      Use the xml2g program of the glexemel tool at
+
http://www.blender.org/documentation/htmlI/x1829.html
      http://www.glest.org/files/contrib/tools/
 
      Syntax : ./xml2g ExportedFile.xml DesiredFile.g3d
 
     
 
      WARNING : The current version of this program don't seems to work...
 
                You'll have to add the lines (if they aren't there) :
 
                      #pragma pack(push, 1)
 
                  near of the beginning of the file "g3dv4.h" of glexemel and
 
                      #pragma pack(pop)
 
                  before the #endif
 
  
  
ChangeLog :
+
Map an image on your mesh with UV Face selection :
 +
http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/UV_Map_Basics
 +
 
 +
http://download.blender.org/documentation/htmlI/ch11s05.html
 +
==Converting to G3D==
 +
The following is no longer needed if you copied g3d.dtd and xml2g(.exe) next  to this script:
 +
 
 +
Use the xml2g program of the glexemel tool at http://www.glest.org/files/contrib/tools/
 +
Syntax : ''./xml2g ExportedFile.xml DesiredFile.g3d''
 +
==
 +
Change Log==
 +
1.0: Big thanks go to Frank Tetzel (Yggdrasil) who finally made a
 +
            direct export to .g3d possible. If you copy g3d.dtd and
 +
            xml2g(.exe) next to this script it will export to .g3d.
 +
            If not, it will export to .xml like before.     
 +
      0.1.7 : by Titus Tscharntke (titi)
 +
          removed non 7-bit ascii characters for newer versions of python
 +
 +
 +
      0.1.6 : by justWeedy(weedkiller)
 +
Basic colorsettings for maps are often unused but may cause
 +
 +
          models look "bright".
 +
          There are Hardcoded defauld values to avoid this.
 +
          Turn On/Off due the boolean <useHardCodedColor>
 +
      0.1.5 : by weedkiller
 +
          You don't have to apply scale and rotation anymore
 
       0.1.4 : by weedkiller and Titus Tscharntke ( www.titusgames.de )
 
       0.1.4 : by weedkiller and Titus Tscharntke ( www.titusgames.de )
 
           New implementation of the animation export ( including some usage changes!!! )
 
           New implementation of the animation export ( including some usage changes!!! )
 
           Exporting animations is now possible with newer Blender versions ( tested with 2.43 )
 
           Exporting animations is now possible with newer Blender versions ( tested with 2.43 )
 
 
       0.1.3 : by Titus Tscharntke ( www.titusgames.de )
 
       0.1.3 : by Titus Tscharntke ( www.titusgames.de )
 
           Fixed a bug with getProperty() in blender 2.43
 
           Fixed a bug with getProperty() in blender 2.43
 
 
       0.1.2 :
 
       0.1.2 :
 
           Correcting an execution bug
 
           Correcting an execution bug
Line 111: Line 95:
 
           Adding a vertex duplication method to correct the vertex UV problem.
 
           Adding a vertex duplication method to correct the vertex UV problem.
 
           Correcting NMVert.uvco misuse
 
           Correcting NMVert.uvco misuse
 +
[[Category:Modelling]]

Revision as of 20:57, 18 March 2011

back to Modelling with Blender

The Blender xml-Exportscript

The exportscript is needed to export the model to an g3d-xml-reprensentation. This export can be converted to .g3d using the converter.

Newest version: Download at titusgames or usually older version at glest.org

Direct Export to G3D:

Frank Tetzel (Yggdrasil) made a direct export to .g3d possible. If you copy g3d.dtd and xml2g(.exe) from glexemel next to this script it will export to .g3d. If not, it will export to .xml like before. In case of windows you have to add the dlls too!

From the export file header:

INSTALLATION :

Copy this Script into your .blender\scripts directory. If you want direct .g3d support unpack all needed glexemel files to this directory too:


LINUX: In case of linux its only: xml2g and g3d.dtd ( included is a binary for linux32 bit). The sourcecode can be found here: http://www.glest.org/files/contrib/tools/glexemel-0.1a.zip WINDOWS: If you are using windows, all files from the "bin" directory from the following zip files are needed: http://www.glest.org/files/contrib/tools/glexemel_win32_0.1a.zip. In Blender, open a Script Window and in the menu choose "Update Menus".


Export with File->Export->G3D XML Exporter

Preparing the model

  • Each of your meshes' faces must be a triangle (3 vertex)
  • In Edit mode, you can press Space, edit>faces>Convert to Triangles
  • Create and place all your meshes before texturing or animating.
  • The X axe is the floor and the Y axe is the elevation. The center of the Blender's 3D space will be the center of you object, at the ground level. Before exporting your model, apply the transformations to each of your mesh (In the 3D space window's menu : Object->Clear/Apply->Apply ... This will place the center of your mesh (the yellow or pink dot) at the center of the Blender 3D space.
  • If you have a non animating model, you have to set the start frame and the end frame to '1' in blenders 'timeline'-window. Otherwise a non animating animation will be exported, containing a lot of frames and your model gets really big.
  • Before doing any texturing or animation, try to export your model and check your python console (the terminal which opens Blender) to see if there is a warning about the number of used faces in the summary. If there is, try to delete "false" faces (which use only 2 vertices) and transform all your faces in triangle.

Exporting

  • You MUST select the meshes you want to export.
  • Only meshes are exported among the selected objects.
  • The diffuse color of the mesh will be it's (first) material's color.
  • The opacity of the mesh will be it's material's alpha.
  • Double sided property of the mesh is exported (see F9).
  • f you want to use custom color in the texture, your mesh must be double sided. If you don't want custom color to be activated for the mesh, add a new boolean property to it (F4) named customColor and with the false value. Custom Color set if the alpha of the texture is replaced for the color of the player.

Texturing

To use a texture for the mesh, you must add a texture at the FIRST position to the mesh's material. The texture type must be 'image' and you should insert the real image. In fact, only the filename of the image is used. After having mapped the image on the mesh with UV Face selection, you don't need anymore to "stick" the coordinates to the vertices. Your texture's format must be TGA, without compression and with the origin at the bottom left position. The side of the image must be a multiple of 2. In practice, you must use only one image for all your meshes.

Animation

You can export all animations made with blenders armature system. You have to set the start frame and the end frame in the 'timeline'-window to define the animation which will be exported.


If you animate without using the armatures it will not work!!

Animating with armatures http://www.blender.org/documentation/htmlI/x1829.html


Map an image on your mesh with UV Face selection : http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/UV_Map_Basics

http://download.blender.org/documentation/htmlI/ch11s05.html

Converting to G3D

The following is no longer needed if you copied g3d.dtd and xml2g(.exe) next to this script:

Use the xml2g program of the glexemel tool at http://www.glest.org/files/contrib/tools/ Syntax : ./xml2g ExportedFile.xml DesiredFile.g3d == Change Log==

1.0: Big thanks go to Frank Tetzel (Yggdrasil) who finally made a 
           direct export to .g3d possible. If you copy g3d.dtd and 
           xml2g(.exe) next to this script it will export to .g3d. 
           If not, it will export to .xml like before.       
      0.1.7 : by Titus Tscharntke (titi)
          removed non 7-bit ascii characters for newer versions of python


     0.1.6 : by justWeedy(weedkiller)
Basic colorsettings for maps are often unused but may cause

          models look "bright". 
          There are Hardcoded defauld values to avoid this. 
          Turn On/Off due the boolean <useHardCodedColor>
      0.1.5 : by weedkiller 
          You don't have to apply scale and rotation anymore
      0.1.4 : by weedkiller and Titus Tscharntke ( www.titusgames.de )
          New implementation of the animation export ( including some usage changes!!! )
          Exporting animations is now possible with newer Blender versions ( tested with 2.43 )
      0.1.3 : by Titus Tscharntke ( www.titusgames.de )
          Fixed a bug with getProperty() in blender 2.43
      0.1.2 :
          Correcting an execution bug
          Adding the "frameCount" property for each object
          Using only the triangle faces for the index count
              (problems of linking between index and vertex may occur)
          Adding the summary display in the python console
          Adding a better documentation
      0.1.1b :
          Adding a vertex duplication method to correct the vertex UV problem.
          Correcting NMVert.uvco misuse