Blender2Cal3D fixed for Blender 2.42a

I made a modified version of the blender2cal3d exporter I found on the Purple World Forge project site blender2cal3d_2.py.

I made this new one because all the version of blender2cal3d (there are many beyond the original shipped with Blender: Soya 3D, Eternal Lands, World Forge) I tested with Blender 2.42a were broken.

This fix, made “Export for Soya” button to work correctly and flipping coordinate system orientation with Y looking upward, to export characters for engines like Soya 3D or jME.

To download the exporter please visit http://endercg.altervista.org/.

Hey
I realy appretiate contributions, and theres nothing wrong with posting them so people can benifit from the improvements.
but for blender distrobution we need to be able to keep track of the latest script, having multiple sources makes it tricky.
So for updating Blenders CVS, can you arrange these changes make their way back into the authors source?

  • Thanks.

So for updating Blenders CVS, can you arrange these changes make their way back into the authors source?

Currently I am not in contact with the previous authors. LetterRip already asked me to contact them (http://www.blender3d.org/forum/viewtopic.php?p=56144&sid=596ab89bc2aaede9dcfb2f22fe26820e#56144) and I will do it as soon as possible.
Though tracking the different versions the blender2cal3d script have been difficult for me too. As I explained in the main post there are many different modifications. World Forge and Eternal Lands versions seam to come from the same base source, while Soya 3D seam to come from the original one (this is what I supposed comparing the code). Also consider that I am not an expert of the BPY and Python APIs.

Though, considering that the previous source was licensed under GPL and of course my changes are GPL too, creating a diff file to patch any other version should not be difficult. Moreover I included a full description (with lines reference) of the modifications I done, either in the README file, released with the archive, and in the source code as a comment.

I don’t know if this concept of contacting the author is important, if they arn’t still developing it, but I have worked on a version of the script as well, and I saw another person here who also had a version. I am interested in continuing to develop a better version (that has effective LOD especially). Do you know anything about the LOD part of the script?

Unfortunatelly I have no informations about LOD support.
The question are: how is it supported? Is it supported? And there is needed any special setup of the 3D Character mesh to activate LOD support?

Anyway we can discuss it if you want. Even if my primary objectives are a fine tuning of the script UI and preferences, before to go to enance its cal3d features support.

LOD does work, but it is not effective, it needs to remove enough polygons to match this from the cal3d creators.
http://download.gna.org/cal3d/htdocs/screenshots/cal3d_lod.jpg

when I run it and set a model exported with the script to 1% or close to it, it still looks like about 40 to 70 percent. So that’s the part of the script that is a priority for me, everything else that I use works well. If you or anyone knows about general LOD calculations (or whatever it’s called) and can hint at how to improve that please do.

I did a poly reduction function that can simply work by calling.

import BPyMesh
BPyMesh.redux(ob_mesh, 0.3) # makes the mesh 30% of the size.

if you dont want to modify the original data see - Object.duplicate() - make sure you pass the args so as to duplicate the mesh data also

Iv alredy used it, built into an exporter, it does vert cols, uv coords, vertex weights etc and you can call some optional args is you want to tweak settings.

The module in the CVS makes better quality output.

sounds great, I can’t use it as is because the cal3d format marks individual faces in 1 mesh, but maybe I can look at how it works, what file would it be in? (in BpyMesh probably)
Also that sounds good for the blender2crystal program which I use, maybe they can use it in there, thanks.

@ideasman42

I just posted to all the authors I found in the source of the original script, included with Blender, and the one I used (World Forge version): please read this.

Please read this post: http://www.blender.org/forum/viewtopic.php?p=57909#57909.

HEY! Thanks very much for that blender2cal3d_2.py. It really helps me out, With my blender 2.42a, the exporter wasn’t even present in the File->Export menu. With this one it is. Thanks!

Thank you for your feedback, SkyFox.

Anyway, the version you linked is the original World Forge script without my fixes. So I do not deserve any mention for this feature.

Ah I see! I have now downloaded the correct one, the menu item is stilll there. But apperantly I’m doing something wrong, 'cos since I tried to export my first skeletal mesh with it it says:
“LIST INDEX OUT OF RANGE” and the export fails. (><) It doesn’t happen when I export just the skeleton, it only happens when I export the mesh. But I need to export meshes as well.
Does someone know how I can put this straight?

I’ve fixed it before but don’t recall, try other versions of the script possibly.

…, but I don’t think the script is the problem. I have python 2.4 and blender 2.42a. Is there perhaps something extra I have to install in order to make the exporter work?

The script should work. I already tested it, with both skeleton and mesh, to load it in to a game engine. But maybe there is some features that I have not tested yet or your particular model had some properties (particular textures or materials?) that I still did not test with mine.

So, it could be usefull to see wich kind of model you use: post a pic for example. Or, if it is not a problem for you, please post your *.blend file.

Also the Python output can be helpfull to debug this error. So, please, post it.

Moreover, if the old one World Forge script works for you and you do not need axes flipping, you can still use it. My version is just a fix for coordinates system orientation.

Thanks.

ender.saka - have you contacted the WF guys about updating their version?

Well, the old worldforge file doesn’t work either. And the error always happens, even with the simplest meshes, like a boned cube. Do I need to install the Cal3D library or something? Or do I need to do something extra to my meshes?

I have the feeling it’s just an error on my system.

The python output is:

Blender2Cal3D <Psyco not found>
Info Starting …
Traceback <most recent call last>:
File “<string>”, line 1813, in bevent
File “<string>”, line 1340, in export
Indexerror: list index out of range

And I heard other people have the same problem, but had it solved(I never hear how). But it seems to be a common error.
My normal Cal3D exporter works, but this one can’t export for soya. The Blender2Cal3D_2 exporter is the one having the problem.

use the one that works then, exporting for soya doesn’t matter, you should be able to do any rotation before you export if it’s not rotated like soya requires.

I don’t understand what you mean. In fact I don’t know whats the difference. I never used Cal3d before.
I’m using the crystalspace game engine which needs the mesh file in cmf-form. That only happens if I use the blender2cal3d_2 exporter, the other one (which works) has xmf-output only. According to the tutorial I need to set export for soya in order to make it suitable for the game engine.

But you may all forget it now I just found out that another blend-file, that I just downloaded, does export with your exporter. It appears that I needed to add a material to the mesh in order to export it.