Page 1 of 5

fixing BlenderToCal3D script to work with 2.4

Posted: Thu Jan 19, 2006 6:21 am
by xaxa
Hi, I'm trying to fix the one that comes with blender but I got stuck in a silly error.

I posted the error and the modified code I came up with here:

http://www.gamedev.net/community/forums ... 1&#2441275.

Just in case somebody wants to help.

Posted: Thu Jan 19, 2006 7:03 am
by jsgreenawalt
Hello.
Traceback (most recent call last):
File "blender2cal3d.py", line 1201, in fs_callback
export(filename)
File "blender2cal3d.py", line 925, in export
treat_bone(b)
File "blender2cal3d.py", line 872, in treat_bone
quat = matrix2quaternion(blender_bone2matrix(head, tail, b.roll))
File "blender2cal3d.py", line 371, in blender_bone2matrix
rMatrix = matrix_rotate(nor, roll)
File "blender2cal3d.py", line 275, in matrix_rotate
cos = math.cos(angle)
TypeError: a float is required
The problem is on line 872 in treat_bone. If you take a look over here:
http://www.blender3d.org/documentation/ ... .html#roll
You will see that bone.roll is a dictionary, which contains two keys 'ARMATURESPACE' and 'BONESPACE'.
To get the old behavior change line 872 from

Code: Select all

quat = matrix2quaternion(blender_bone2matrix(head, tail, b.roll))
To:

Code: Select all

quat = matrix2quaternion(blender_bone2matrix(head, tail, b.roll['BONESPACE']))
Hope that helps.
- Joe Greenawalt

Posted: Thu Jan 19, 2006 7:10 am
by LetterRip
you might want to use current CVS Blender, we will release in less than a week, and the Pose module, etc will make it much more straight forward to do, it should almost work the same with 2.41 ...

LetterRip

Posted: Thu Jan 19, 2006 7:24 am
by xaxa
you mean scripts working with 2.4 won't work in 2.41 ?

@jsgreenawalt: Thanks. I'm going to look that. I'm almost completely ignorant about the Blender's python API so I run the script and see the errors, then I google for the changes in 2.4 and fix as much as I can.

Posted: Thu Jan 19, 2006 9:44 am
by LetterRip
no I mean scripts that worked with 2.37a will more easily work with 2.41 than with 2.40.

LetterRip

Posted: Thu Jan 19, 2006 11:14 am
by xaxa
LetterRip wrote:no I mean scripts that worked with 2.37a will more easily work with 2.41 than with 2.40.

LetterRip
Cool. Sadly I won't be connecting from a computer I've chances to instal CVS in during this week so I won't be able to use an snapshot to test the script.

I'll wait until 2.41 is released.

Posted: Sat Jan 21, 2006 7:49 pm
by der_ton
I wrote an exporter to MD5 (Doom3 engine model format) that is based on Jiba's Cal3D exporter. It's updated and works with 2.40. Maybe you can get some ideas from there.
http://home.tiscali.de/der_ton/blender2md5.rar

Posted: Mon Jan 23, 2006 1:00 am
by Roja
I'm happy to hear someone is going to work on this! :)

Just in case you didn't know: you say you are using the script that comes with blender? IT is not the most up-to-date blender2cal3d script, it's the 0.9 version. There is a 0.10 version located here:
http://home.netspeed.com.au/mcginnes/bl ... cal3d_2.py

it's nicer because it has a better gui.

Posted: Mon Jan 23, 2006 4:05 pm
by an-toni
are you using bone types? which ones do the diff ge libs support?

~Toni

well, it doesn't crash.

Posted: Tue Jan 24, 2006 6:18 am
by tawnkramer
I'm a game programmer and I've written my share of exporters. I just wanted to be able to export from blender in cal3d so I fixed the problems that kept this from completing an export. Seems like it's doing xml only at the moment.

the problem is that I don't really have any blender files to test this export on. I just made a cube with an armature. If someone has something better to test, I wouldn't mind getting it going. or at least giving it a shot.

-tawn
tawnkramer@gmail.com

also, I don't think I can post the python script here without ruining the whitespace.

Posted: Tue Jan 24, 2006 2:18 pm
by kostya_z
tawnkramer,
Do I understand you correctly: you fixed some part of blend2cal3d_2? If so, could you post the link, please, I have something to test it on.

Posted: Tue Jan 24, 2006 4:19 pm
by stiv
I don't think I can post the python script here without ruining the whitespace.
Posting scripts here is a sucky way to distribute them for exactly that reason; even if you use the CODE tag.

Posted: Tue Jan 24, 2006 6:08 pm
by kostya_z
Can anybody tell when the next 2.41 release is scheduled? And what directory the current Blender 2.40 is built from? I am using:
CVS log for blender/source/blender/python/api2_2x/
As far as I understand this directory is for development builds, right?

Posted: Tue Jan 24, 2006 9:20 pm
by LetterRip
2.41 today or tomorrow.

LetterRip

Posted: Wed Jan 25, 2006 10:02 pm
by kostya_z
Hello, I got this script to work with CVS build of Blender 2.41, but unfortunately I have only 1 model to test it on. Could anybody test it, please?

Thank you,
Kostya.
http://www.geocities.com/kostyabkg/blender2cal3d_4.zip