KatsBits Community

[ASE] Import/Export scripts for Blender 3D

kat · 50 · 185041

0 Members and 3 Guests are viewing this topic.

Offline kat

  • Administrator
  • Hero Member
  • *
    • Posts: 2692
    • KatsBits
ASE Import and export scripts for Blender 2.5 series (up to 2.56+/- only. NOTE: may work with other versions - test before use). Both import and export scripts  should be placed in Blenders "scripts\addons" (or "scripts\io" if scripts\addons doesn't appear to be working) folder. If there are any other ASE scripts present it's best to remove or rename them as Blender 2.5 tends to like scripts following a specific naming convention.

Download
Installation for 2.56+/-
Make sure you are using an officially released version of Blender (available from Blender.org) before using these scripts - in-development versions of Blender may break scripts so test before use.

Both scripts need to be placed in the following location;
Code: [Select]
scripts\addons\
For Windows Vista/Win7  users Blender's scripts folder is typically located in;
Code: [Select]
C:\Users\[profile]\AppData\Roaming\Blender Foundation\Blender 2.53\scripts\addons\
Windows XP users should look in;
Code: [Select]
C:\Documents and Settings\[profile]\Application Data\Blender Foundation\Blender 2.53\scripts\addons\
Linux and Mac installation will differ depending on OS version used.

Using the ASE export script
For additional and extensive ASE export details read the ASE export tutorial here.

ASE Export
As with other scripts, select the object or objects that need to be exported and click "File »  Export » Ascii Scene Export (ase)". Type a name or select the file to overwrite, and then click the "Export ASE" button to export the model.

Model scale default is set to "16", this is a multiplier so it will scale your object up by sixteen (or "[n]" value input). To export objects 'as is', set the "Scale: [n]" value to "1" ("Scale: 1").

Quote
Note: remember that you can export several objects as a single mesh to get a multi sub-object mesh (has several "GEOMOBJECTS" written into the ASE) with multiple materials. Or, an object where sub-objects are joined before export producing a single model with one multi-material. Additionally, it's currently not possible to export 'blank' meshes, i.e. all meshes need a material, texture and UVW map else the process reads them as being incomplete, halting the export procedure.



ASE Import
From the "File" menu select "Import » Ascii Scene Export (ase)", then select the file to be imported into Blender. To import a model 'as is' without altering the size of the object/s, from "Import ASE" section change the "Scale: [n]" value to "1" (default currently "0.06").



Problems and Errors
There are a couple of basic script related issues you need to be aware of when exporting or importing meshes and models;
  • The script is currently written to halt on finding 'blank' meshes, i.e. a mesh object without materials, textures or UVW maps will stop the process.
  • If Blender complains about 'periods', check the file names to make sure they're as follows as anything else may return a script error in the Python console.
    • export_ase.py
    • import_ase.py
  • Similarly, if the script doesn't appear in the "File » Import/Export" menus check file name conforms to the above.
 
Misc & UT/UDK editing
For Unreal Development Kit and Unreal Engine usage, models are not currently exported correctly where MULTI-MATERIALS (multiple materials) are needed; although objects do contain individual  elements, they are defined at the OBJECT and not the MATERIAL level. This means that models for UT/UDK can only contain ONE material and ONE texture. Other issues exist, for more details read this topic.


Offline motorsep

  • Jr. Member
  • *
    • Posts: 75
Doesn't work with 2.55.1

===================================
Traceback (most recent call last):
  File "/home/motorsep/software/blender25/2.55/scripts/io/export_ase.py", line 494, in invoke
    wm.add_fileselect(self)
AttributeError: 'WindowManager' object has no attribute 'add_fileselect'

location:<unknown location>:-1

location:<unknown location>:-1
===================================


Offline kat

  • Administrator
  • Hero Member
  • *
    • Posts: 2692
    • KatsBits
I'm guessing that's the latest Graphicall(?) release? The scripts always break on those (unstable) in development versions of Blender, you must be using the officially released version available from Blender.org; the ASE exporter works in that (just tested it to double check).



Offline shumphries

  • Newbie
    • Posts: 2
I've installed the script, but when I try to use it I get an error to say that my mesh is not UV mapped.  Your instructions say the mesh must have material, texture and uv mapping.  That confuses me, because I thought that uv mapping was just a way to create a texture.  My lack of understanding, clearly.  Could you be more specific about what my mesh needs before I can export it, please. 


Offline kat

  • Administrator
  • Hero Member
  • *
    • Posts: 2692
    • KatsBits
Read this section of the Learning Blender 2.5 tutorial series that deals with UVW maps specifically.

To give a quick reply here though, UVW maps are a necessary component of game models because the coordinates ("U", "V" and "W") of the 'map' itself are used by games to figure out how textures are supposed to be applied over a mesh, without them, engine tech is basically looking at a blank canvas. UVW maps don't specifically relate to textures directly in terms of how those are made (except to 'map' areas of a texture to certain corresponding areas on a model).

That error means that if you could get that model into game, it'll likely appear with some form of "shader not found" default image (or depending on the game engine being used, more commonly flat lit as either solid 'black' or 'white') because the game won't be able to map textures to the mesh (so the script is replicating that by spitting out the same message).

So make sure your mesh has at least one material (with an associated texture/image), and some form of a UVW map present before export.


Offline shumphries

  • Newbie
    • Posts: 2
Got it!  Thanks for your help. 

By the way, your tutorial on UV mapping was great.  The first one I have fully understood. 


Offline kat

  • Administrator
  • Hero Member
  • *
    • Posts: 2692
    • KatsBits
ASE export script appears to be broken in Blender 2.56beta with the following error (similar to one mentioned above);
Code: [Select]
Traceback (most recent call last):
  File "C:\Users\Ken\AppData\Roaming\Blender Foundation\Blender\2.56\scripts\io\export_ase.py", line 494, in invoke
    wm.add_fileselect(self)
AttributeError: 'WindowManager' object has no attribute 'add_fileselect'

location:<unknown location>:-1


Offline kat

  • Administrator
  • Hero Member
  • *
    • Posts: 2692
    • KatsBits
OK, a fix came in via NB - cheers matey.
Download the fixed ase export script from the downloads page. Or open the script in a text editor and find line 494 or the below text;
Code: [Select]
wm.add_fileselect(self)
Replace with;
Code: [Select]
wm.fileselect_add(self)


Offline LeiterJakab

  • Newbie
    • Posts: 5
I use the official 2.56b and get the following error:
Code: [Select]
Line 474, in execute if os.path.exists(self.properties.filepath):
UnicodeDecodeError:'utf8'codec can't decode bytes in position 30-33:invalid data location<unknown location>:-1


Offline kat

  • Administrator
  • Hero Member
  • *
    • Posts: 2692
    • KatsBits
Need a bit more info all systems and directory related..
  • What OS/Blender/Python are you using?
  • Where is Blender installed to?
  • Where are the scripts located?
  • Where did you try and export the file to?


Offline LeiterJakab

  • Newbie
    • Posts: 5
Sorry about the lack of info.

I have Windows XP SP3/Blender2.56a(blender.org version)/bundled Python
Blender is installed to: C:\Program Files\Blender Foundation\Blender
script location: C:\Program Files\Blender Foundation\Blender\2.56\scripts\io
I tried exporting to the desktop and the documents folder.

Installing with the ApplicationData folder option did not work for me, that's why I have my user data in the same place.

The full error message:
Trackback (most recent call last):
File "C:\Progra~1\Blende~1\Blender\scripts\io\export_ase.py", line474, in execute
if os.path.exists(self.properties.filepath):
UnicodeDecodeError: 'utf8'codec can't decode bytes in position 30-33: invalid data
location:<unknown location>:-1


Offline kat

  • Administrator
  • Hero Member
  • *
    • Posts: 2692
    • KatsBits
Hmm looks like you've got two problems there. For some reason it's not seeing the "2.56" segment of the path location for the scripts. I'm also guessing the presence of the (pre Win98) truncation symbols ("~") may also be causing issues (although I'm puzzled as to why because that's an established 'system' protocol). Not sure how to get around this one to be honest, but a few things you could try... you might try setting the Python System path to see if that stops Blender/Python from truncating the directory names. Also try re-installing Blender/Python to folders/directory's not using any 'special' characters in them; the "." counts as one iirc, so "256" instead of "2.56".


Offline Franktrog

  • Newbie
    • Posts: 2
How does one use the ASE exporter with the Windows 7 64 bit version of Blender 2.49b? I went to the folder suggested to place it in but it of course was not there as no self installer has been made for the 64bit version as of yet.


Offline kat

  • Administrator
  • Hero Member
  • *
    • Posts: 2692
    • KatsBits
With 2.49 you should be able to load the script into the Text View (Shift+F11) and run it with "Alt+P" irrespective of which version of Windows you're on, that's what I usually do. I don't currently have access to a W7 machine so can't test/confirm this though. Post back if it works.