Pull Your Own Strings

Simple Blender 2.66 -> Cal3d

Thursday February 23, 2017

Grab the dependencies here an amalgamation of test materials:


Checksum SHA512: ae45e00b4f1be5c3383fff20a9a82492fa3bf11167ad1bedbec48b571369bed08931ef4e3a5ec157d2291dd777de4b5293f21056c9bbe8c861b50a06889ec336

Included are a set of files that work with an already working eulora install. I personally tested on Debian 8 using the instructions provided for “Ubuntu”.

Extract the archive into its own folder ‘cal3dconversiontest’.

There are three folders in the main one: ‘testmodel’, ‘exporter’, and ‘viewer’.

Export from Blender
First open Blender 2.66. Select file from the menu bar then select “user preferences” (Ctrl-Alt-u). Click the button/tab called “addons”. At the bottom there will be a “install from file…” button. Click this button then navigate to the ‘exporter’ folder mentioned above and open the file ‘mycalexporter269.py’.

After the python script loads, Blender usually “searches” for the newly installed plugin in the addons list to allow the user to activate it. If not type “cal3d” in the addons search field to locate the addon in Blender. Click the empty checkbox and the addon will be activated.

To check to see if the addon installed. Select file, then highlight export. If “Cal3D model” is one of the options, the plugin is installed and activated.

Next open the test model from the ‘testmodel’ folder described above named: ‘Body_Mesh_Rigged.blend’

The file already has a skeleton and a basic “lean” animation. If the animation is played the figure will lean to one side.

In the scene outline, expand the “Armature” selection if not already done. Hold the “Shift” key and click both the icon left of the “Armature” text, and the subset “Low_Poly_Characte.000_Mesh.001”. These both need to be selected before starting the export! The armature contains the animation action (which in turn allows the exporter to find the bones and their children), but even though the mesh is grouped in the Armature hierarchy, it too needs to be selected for the exporter to find it.

Now that everything is selected, select file then export -> Cal3d Model. For the export directory, navigate to ‘viewer/pally’. Click export.

Now the exporter has gone ahead and loaded the skeleton into a temp figure ‘Bent’ which should have been auto selected after clicking export. On the outline screen click/select “Armature” again. If you loaded Blender from a terminal, you will see this selection has triggered blender to write the export to files.

Preparing the Exports for the Viewer
Export the necessary variables from a terminal shell, as indicated in the eulora install. For e.g.:

`export LD_LIBRARY_PATH=”$HOME/dev/cal3d/src/cal3d/.libs:$HOME/dev/cs-forupload/:”$LD_LIBRARY_PATH`

`export CRYSTAL=$HOME/dev/cs-forupload`

Navigate to the viewer folder. And type make. This will build the cally3d executable file: the viewer.

Next navigate to pally. There should be 5 files:


The x*f files (except the *.xrf file) needs to be converted into binary files. Luckily the Eulora build process will output a cal3d_converter binary in the local cal3d/bin folder.

To do this run:

`$HOME/dev/cal3d/bin/cal3d_converter Body_Mesh_Rigged_ArmatureAction.xaf Body_Mesh_Rigged_ArmatureAction.caf`
`$HOME/dev/cal3d/bin/cal3d_converter Body_Mesh_Rigged_Low_Poly_Characte.000_Mesh.001.xmf Body_Mesh_Rigged_ArmatureAction.cmf`
`$HOME/dev/cal3d/bin/cal3d_converter Body_Mesh_Rigged.xsf Body_Mesh_Rigged.csf`

Now navigate back to the viewer directory. There is a small script “cfgtocs.py”. Run this script and it will output a test.cal3d file. Note that this script requires Jinja2 to render the .cal3d template.

Update script from archive above with the below script:
cfgtocs.py is a script that takes in 3 arguments and outputs a CrystalSpace MeshFactory XML file.

Use: `python cfgtocs.py `

IMMDEDIATE_MODEL_PATH – the immediate path to the model data without a trailing slash, such as ‘cally’ or ‘pally’

MODEL_CFG_FILE_NAME – the name of the CFG filename, for example ‘cally.cfg’

SCALE – the scale app, for example ‘0.01’

After running, the script will output the xml contents and then

Run ./cally3d

Coming Soon: Instructional Pictures (Hopefully); Exporting XRF Materials to CrystalSpace

Published under Eulora, Video Games | Leave a Comment

Leave a Reply

Your email address will not be published. Required fields are marked *