Extensions:2.4/Py/Scripts/Export/M3G

提供: wiki
< Extensions:2.4‎ | Py‎ | Scripts‎ | Export
移動先: 案内検索

m3g_export

About

M3G in J2ME...
Export to M3G in J2ME file.(into Java Class).
UI location Group: Export
Version 0.8 Author(s) Gerhard Völkl
Blender 2.37 - 2.46 License GPL
Note(s) Included in Blender 2.46.


Executable information
File name export_m3g.py


Links http://www.nelson-games.de/bl2m3g/


Support


Usage

Instructions

To use script:

1.) load this file in the text window.
    (press SHIFT+F11, Open New via Datablock button)
2.) make sure your mouse is over the text edit window and
    run this script. (press ALT+P)
Or:
  copy to the scripts directory and it will appear in the
  export list. (Needs 2.32 or higher)


To-Do list

  • Export only selected mesh
  • Optimize Bones < - > Vertex Group mapping
  • Compressed File
  • MTex - Support
  • By Rotating use SQUAD instead of Beziere. It's smoother

History

 History 0.2
 * maximal Precision in VertexArray (with algorithms from Kalle Raita)
 * IPO Animation with mesh: Rotation, Translation and Size
 History 0.3
 * to find a 3d object in your java programm you can assign a userID
   your blender object has name 'cube#01' your 3d object will have ID 01
   the number after '#' is taken
 * more than one material per mesh can be used
 * uv texture support (implemented by Aki Koskinen and Juha Laitinen)
   The image which is bound to the faces will be exportet within m3g-file
   Limitations by M3G-API:
   The width and height of the image must be non-negative powers of two,
   but they need not to be equal. Maximum value is 256.
   *.java export: Only PNG images can be used.
 History 0.4
 * check limitation of texture images (credit to MASTER_ZION for Brasil)
 * Better light: The light modeles of Blender and M3G are naturally
   different. So the export script trys to translate as much as possible

   M3G Light type          Blender Light type
   --------------------------------------------------------------
   AMIENT Light            Not available as light type in Blender
   DIRECTIONAL Light       SUN
   OMNIdirectional light   LAMP
   SPOT light              SPOT
   not translated          HEMI
   not translated          AREA

   Attributs of M3G Lights:

   Attenuation (OMNI,SPOT):
     Intensity of light changes with distance
     The attenuation factor is 1 / (c + l d + q d2)
     where d is the distance between the light and the vertex being lighted
     and c, l, q are the constant, linear, and quadratic coefficients.
     In Blender exists much complex posibilies. To simplify exporter uses
     only button Dist: distance at which the light intensity is half
     the Energy
   Color (ALL)
     Color of light
   Intensity (ALL)
     The RGB color of this Light is multiplied component-wise with the
     intensity. In Blender : energy
   SpotAngle (SPOT)
     the spot cone angle for this Light
     In Blender: spotSize
   SpotExponent (SPOT)
     The spot exponent controls the distribution of the intensity of
     this Light within the spot cone, such that larger values yield
     a more concentrated cone. In Blender: SpotBl

 * Some GUI for options
   First prototype of GUI was created using RipSting's Blender-Python
   GUI designer. Download at Http://oregonstate.edu/~dennisa/Blender/BPG/

 * Ambiente light
   Information is taken by world ambiente attribute

 * Parenting Part 1
   In Blender the Empty object is used to group objects. All objects
   which have the same empty as parent are the member of the same group.

   empty <-- Parent of -- element 1
        <-- Parent of -- element 2

       is translated in M3G

   group-Node -- Member --> element 1
              -- Member --> element 2

   In Blender every object can be the parent of every other object
   In M3G that is not possible. Only a group object can be parent.
   (Or the world object which is derived from group).
   That will come later as Parenting Part 2

 * Backface Culling
   you can use backface culling, if option "use backface culloing" is on.
   Culling will be set in PolygonMode object of every mesh. The correct
   winding is controlled.
  History 0.5
 * Bone Animation - Armature (Part 1)

  Armature is the skeleton for skinned meshes. It stores the bones in
  rest position (more information http://www.blender.org/cms/How_Armatures_work.634.0.html)
  You can work in Blender with bones and meshes in different ways. In
  this first attempt only the use of vertex groups is assisted.

  Blender-Objekts       translated into      M3G-Objects

      MESH                                  SkinnedMesh
        |                                       |
        v                                       v
     ARMATURE                                 Group
        |                                       |
        v                                       v
      BONE_1                                  Group
                                              Group_second
        |                                       |
        V                                       v
      BONE_2                                  Group
                                              Group_secound

  Every bone is translated into two groups at the moment, because
  the second bone is needed to do the animation in an easy way.

  The animations in Blender for meshes are stored in action objects.

  Blender Objects      translated into      M3G-Objects

   ARMATURE
       | activ
       v
    ACTION                               ANIMATIONCONTROLLER
       | 1..n                                    ^
       v                                 ANIMATIONTRACK  --> Group_second
     IPOs                                        |
                                                 v
                                            KEYSEQUENZE

  One action is translated into one animationcontroller. One IPO is
  translated in one KEYSEQUENZE and one ANIMATIONTRACK.

  At the moment only the active action of the armature object is translated.

 * Print Info, if type of light is used that is not supported

 History 0.5

 * New Option exportAllAction (default value: false)
  If that option is true, all actions will be exported - not only the active
  action.
  At the moment you can only assign one action to one armature.
  To know which action is used with which armature the action
  needs a special name :
        <Action Name>A<M3G ID of Armature>E<End Frame><ID of Action>

  Example: Name of action : walkA10E25002
           Name of armature : man10
           End Frame: 250

 History 0.6
 Include the same image only one time into the m3g-file
 * Until now all vertices of the faces was been written.
  Now the vertices will be used again if possible:
     normal and texture coordinates of to vertices have to be the same

 * Smooth/solid shading can now be defined for every single material:
     in Editing panel (F9)>Link and Materials

 * This script uses now correctly the TexFace and Shadless Buttons in
  Shading panel (F5)>Material buttons>Material box.
  TexFace switches on/off the Export of texture coordinates.
  Shadeless does the some with the normal coordinates

 * The GUI was redesigned in a PupBlock

 * Options:

 ** Texturing Enabled: Switches on/off export of textures and texture
           coordinates. Attention: the TextFace button switches only
           for one mesh
 ** Texturing External: the textures will be included it mg3-file or
           exported in seperate file
 ** Lighting Enabled: turns on/off export of lights and normal completly
           Attention: Shadeless only for one mesh
 ** Persp. Correction: turns on/off perspective correction in PolygonMode.
 ** Smooth Shading: turns on/off smooth shading in PolygonMode.

 * Textures in external references are used again (with ImageFactory)

 * Blender function: Double Sided button in Editing Context
                    (F9)>Mesh panel)
  turn on/off PolygonMode.CULL_BACK anzuschalten.

 * Script ingnores meshes that have no faces

 History 0.7

 * Exporter can work with texture coordinates greater 1 and smaller 0

 * Adler32 did not work always correct. New implementation made.

 * Modul shutil is not needed any longer. Exporter has its own copy_file.
   (realized and inspired by ideasman_42 and Martin Neumann)

 History 0.8

 * Blender works with SpotAngles 1..180 but M3G works only with 0..90
   M3G use the 'half angle' (cut off angle) (Thanks to Martin Storsjö)

 * Error fixed: Texture coordinates was not calculated correct.
   (Thanks to Milan Piskla, Vlad, Max Gilead, Regis Cosnier ...)

 * New options in GUI:
      M3G Version 2.0 : Will export M3G files Vers. 2.0 in future
      Game Physics: Adds Game Physics infos for NOPE API