Jump to content
The Dark Mod Forums

ASE Export Script for Blender 2.53 Beta


rich_is_bored

Recommended Posts

I'm fairly confident in the results of this script so I'm making it available.

 

Download

 

I wanted to implement pop-up dialogs whenever there's a problem like trying to write to a file that already exists but for now I've had to resort to printing out a message in the console and aborting.

 

export_ase.py should be copied to the scripts/io folder within your Blender directory. For those with Linux or OSX I guess that directory can be found in the home folder. Once in place, the next time you start Blender 2.53, ASE will be available under File > Export.

 

The exporter only exports mesh objects. They must have a material assigned and they must be UV mapped. Object transformations are applied. Quads are converted to triangles. The shader reference is gathered from the image texture filename.

 

If anything I've described above is not clear, be patient. I'm going to produce a tutorial that walks you through the installation process for each plug-in along with vertex painting something from Dark Radiant.

Edited by rich_is_bored
  • Like 2
Link to comment
Share on other sites

Possible problem here, or I'm doing something wrong. While importing from DR and then exporting works fine, I can't create something new and export as ASE.

 

1. New, Add cube

2. go to UV and load an image

3. in edit mode, unwrap

4. in textured mode, this shows the 6 sides of the cube covered with the image.

5. Select and Export ASE -- give it a name and Export.

 

But no file exists (repeated attempts) :unsure:

 

I also tried applying a material before saving but that didn't work and shouldn't be necessary anyway. Edit: maybe the mesh needs a name? Technical details going beyond my very limited knowledge.

Link to comment
Share on other sites

When there is a problem it prints out a message in the console and aborts. The console in Blender is the DOS or BASH terminal running in the background.

 

When following the steps outlined above I get the message "Mesh has no material" which is true because you loaded an image in UV Layout. You haven't assigned the texture to the object through the properties panel in the default layout.

 

When switching to the default layout, if you look at the material properties you'll see nothing is assigned. So first assign a material to the object. Then in the texture properties, change the type to image, select your image in the image panel, and change the mapping to UV, and select the newly created UV in the layer textbox.

Link to comment
Share on other sites

Trying again but I'm still not getting something right apparently.

 

1. New. Add cube.

2. Click the 'Material' button. Click New button. Result is Material.001 and some panes.

3. Click the 'Texture' button. A listbox of checkerboard icons appears. Click New button. Result is Texture.001 and some panes.

4. Change 'Clouds' to 'Image or Movie'

5. Under 'Image', click Open. Browse to a TGA and open it. It shows in the Preview box.

6. Under 'Mapping', change 'Generated' to 'UV'. Here's where the steps above get muddled a bit: in the Layer box, there is nothing but a checkered ball, no list of entries. Leave as ball, leave Projection as Flat.

7. In my UV map window, click the picture icon, and choose my TGA. There it is.

8. In the 3D window, go to Textured mode. It doesn't show the texture. Select, go to Edit mode. Spacebar, Unwrap. Now I see the texture on the cube faces. Back in Object mode, the textures remain. All seems well.

 

So, I have a cube, seemingly with a material/texture, seemingly with a UV map and texture assigned, and Textured mode shows it.

 

9. Select the cube, and ASE export: d:\temp.ase

NOTE: here, the export dialog suggests a .blend file. Possible bug or problem?

 

End result: there is not temp.ase at d:\. I've tried other paths, I've tried 'tricking' the dialog into suggesting .ase instead of .blend by exporting a working ASE (from DR) first, I've tried creating multiple cubes, each with different UV mapped materials. None of it worked. Am I doing anything wrong? Here's the log:

 

found bundled python: D:\programs\BLENDE~1.5-A\.blender\python
RNA_string_set: EXPORT_SCENE_OT_ase.filename not found.
RNA_string_set: EXPORT_SCENE_OT_ase.directory not found.
*** ASE Scene Exporter v0.01 ***
Traceback (most recent call last):
 File "D:\programs\BLENDE~1.5-A\.blender\scripts\io\export_ase.py", line 470, i
