Difference between revisions of "Exportscript"

From MegaGlest
Jump to navigation Jump to search
Line 7: Line 7:
  
 
newest version:
 
newest version:
[http://www.titusgames.de/blender/g3d_xml_exporter_v0.1.3.zip download at www.titusgames.de ]
+
[http://www.titusgames.de/blender/g3d_xml_exporter_v0.1.4.zip download at www.titusgames.de ]
  
 
older official version (doesn't work for blender 2.43):
 
older official version (doesn't work for blender 2.43):
Line 13: Line 13:
  
 
''' Attention!!: '''
 
''' Attention!!: '''
  the current version is  Ver: 0.1.3 (May 2 2007)
+
  the current version is  Ver: 0.1.4 (May 2 2007)
 
  the download at glest.org is the old one!! [http://www.glest.org/files/contrib/tools/ Dont't use this old version  from  www.glest.org !!]  
 
  the download at glest.org is the old one!! [http://www.glest.org/files/contrib/tools/ Dont't use this old version  from  www.glest.org !!]  
  
 
'''From the export file header:'''
 
'''From the export file header:'''
  
 +
INSTALLATION :
  
INSTALLATION :
 
 
       Copy this Script into your .blender\scripts directory
 
       Copy this Script into your .blender\scripts directory
 +
 
       In Blender, open a Script Window and in the menu choose "Update Menus"
 
       In Blender, open a Script Window and in the menu choose "Update Menus"
 +
 
       Export with File->Export->G3D XML Exporter
 
       Export with File->Export->G3D XML Exporter
 +
 +
  
 
PREPARE THE MODEL :
 
PREPARE THE MODEL :
 +
 
       Each of your meshes' faces must be a triangle (3 vertex)
 
       Each of your meshes' faces must be a triangle (3 vertex)
 +
 
       In Edit mode, you can press Space, edit>faces>Convert to Triangles
 
       In Edit mode, you can press Space, edit>faces>Convert to Triangles
 +
 
       Create and place all your meshes before texturing or animating.
 
       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
 
       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
 
       of the Blender's 3D space will be the center of you object, at the
 +
 
       ground level.  Before exporting your model, apply the transformations
 
       ground level.  Before exporting your model, apply the transformations
 +
 
       to each of your mesh (In the 3D space window's menu :
 
       to each of your mesh (In the 3D space window's menu :
 +
 
                           Object->Clear/Apply->Apply ... )
 
                           Object->Clear/Apply->Apply ... )
 +
 
       This will place the center of your mesh (the yellow or pink dot)
 
       This will place the center of your mesh (the yellow or pink dot)
 +
 
       at the center of the Blender 3D space.
 
       at the center of the Blender 3D space.
        
+
 
 +
 
 +
       !!!!!!!!!!!!!!     
 +
      !!!new in 0.1.4: !!!
 +
      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
 
       Before doing any texturing or animation, try to export your model and
 +
 
       check your python console (the terminal which opens Blender) to see
 
       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 a warning about the number of used faces in the summary.
 +
 
       If there is, try to delete "false" faces (which use only 2 vertices)
 
       If there is, try to delete "false" faces (which use only 2 vertices)
 +
 
       and transform all your faces in triangle.
 
       and transform all your faces in triangle.
 +
 
        
 
        
 +
 
EXPORTING :
 
EXPORTING :
 +
 
       You MUST select the meshes you want to export.
 
       You MUST select the meshes you want to export.
 +
 
       Only meshes are exported among the selected objects.
 
       Only meshes are exported among the selected objects.
 +
 +
  
 
       The diffuse color of the mesh will be it's (first) material's color.
 
       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.
 
       The opacity of the mesh will be it's material's alpha.
 +
 
       Double sided property of the mesh is exported (see F9).
 
       Double sided property of the mesh is exported (see F9).
 +
 
       If you want to use custom color in the texture, your mesh must be
 
       If 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
 
       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
 
       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
 
       the false value.  Custom Color set if the alpha of the texture is
 +
 
       replaced for the color of the player.
 
       replaced for the color of the player.
 +
 
        
 
        
 +
 
TEXTURING :
 
TEXTURING :
 +
 
       To use a texture for the mesh, you must add a texture at the FIRST
 
       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'
 
       position to the mesh's material. The texture type must be 'image'
 +
 
       and you should insert the real image.  In fact, only the filename
 
       and you should insert the real image.  In fact, only the filename
 +
 
       of the image is used.  After having mapped the image on the
 
       of the image is used.  After having mapped the image on the
 +
 
       mesh with UV Face selection, you don't need anymore to "stick"
 
       mesh with UV Face selection, you don't need anymore to "stick"
 +
 
       the coordinates to the vertices.
 
       the coordinates to the vertices.
 +
 
       Your texture's format must be TGA, without compression and with the origin
 
       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
 
       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.
 +
 +
  
 
ANIMATING :
 
ANIMATING :
      It was only tested with the 'absolute vertex key' method, but it should
+
 
       work with all the Blender's animation methods.
+
       You can export all animations made with blenders armature system.
      I recommend 'relative vertex key' if you want to modify you mesh later.
+
 
      Don't forget to APPLY TRANSFORMATIONS before adding vertex keys.
+
       You have to set the start frame and the end frame in the 'timeline'-window
       You must add a "frameCount" property to the objects that are animated.
+
 
      It's and Integer property (F4) name frameCount which contains the
+
       to define the animation which will be exported.  
       desired number of frames of the object, starting at frame 1.
+
       If you animate without using the armatures it will not work!!
       If and object don't have the "frameCount" property, only the first frame
+
 
      will be exported.
 
  
 
       LINKS :
 
       LINKS :
       Absolute vertex key animation method :
+
       Animating with armatures
               http://download.blender.org/documentation/htmlI/ch15.html
+
               http://www.blender.org/documentation/htmlI/x1829.html
 +
 
 
       Map an image on your mesh with UV Face selection :
 
       Map an image on your mesh with UV Face selection :
 +
 
               http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/UV_Map_Basics
 
               http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/UV_Map_Basics
 +
 
               http://download.blender.org/documentation/htmlI/ch11s05.html
 
               http://download.blender.org/documentation/htmlI/ch11s05.html
 +
 +
  
 
CONVERT TO .G3D
 
CONVERT TO .G3D
 +
 
       Use the xml2g program of the glexemel tool at
 
       Use the xml2g program of the glexemel tool at
 +
 
       http://www.glest.org/files/contrib/tools/
 
       http://www.glest.org/files/contrib/tools/
 +
 
       Syntax : ./xml2g ExportedFile.xml DesiredFile.g3d
 
       Syntax : ./xml2g ExportedFile.xml DesiredFile.g3d
 +
 
        
 
        
 +
 
       WARNING : The current version of this program don't seems to work...
 
       WARNING : The current version of this program don't seems to work...
 +
 
                 You'll have to add the lines (if they aren't there) :
 
                 You'll have to add the lines (if they aren't there) :
 +
 
                       #pragma pack(push, 1)
 
                       #pragma pack(push, 1)
 +
 
                   near of the beginning of the file "g3dv4.h" of glexemel and
 
                   near of the beginning of the file "g3dv4.h" of glexemel and
 +
 
                       #pragma pack(pop)
 
                       #pragma pack(pop)
 +
 
                   before the #endif
 
                   before the #endif
 +
 +
 +
 +
 +
 +
ChangeLog :
 +
 +
      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
 +
 +
#

Revision as of 22:03, 29 May 2007

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 www.titusgames.de

older official version (doesn't work for blender 2.43): download at glest.eurion.net

Attention!!:

the current version is  Ver: 0.1.4 (May 2 2007)
the download at glest.org is the old one!! Dont't use this old version  from  www.glest.org !! 

From the export file header:

INSTALLATION :

      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.


      !!!!!!!!!!!!!!       
      !!!new in 0.1.4: !!!
      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).
      If 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.


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 :
      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

      Use the xml2g program of the glexemel tool at
      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 :

      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