Game Development Community

Announcing : Blender Exporter For Torque (0.8)

by James Urquhart · in Artist Corner · 06/17/2004 (8:57 am) · 116 replies

Hey again,

Finally, after many weeks of frustration, i have released a new version of the Torque Blender Exporter.

The exporter has been greatly revamped in an effort to make it easier to use, though it should still be considered unstable.

Changes of note are :
- Full support of loc,rot, and scale animation of bones.
- Many configuration options have been removed and intergrated more into blender (e.g. Material settings).
- Revamped gui and scene setup.
- Configuration settings are now stored in the .blend file.
- Works in Blender 2.33+; Full intergration into the Export menu.

A short how-to on converting existing shapes to work with the new exporter is included in the exporter .zip.
In addition, i have included an example.blend, which should export cleanly using the exporter.

As usual, it can be obtained at : www.garagegames.com/blender

Please post your thoughts, and any bugs you bump into here.

NOTE: If you downloaded 0.8 and are having problems, i have released 0.81 that corrects a few of them.
Page «Previous 1 2 3 4 5 6 Last »
#1
06/17/2004 (10:02 am)
...
#2
06/17/2004 (11:18 am)
Congrats, James. :)

Blender allows customized UI now, doesn't it?
#3
06/17/2004 (11:32 am)
Eric,

As far as i can tell, blender has always supported having a customized UI. Or are you meaning something else?
#4
06/17/2004 (12:19 pm)
I don't think it did in the past, before the last year or so. Back then the UI was rough for a newbie to Blender, though many said it was very effecient once you got used to it.
#5
06/17/2004 (1:48 pm)
Has the method been changed for setting material translucency using texture alpha channels? I can't get translucency to export correctly with this version of the exporter.

The material and texture settings I'm using can be viewed in this image here; these settings worked fine in exporter version 0.6.