n execute
   model = gatherData()
 File "D:\programs\BLENDE~1.5-A\.blender\scripts\io\export_ase.py", line 425, i
n gatherData
   geolist = cGeomObjList()
 File "D:\programs\BLENDE~1.5-A\.blender\scripts\io\export_ase.py", line 137, i
n __init__
   geoobj = cGeomObject(object)
 File "D:\programs\BLENDE~1.5-A\.blender\scripts\io\export_ase.py", line 160, i
n __init__
   self.mesh = cMesh(object)
 File "D:\programs\BLENDE~1.5-A\.blender\scripts\io\export_ase.py", line 196, i
n __init__
   self.cvertlist = cCVertlist(object)
 File "D:\programs\BLENDE~1.5-A\.blender\scripts\io\export_ase.py", line 316, i
n __init__
   for face in object.data.vertex_colors[0].data:
IndexError: bpy_prop_collection[index]: index 0 out of range

Link to comment
Share on other sites

Aha, that succeeded at exporting the ASE.

 

However, on trying to re-import it, I don't see any texture in Textured mode. Seems the image has been erroneously named "Image - 0" instead of the stained glass I used when I exported it. We're gettin' there...

 

Here's the log:

found bundled python: D:\programs\BLENDE~1.5-A\.blender\python
wmSubWindowSet 0: doesn't exist
RNA_string_set: EXPORT_SCENE_OT_ase.filename not found.
RNA_string_set: EXPORT_SCENE_OT_ase.directory not found.
*** ASE Scene Exporter v0.01 ***
Writing d:\blah3.ase
Complete.
wmSubWindowSet 0: doesn't exist
wmSubWindowSet 0: doesn't exist
wmSubWindowSet 0: doesn't exist

Link to comment
Share on other sites

I have to confess. I assumed a series of bare bones scripts that allowed you to import a model exported from DarkRadiant, switch to vertex paint mode, apply some color, and export would suffice. In fact if you do just that, the scripts work fine.

 

I never expected one would use the plugin for any other purpose and that seems to be what you're trying to do here.

 

Let's forget the plugins for just a moment and focus on idTech 4. Would I be correct to assume that your goal is to produce content that works within TDM? How about knowing the difference between a material shader and an image file? And lastly that no matter if you're working with brushes, patches, or models that in an idTech 4 engine you reference material shaders not the images directly?

 

How a model appears textured within Blender is irrelevant as that is not how texturing works in idTech 4. And while there is nothing wrong with applying images to the models within Blender for preview purposes, when it comes time to export you need to reference a material shader and only the material shader.

 

At any rate, I'm learning a lot from this and it will help both the script and tutorial I'm writing.

Link to comment
Share on other sites

I have to confess. I assumed a series of bare bones scripts that allowed you to import a model exported from DarkRadiant, switch to vertex paint mode, apply some color, and export would suffice. In fact if you do just that, the scripts work fine.

If that means one can apply vertex blending without having to see the texture in Blender then that is fine by me. So as an example, a grassy hill made of patches with a stone path patch up the hill. So exported as a model I could see the edge of the path even if cannot see the textures and so vertex paint over that and export it back and voila! ? I'd be happy with that if it works. I'm rusty on vertex blending but what I recall I don't think I could see the texture anyway when I was doing it in Blender.

 

Again, until I can find time to explore this I can't really ask sensible questions.

Link to comment
Share on other sites

I have to confess. I assumed a series of bare bones scripts that allowed you to import a model exported from DarkRadiant, switch to vertex paint mode, apply some color, and export would suffice. In fact if you do just that, the scripts work fine.

I'm confused. This isn't to be a general ASE export script for the Blender community? You mentioned in the other thread that you didn't want to specialize the scripts as people will surely download the wrong version (general version vs. DR friendly versions), but who else will be using them if they're only made for DR users?

 

(Not hostile I assure you, just confused! :) )

 

Would I be correct to assume that your goal is to produce content that works within TDM?

Yep, for me at least. The vertex painting thing is drool worthy, and of course the ability to simply make a (new) model and export the ASE easily (w/o manual material hacking if possible) for use in TDM is the other 50% of the battle. These two things would revolutionize Blender's usage for TDM.

 

