fixing BlenderToCal3D script to work with 2.4

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

dcyoung
Posts: 0
Joined: Fri Feb 17, 2006 9:28 pm

Post by dcyoung »

Thanks for testing the script.
BUT, the UV coords of the new mesh are flipped.
I had to change how the UV coords were handled to get them to work right with the miniviewer; I'll see if the viewer's messed up.
Using the old or new animation with the new skeleton and mesh gives the same result.
Sounds like the skeleton's being exported wrong. Is the armature in your model not centered on the origin? I was lazy and didn't account for that.
the animation files are not, the newer one is bigger.
That's weird...Could I take a look at the model you're testing with?

Roja
Posts: 0
Joined: Tue May 04, 2004 4:36 pm

Post by Roja »

Hi,

Ok I got it working now it seems!

My artmature's pivot was centered on itself, not the origin, that's why the animation didnt' work correctly for me. So, I just went into edit mode and moved the bones up, so the pivot was centered on the origin(so that the model in the game would be walking on the ground and not have the body half in the ground-this is what messed up the animation, so in fact it was the skeleton's fault, not the animation).

Anyway, I did need to change line 1304 to the old line that is this:
uv = [face.uv[0], face.uv[1]] #1.0 - face.uv[1]]

To get the UV's to not flip themselves. And it worked thankfully!

Here is the new exporter that works for me, based on yours with that one modification i mentioned above:

http://www.eternal-lands.com/misc/blender2cal3d_3.py
Last edited by Roja on Tue Feb 21, 2006 4:05 am, edited 2 times in total.

Roja
Posts: 0
Joined: Tue May 04, 2004 4:36 pm

Post by Roja »

Also, the animation files are still different sizes, internally they are different.

Here are 2 animation files, they are from the exact same blend file, the exact same animation, only 1 is from blender 2.37, the other 2.41:

http://www.eternal-lands.com/misc/player_walk_237.xaf
http://www.eternal-lands.com/misc/player_walk_241.xaf



I was also wondering if you can add this patch to your exporter, so that you don't have to quit and reload the script each time you export a skeleton files:
http://sourceforge.net/tracker/index.ph ... tid=386673

an-toni
Posts: 0
Joined: Wed Mar 17, 2004 5:20 pm

Post by an-toni »

are the other/earlier developers of the script aware of these things?

~Toni

dcyoung
Posts: 0
Joined: Fri Feb 17, 2006 9:28 pm

Post by dcyoung »

are the other/earlier developers of the script aware of these things?
I don't think so.

Roja
Posts: 0
Joined: Tue May 04, 2004 4:36 pm

Post by Roja »

Did you find the problem with the animations yet?

They ARE different from the old ones slightly, it will work on the model but it strangely seems to shrink it a bit so they aren't really compatible with the old animations.

dcyoung
Posts: 0
Joined: Fri Feb 17, 2006 9:28 pm

Post by dcyoung »

Looks like the new one is adding an extra keyframe for each bone. I'll see if I can figure out why that's happening.

kostya_z
Posts: 0
Joined: Mon Oct 24, 2005 12:29 pm

Post by kostya_z »

dcyoung,
That's grand you managed to calculate the Bones transformation with the new Blender. How did you find that out? I mean I am far from being able to assemble something like this expression:

Code: Select all

bone = Bone(skeleton, parent, b.name, b.parent.matrix['ARMATURESPACE'].rotationPart() * (b.matrix['ARMATURESPACE'].translationPart() - b.parent.matrix['ARMATURESPACE'].translationPart()), quat)
And also a few lines before that.

Where should I read on Bones' mattrices, quaternions and such stuff? I am modifying Cal3D library internally and probably will need that.

Thank you so much for this work!

an-toni
Posts: 0
Joined: Wed Mar 17, 2004 5:20 pm

Post by an-toni »

bone.matrix is the bone matrix, and the animation quats are in action ipo blocks (pose channels). or?

~Toni

kostya_z
Posts: 0
Joined: Mon Oct 24, 2005 12:29 pm

Post by kostya_z »

Well, thank you for the answer, but I meant something slightly different,
I mean where I can find easy to understand info on matrix transformations and such things applicable to computer graphics. I studied matrices, polar and other coordinates during my 1st year in University, but all of that was just the mathematical theory...

xDan
Posts: 0
Joined: Fri Nov 04, 2005 10:41 pm

Post by xDan »

Thanks whoever updated the script to work. :) I've been trying for ages to get the old ones to work with no success.

Anyway I modified it so it saves the file with the .blend file name and in a sub directory. (The version I have saved it to g:\test or someplace).

http://www.xzist.org/temp/blender2cal3d_2.py

Perhaps the official one should do something like that.

Roja
Posts: 0
Joined: Tue May 04, 2004 4:36 pm

Post by Roja »

Well as I said in a post above, it's still not 100% working properly. The animations are not compatible with the old animations, something is wrong still.

Roja
Posts: 0
Joined: Tue May 04, 2004 4:36 pm

Post by Roja »

Well, I still dont know why the old/new animations work a little differently, but to get around it i'll just export all new animations with the new exporter, since they do actualy work.

I noticed that that extra keyframe in fact seems like it SHOULD be there, because in blender i really do have 9 keyframes not 8. So perhaps the old exporter was actually skipping one..or something, who knows. I did use the same exact blend files for that export test however.

Anyway the final exporter I am using is the one I posted before, located here:
http://www.eternal-lands.com/misc/blender2cal3d_3.py

melvinator
Posts: 0
Joined: Sun Nov 23, 2003 7:11 pm

Post by melvinator »

I just started playing around with cal3d a few days ago, this update (is/was) exactly what I was looking for.

Any chance of changing the struct.pack("ifff...etc" ) to struct.pack("<ifff...etc" ) before this gets rolled into the 2.42 build? It would help us big endian folk.

Still doesn't work quite right for me yet (my animations do not work, and others animations seem to have bones in weird places, could be my own naivety though ), but its a fair amount better than nothing.

an-toni
Posts: 0
Joined: Wed Mar 17, 2004 5:20 pm

Post by an-toni »

btw i noticed that the new soya 0.12 or something announced blender 2.4 support, which means that the cal3d script there should work with 2.4 - dunno if they grabbed the version from here, or if they re-ported it.

~Toni

Post Reply