(I've already tried using the "Stencil" and "Translu" buttons: neither has any effect on the exported model.)
#6
06/17/2004 (2:03 pm)
Walter,

The exporter checks various material options.
Firstly, if the emit is > 0.0, the material is marked as Self Illuminating.
Secondly, if the alpha is < 1.0, the material is marked as Translucent *AND* Additive.

The exporter then checks additional texture channels in the material to assign reflectivity, bump, and detail maps (REF, NOR, and normal).

If you are having additional problems with the way the exporter is setting the flags, you might want to take a look at the importBlenderMaterial() function in Dts_Blender.py.

I am open to any suggestions in improving the exporter this area.
#7
06/17/2004 (3:04 pm)
In importBlenderMaterial(), regarding the line:
if bmat.getAlpha() < 0.1: material.flags |= dMaterial.Translucent|dMaterial.Additive

Maybe it would work better like this:
if bmat.getAlpha() < 0.5: material.flags |= dMaterial.Translucent|dMaterial.Additive
elif bmat.getAlpha() < 1.0: material.flags |= dMaterial.Translucent

That way, if one wanted both Translucent and Additive flags set, they would set the Alpha to a low value ( < 0.5). If they wanted only Translucent flag set, they would set the Alpha to a higher value ( > 0.5, but < 1.0).
#8
06/18/2004 (3:03 am)
Walter,

How about the following :

def importBlenderMaterial(shape, bmat):
	if bmat == None: return None
	material = dMaterial(bmat.getName(), dMaterial.SWrap | dMaterial.TWrap,shape.materials.size(),-1,-1,1.0,bmat.getRef())
	# Set defaults based on logical assumptions
	if bmat.getEmit() > 0.0: material.flags |= dMaterial.SelfIlluminating
	
	material.flags |= dMaterial.NeverEnvMap
	
	textures = bmat.getTextures()
	if len(textures) > 0:
		if textures[0] != None:
			if textures[0].mapto & Texture.MapTo.ALPHA:
				material.flags |= dMaterial.Translucent
				if bmat.getAlpha() < 1.0: material.flags |= dMaterial.Additive
<Insert the rest of the function here>

If the "ALPHA" mapping option is set on the first texture channel, the material will be set as Translucent.
If the "alpha" value of the material is < 1.0, then the material is set as additive.
I cannot seem to find a way of accessing the texture channel blending flags in the blender api, so i'll have to leave out Subtractive materials :(

On another note, i could also take into account the "ALPHA" mapping value on the other channels, but i am unsure if this would have any effect in torque.
#9
06/18/2004 (11:12 pm)
James,

That definitely works much better and more sensibly than my suggestion.

Sorry to change the topic while the Subtractive issue is unresolved, but the exporter crashes for me whenever I try to export sequences (this is unrelated to the previous translucency/additive/subtractive issue). The console output reads as follows:
warning: name 'Version' is assigned to before global declaration
Torque Exporter 0.8
Using blender, version 233
**************************
Processing Scene...
Warning: could not handle child 'Camera'
Warning: could not handle child 'Lamp'
Cleaning Preference Keys
Exporting...
Traceback (most recent call last):
  File "C:\Documents and Settings\Administrator\Application Data\Blender Foundation\Blender\.blender\scripts\Blender_Gui.py", line 99, in button_event
    Sheets[CurrentSheet][2](evt)
  File "<string>", line 1671, in mesh_evt
  File "<string>", line 1589, in shared_evt
  File "<string>", line 1418, in export
  File "<string>", line 263, in savePrefs
  File "<string>", line 288, in saveTextPrefs
TypeError: not all arguments converted during string formatting

I'm also getting a minor bug in the configuration GUI where if I move the cursor off the Sequences pop-up selection menu without actually choosing a sequence, the "Blend" button toggles. I don't know if it's related in any way to the abovementioned exporter crash.

Sorry to bug you so much about the exporter; I really appreciate all the hard work you're putting into this.
#10
06/19/2004 (12:58 am)
Walter,

Blender's menu's tend to act wierdly by giving out incorrect events at times, which is probly the reason for your problem.

Try changing the event number the "Blend" button uses. Change the according sequence sheet define in initGui() to :
[146,118,"TOGGLE",16,"Blend",64,20,3,"Sequence is a blend animation",True,None]
(4th parameter is event number)

And in sequence_evt, change the if statement for the Blend button to take into account the new event number :
elif evt == 16:
		# Blend

As for your python error, that seems to be a typo on my part.
Look for a line that looks like this :
text_doc.write("}\n"  % Prefs['Sequences'][seq]['Dsq'])

And change to this :
text_doc.write("}\n")
#11
06/19/2004 (1:13 am)
In addition, i noticed another mistake i made :

elif cur_token == "Sequence":
					tok.advanceToken(False)
					seq_name = tok.getToken()

Should be more like :

elif cur_token == "Sequence":
					tok.advanceToken(False)
					seq_name = tok.getToken()
					Prefs['Sequences'][seq_name] = {'Dsq' : False, 'Cyclic' : False, 'Blend' : False, 'Triggers' : []}
(´ = ')

And i hope thats it :)
#12
06/19/2004 (10:48 am)
Just to let all of you blender exporter users know, I have released a quick "0.81" release of the exporter to correct bugs brought up by this forum post.

Again, if anyone else is experiencing any problems with their shapes, please post about it here.
#13
06/19/2004 (3:00 pm)
I'm experiencing some problems with getting sequences to work in the -show tool.

When exporting a cube object with one armature bone and a simple spinning action:

1. no DSQs, no cyclic sequences
Under these conditions, everything seem to works OK.

2. no DSQs, cyclic sequences
All cyclic sequences have "dead space" added to the end that takes up approximately 1/6 of the entire loop duration. This creates a noticeable pause between the end and beginning of the sequence.

3. Write DSQs, ??? cyclic sequences
The exporter writes out the DSQs, but trying to actually play the DSQs in the -show tool ends up crashing the tool. This also happens if I try to automate the sequence loading via Shape Scripts. Due to this I haven't been able to check if the aforementioned problems with cyclic sequences are still present.

Also, my models with more complex armatures (but still well within the 192 node limit) generate a TSIntegerSet error when loaded into the -show tool.
#14
06/20/2004 (2:40 am)
Walter,

Firstly, thanks for putting up with all these problems you are bumping into :)

1) Ok

2) "dead space"? hmm... thats odd...
EDIT: could be something to do with the spacing of your keyframes in blender. The exporter currently calculates duration of a sequence to be equal to the time of the last keyframe of the sequence.