The rest of the questions confused me. :blush:

 

At any rate, if you specialize your scripts to be "DR<->Blender vertex modeling" only, that's still useful. I just hope that someday there is also a general ASE export script that allows for easy model creation for TDM.

Link to comment
Share on other sites

It is a general purpose export script. You are not required to import meshes from DarkRadiant in order to use this plugin. You can make your own entirely within Blender.

 

However, if you intend to use those models within the idTech 4 engine (the engine TDM is built on) you need to adjust your work flow to accommodate the engine. The most important concept to grasp here is that there is a layer of abstraction between polygons and the textures applied to them called material shaders.

 

If you don't know what a material shader is, and as a mapper you should know, I hope you take the time to read the texturing section I wrote on modwiki.net. You can find a link in my signature.

Link to comment
Share on other sites

It is a general purpose export script.

Ok, I wasn't sure, as I'm still unable to create a fully useable file. See the problem from above:

However, on trying to re-import it, I don't see any texture in Textured mode. Seems the image has been erroneously named "Image - 0" instead of the stained glass I used when I exported it. We're gettin' there...

Since I couldn't yet get it working for general ASE usage, it furthered my assumption this suite of scripts was being specialized to DR work only (since materials are handled differently). Possible remaining bug?

 

If you don't know what a material shader is

I'm certainly no expert, but I've written a few and played with properties over the years, and produced a few ASEs for TDM (including hand editing of materials into *BITMAP).

 

Anyway, to clarify: having working scripts either is fantastic. I simply misunderstood the intention I guess.

Link to comment
Share on other sites

@rich_is_bored: so can you confirm that's a bug or no? I'm talking about for the sake of it being a 'general purpose' script, not for TDM and DR.

 

http://forums.thedarkmod.com/topic/11399-ase-export-script-for-blender-25/page__view__findpost__p__223781

 

I've tried various things but while it does export the ASE, upon re-importing it all materials are broken, renamed "Image_0", "Image_1" (in UV editor) and "Texture_1", "Texture_2" in the materials and textures tabs. What are paths when I reload them are instead, "Material" or "Material.001".

 

Looking inside the ASE, I see this, though I cannot say for sure it's wrong:

 

 

*MAP_NAME "Texture.001"
*MAP_CLASS "Bitmap"
*MAP_SUBNO 1
*MAP_AMOUNT  1.0000
*BITMAP "\\base\d:\doom3\darkmod\textures\darkmod\glass\victorian02_ed.jpg"

 

And here's the ASE itself:

untitled.ase.txt

 

When exported, it was saved with these warnings:

 

wmSubWindowSet 0: doesn't exist

wmSubWindowSet 0: doesn't exist

wmSubWindowSet 0: doesn't exist

Link to comment
Share on other sites

You probably already know, but to be sure:

 

