1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Ride into the sunset with the 32nd Modeling Contest.
    Dismiss Notice
  4. This adventure has come to an end. Congratulate our heroes in the 16th Mini Mapping Contest Results.
    Dismiss Notice
  5. From the gates of hell, the 5th Special Effect Contest Results have emerged.
    Dismiss Notice
  6. Race against the odds and Reforge, Don't Refund. The 14th Techtree Contest has begun!
    Dismiss Notice
  7. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Blender 2.57 static mesh exporter (robust)

Discussion in 'Modeling & Animation' started by Sooda, May 31, 2011.

  1. Sooda

    Sooda

    Joined:
    Dec 30, 2007
    Messages:
    48
    Resources:
    0
    Resources:
    0
    File is as a attachment. What it can do?

    1) Export static mesh
    2) Export texture

    What it does not do?

    1) Everything else

    This is base for future development.

    EDIT 02.07.2011 START
    Warcraft 3 wants texture to be flipped vertically to display correctly in Warcraft 3 Viewer. When I get time and know-how I make script automatically flip UV coordinates for Warcraft engine. I notify when it is done.
    EDIT 02.07.2011 END

    [​IMG]

    HOW-TO: Fire up Blender 2.57, load your mesh (give it a texture, might be optional, do not use procedural stuff). Go to 'Edit Mode', from 'Edit Mode' header press 'Mesh'. Pop-up window jumps up, choose 'Faces' > 'Quads to Tris'.
    Go to Text Editor, press Text > Open and open blend2war3mdl.py. Make sure your mesh is selected and press 'Run Script'.

    First of all change *.txt to *.py ending, though you can load it as txt file also I think. Forum did not allow *.py extension.

    Generated file will be saved on "C:\BLENDER_MDL.txt"

    From there you should know how to convert onwards. Python is pretty simple so change filepath where it will be saved if you want.

    I have jassing background and managed to end up with such script, if you take time and try to understand (it is pretty easy) you can contribute yourself too.

    Do not expect too much of it, all hate and praise welcomed.
     

    Attached Files:

    Last edited: Jul 2, 2011
  2. Arcmage

    Arcmage

    Joined:
    Jan 31, 2009
    Messages:
    162
    Resources:
    1
    Maps:
    1
    Resources:
    1
    I attempted to use this after following all the steps given (I think). I simply attempted to export the default cube after converting it to tries and giving it a texture. It gave me an error at line 30. Could you possibly post an example .blend? (with the script set up and a simple mesh ready to be exported)

    (Sorry if this is considered necroposting but I am very interested in a blender exporter for wc3)
     
  3. Sooda

    Sooda

    Joined:
    Dec 30, 2007
    Messages:
    48
    Resources:
    0
    Resources:
    0
    This is not a necropost, glad someone replyed. Which Blender version do you use? Which operating system do you use?

    I tried this script on Win 7 Blender 2.58 (latest, came out july 2011, update your version) and started Blender as Administrator (right click on Bledner icon and choose 'Run as Administrator'). "Exported" file will be created on your C:\Blender_MDL.txt

    If you have no administrator rights Blender complains can't write file (or open file to write) Blender_MDL.txt.
    Write back how your test went.

    To be specific Buggy-UV-5.blend is a Blender 2.58 file:
    [​IMG]
     

    Attached Files:

  4. Arcmage

    Arcmage

    Joined:
    Jan 31, 2009
    Messages:
    162
    Resources:
    1
    Maps:
    1
    Resources:
    1
    I tried to run it in 2.57b and in 2.58 on XP with administrator privileges. However it always got stuck on like 30. I was able to export the buggy from your blend file without issue and see it in both the wc3 model editor and in game (although the scale was tiny). I think I might have been doing the texture wrong or something.
     
  5. Sooda

    Sooda

    Joined:
    Dec 30, 2007
    Messages:
    48
    Resources:
    0
    Resources:
    0
    Glad to hear you got my demo file working. I might add do not try to use something super-advanced in Blender, if it is in the end mesh with image texture it should be exportable. Use advanced options, but before exporting reduce it to really basic form.
    With latest Blender (2.58 or any) you can't go really wrong with adding texture. If you want you could post your faulty blend file and maybe (really maybe, I am no expert at this field) I might spot what was wrong.
    To share some info, how I wrote this code, exporting UV coordinates is not optimized. Currently it converts face UV coordinates to sticky UV coordinates at 1:1 scale. This adds 2x (or even 3x) vertices count and additional faces to model. (Though in Blender there is way to choose between sticky UVs and face UVs, I do not know how exactly. I mean it is default vanilla Blender UV texture editor option [just activate it and vertices count remains optimized]).
    It is not perfect, but does the job and opens new possibilities to model free (tm) XD