3) I altered the DSQ writing code somewhat; So its probable that the exporter is not writing the dsq files correctly; I'll take a look and see what's wrong.

4) Could be a problem with the integer set write function. I'll see what i can dig up. Of course, if you could send me a .blend with 192 bones in it, it might speed up the process :)
#15
06/20/2004 (5:13 am)
Walter,

Could you perhaps email me? I believe i have fixed the problem, though i need to make sure there are no further problems with my fix, before i release 0.82 (or whatever) :)
#16
06/20/2004 (5:55 am)
James,

I've emailed you two .blend files and two .dts files that illustrate the "dead space" issue and the complex armature crash. And if you're serious about that 192 bone bit, I suppose I could whip up a .blend for that too...
#17
06/20/2004 (6:52 am)
...
#18
06/20/2004 (9:49 am)
Joeseph,

The configuration options are now stored in the .blend, rather than a .cfg file. You may see a text buffer in your .blend that suspiciously looks as if it belongs to the exporter :)

Walter,
192 bones is probably alot i suppose. And i bet it'd animate very slowly. Will take a look at the .blend's you sent me.
#19
06/21/2004 (7:42 am)
James,
Nice progress on the exporter during my hiatus. The integration with the blender export menus is nice and the rest of it looks like its coming together well. Looks like the code is cleaned up pretty well too, although I haven't had my eyes on the current version very much.

A couple of questions. I looked at your example.blend file to figure out how to use the Shape/Detail/LoS/etc. empties, however, that example file doesn't contain an armature. I'm having a few issues with sequences I'm trying to track down and want to make sure I've got the basics right.

What I did was create an empty called Shape and then make that the parent of Detail32 which was the parent of my armature. The armature is then the parent of my mesh. I believe that should be correct as it mostly works, but I'm seeing some issues that make me question this assumption. Is this what you expect and/or do you have a better way of doing this since the mesh has to be parented to the armature to test the animations in blender ?

I see a couple of possibilities for enhancement and wonder if they are things you're thinking about as well. I'd still like to get baked and/or IK actions working for export ... yeah, I'm a glutton for punishment, but they're so nice to animate with, :-). There are several issues with this, some of them simply UI based like allowing the user to choose bones and actions to ignore. Then there's the blender issues, like the length of the BAKED. action name making the IPO names get truncated, etc. This blender IPO naming issue also rears its head in other ways as well, but I'm not sure how much you can actually do about it in many of those cases.

It also seems to me that it might be good to allow the user to assign a torque "name" like root, run, etc. to the actions/sequences if the user doesn't name them their actions that way. A couple other enhancements are slipping my mind right now, but they were along the same lines in providing a higher integration with what torque supports/needs and easier to use blender's features (like IKs, etc.).

I'm not asking for a handout here, actually, I'm offering to help as I need this tool as well. Since I'd be hacking some of these changes in my own copy anyway, I might as well make them available to you so others can use them also. Do you have plans on supporting any of the things I mention above and/or do you have a task list that I might be able to knock a few things off ?

Thanks again for all the effort you've put into this and gratz on becoming an associate!
#20
06/21/2004 (8:16 am)
Zaz,

The exporter exports *everything* directly or indirectly parented to the Detailx / Colx / Losx empty's.
All meshes to be deformed by an armature need to be parented to it; Though the thing to remember is not to attach the mesh to a single bone, but rather, attach it to the armature (since otherwise the exporter won't pick up the bone influences).

IPO Names getting truncated is no longer an issue with the exporter; Since it uses the new Action api to get all the channels and their associated bones.
As for stopping certain bones from being exported, i did have this implemented in the old exporter, but i decided to leave it out in this release for now; Removing bones can be a risky business.
As for stopping certain Action's from being exported, you could always tell the exporter to "Write DSQ" for a sequence, then comment it out of the shape's .cs file.

As for action renaming, it doesn't seem that hard for the user to change the action names in blender; If i keep adding nifty renaming features to the exporter, it'll just get too overly complex (e.g. 3 ways of doing 1 thing).

Walter has identified several issues with the exporters animation support, so i will be releasing 0.82 soon to fix them.

Thanks for the input :)
Page «Previous 1 2 3 4 5 6 Last »