I do still get the issue described with 'general purpose' ASE export (or import; I'm not sure where the problem lies) for the script versions released today. There is a slight difference; though the textures are still renamed "Image_0" etc., they do seem to reference the correct image files in the UV editor now. Still don't show on models in textured mode though.

 

Just FYI

Link to comment
Share on other sites

Hm, and there's also still a chance it's user error or misunderstanding.

 

I created an export of a simple cube. When I re-imported it to blender, as I mentioned it did retain the path to the correct image file, even though it named it Image_0 (unless I left it default?) and even though the model in textured mode showed as white (to my understand, not having a texture associated with it?) as soon as I went into edit mode and again selected the texture in the UV editor, it then showed.

 

My hangup is the again part. I would have expected it to display correctly in textured mode upon import, not require me to do those steps again. If there were 100 textures, I'd have to reload all 100 by hand in the UV editor to see them again? With my 3-cube export, I had to reload them all in the UV editor to show, and I found that I could click any of the three and thus swap them between each cube. Of course, I don't want that; I want a given material to be assigned to the correct cube.

 

You might be shaking your head or laughing right now... part of the problem here is I'm not sure if there is a problem (with blender or either script), or just my lacking understanding. :wacko:

 

 

Edit: Looking in the Outliner, I see the image_0, image_1, and image_2 DO seem to be associated with one of the cubes each. So that just begs, why don't they display upon import and switching to textured mode?

 

Hmm... brb

Link to comment
Share on other sites

Okay, my updated guess is one of three things:

 

1. blender has a bug maybe?

2. one or both of the scripts fails to save/restore the UV info maybe?

3. or the most likely candidate: I'm misunderstanding how this is "supposed" to work in general terms

 

Here are two ginormous pics. They show what is my limited understanding of everything being ok, but the result being wrong. Textured mode. UV display. Textures are correct. File paths are correct. Blender finds and displays the files, one different one per cube. Everything seems fine, except... the UV editor is not automatically populated with the correct texture (I have to manually pick it from the popup list -- this cannot be right), and no texture displayed on the cubes unless/until I unwrap again.

 

This should've probably been my first post, but I'll leave the others in case anyone else is reading and having the same problem or wants to learn.

 

post-58-128000200136_thumb.jpg post-58-128000201796_thumb.jpg

 

Edit: also forgot to mention: reloading a .blend of this same scene works to show the textures automatically.

 

Sorry about all this trouble, but I'm tryin!

Link to comment
Share on other sites

@rich_is_bored: any further info here? To simplify my long-windedness: when I open the .blend in blender, I get the first pic. All materials are displayed and associated with the objects (assuming all paths are preserved). UV mapping ready to tweak.

 

post-58-128015192175_thumb.jpg

untitled.blend.txt

 

When I import the .ase (created from exporting the three objects in the .blend), the cubes do have a texture associated, however they're not displayed in textured mode, and UV mapping is not ready. I must manually choose the textures before anything can be seen or done (obviously a problem if using many materials).

 

post-58-128015242659_thumb.jpg

untitled.ase.txt

Link to comment
Share on other sites

This is an inconvenience rooted within Blender itself. If you import the ASE, you can see in the texture panel that the image has been assigned and loaded. In fact, if you push F12 to render, you'll see the texture applied to the object.

 

For some reason in order for textured viewport shading to work, you have to go into the UV editor and select the same image there. I don't know why this disconnect between the texture panel and textured viewport shading exists.

 

It makes perfect sense to me that if Blender can render a texture that's assigned via the texture panel that it should be able to render it when you select textured viewport shading. Why you need to go into the UV editor at all when the object has already been UV mapped escapes me.

 

I'm sure this can be corrected for in the script but it's not a five minute fix. I don't what property is being assigned via the UV editor and how to access it via the scripting API.

 

Also I'm not sure why when you're at the stage of editing a UV map why you'd be working with an ASE file. Clearly if you need to move vertices around in UV space, the model isn't game ready and you should still be using .blend.

Link to comment
Share on other sites

Damn, ok. And a fair point; one would be working in .blend up to this point, unless they were importing an existing ASE and working on that. In that case, they could probably be arsed to wake the materials back up to work on them.

 

And maybe blender itself will see a fix for it (I haven't tried with older versions).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • nbohr1more

      Was checking out old translation packs and decided to fire up TDM 1.07. Rightful Property with sub-20 FPS areas yay! ( same areas run at 180FPS with cranked eye candy on 2.12 )
      · 2 replies
    • taffernicus

      i am so euphoric to see new FMs keep coming out and I am keen to try it out in my leisure time, then suddenly my PC is spouting a couple of S.M.A.R.T errors...
      tbf i cannot afford myself to miss my network emulator image file&progress, important ebooks, hyper-v checkpoint & hyper-v export and the precious thief & TDM gamesaves. Don't fall yourself into & lay your hands on crappy SSD
       
      · 5 replies
    • OrbWeaver

      Does anyone actually use the Normalise button in the Surface inspector? Even after looking at the code I'm not quite sure what it's for.
      · 7 replies
    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
    • The Black Arrow

      I wanna play Doom 3, but fhDoom has much better features than dhewm3, yet fhDoom is old, outdated and probably not supported. Damn!
      Makes me think that TDM engine for Doom 3 itself would actually be perfect.
      · 6 replies
×
×
  • Create New...