
I got a first version going for exporting meshes and skeletons. The aim is to make it as straight forward as possible.
The current version can now be found on Github:
https://github.com/rgerum/clonk-blender-exporter
You just have to open the provided object.blend file and you can start directly!
Feedback is highly appreciated.
The link doesn't work for me. It shows me 404.
And also thanks for your hard work.
And also thanks for your hard work.

Currently it only looks if the material has a texture assigned to it (via nodes) and then adds the texture to the .material definition.
Are there some other properties of the .material files that we need for the export?
I am not even sure which parts are currently used by OpenClonk.

I went through a few material scripts. I think you should at least set values for ambient, specular, diffuse, emissive - even if they do not come from the blender defaults (maybe just set them to 1?).
Also "receive_shadows on" seems to be used.
"colour_op", "alpha_to_coverage", "scene_blend", "depth_check", "depth_write" and "cull_hardware" are also used - no idea whether it's sensible to take them from blender, though.
https://github.com/openclonk/openclonk/blob/master/planet/Objects.ocd/Vegetation.ocd/Mushroom.ocd/Scene.material
https://github.com/openclonk/openclonk/blob/master/planet/Objects.ocd/Vegetation.ocd/SproutBerryBush.ocd/Flower.ocd/Scene.material
https://github.com/openclonk/openclonk/blob/master/planet/Objects.ocd/Vegetation.ocd/SproutBerryBush.ocd/Leaf.ocd/Scene.material
https://github.com/openclonk/openclonk/blob/master/planet/Objects.ocd/Clonk.ocd/SceneAlchemist.material
https://github.com/openclonk/openclonk/blob/master/planet/Objects.ocd/Animals.ocd/Piranha.ocd/PiranhaMaterial.material
https://github.com/openclonk/openclonk/blob/master/planet/Objects.ocd/Structures.ocd/Armory.ocd/Armory.material

I now implemented "ambient", "specular", "diffuse", "emissive", the "receive_shadows" switch and a texture image selector.
For receive_shadows, I think almost all objects in Clonk have set it to on, so maybe we should just default it to "on".
For the others that you did mention, I don't quite know what they are exactly used for. Some are related to transparency, I think.
Maybe we should just offer a switch "Use transparency" that sets the appropriate properties. I think it would be cool if we provide the user just the essential properties he has to care about.
Does anyone know more about these properties?
Currently getting the following errors:
Seems like the python script can not import report. If I remove the import, the addon appears in the UI, but the export mesh button yields another import error
Tested on Blender 2.81
File "/home/manuel/Downloads/clonk-blender-exporter-master2/object.blend/ui.py", line 10, in <module>
ImportError: cannot import name 'Report' from 'report' (/usr/local/lib/python3.7/site-packages/report/__init__.py)
Seems like the python script can not import report. If I remove the import, the addon appears in the UI, but the export mesh button yields another import error
Traceback (most recent call last):
File "/home/manuel/Downloads/clonk-blender-exporter-master2/object.blend/ui.py", line 114, in execute
ModuleNotFoundError: No module named 'mesh'
location: <unknown location>:-1
Tested on Blender 2.81

So you can rename the report.py file and change the import accordingly.
E.g. report.py -> my_report.py (in the Scripting window)
and in ui.py change "from report import Report" -> "from my_report import Report"
I have to investigate why Blender does not give priority over its internal scripts. Maybe I just have to prefix all scripts with "Clonk_" to avoid ambiguities.

I now fixed this issue. You don't have to rename anything, that would unfortunately not solve the problem.
Download the newest version from Github.
I get "ModuleNotFoundError: No module named 'report'" message.
I tried renaming as mentioned above and adding r'.' and r'./scripts' to sys.path.
Also File is on c:\\ and Blender on d:\\
I tried renaming as mentioned above and adding r'.' and r'./scripts' to sys.path.
Also File is on c:\\ and Blender on d:\\

I will give it another try on windows.

I now rewrote the imports so that they should work now.
The newest version is in the repository.
Cool! I managed to export a model. Great feeling. But when adding an armature it fails for me. Even with the default cube after the following steps:
Add Armature
Select Cube, Select Armature -> Set Parent/Armature/With Automatic Weights
Export Mesh
it Shows:
Warning: 'MT_mini_report' doesn't contain '_MT_' with prefix & suffix
Warning: class CLONK_OT_add_image_texture contains a property which should be an annotation!
C:\Users\mimi\Desktop\clonk-blender-exporter-master\clonk-blender-exporter-master\object.blend\ui.py:151
assign as a type annotation: CLONK_OT_add_image_texture.filepath
register_class(...):
Warning: 'MaterialPanel' doesn't contain '_PT_' with prefix & suffix
register_class(...):
Warning: 'ActionPanel' doesn't contain '_PT_' with prefix & suffix
register_class(...):
Warning: 'ClonkActionPanel' doesn't contain '_PT_' with prefix & suffix
register_class(...):
Warning: 'ExportPanel' doesn't contain '_PT_' with prefix & suffix
register_class(...):
Warning: 'MT_mini_report' doesn't contain '_MT_' with prefix & suffix
target_file C:\Users\mimi\Desktop\clonk-blender-exporter-master\clonk-blender-exporter-master\export\Graphics.mesh.xml
Traceback (most recent call last):
File "C:\Users\mimi\Desktop\clonk-blender-exporter-master\clonk-blender-exporter-master\object.blend\ui.py", line 243, in execute
File "<string>", line 56, in dot_mesh
AttributeError: 'Context' object has no attribute 'depsgraph'
location: <unknown location>:-1
location: <unknown location>:-1
Add Armature
Select Cube, Select Armature -> Set Parent/Armature/With Automatic Weights
Export Mesh
it Shows:
Warning: 'MT_mini_report' doesn't contain '_MT_' with prefix & suffix
Warning: class CLONK_OT_add_image_texture contains a property which should be an annotation!
C:\Users\mimi\Desktop\clonk-blender-exporter-master\clonk-blender-exporter-master\object.blend\ui.py:151
assign as a type annotation: CLONK_OT_add_image_texture.filepath
register_class(...):
Warning: 'MaterialPanel' doesn't contain '_PT_' with prefix & suffix
register_class(...):
Warning: 'ActionPanel' doesn't contain '_PT_' with prefix & suffix
register_class(...):
Warning: 'ClonkActionPanel' doesn't contain '_PT_' with prefix & suffix
register_class(...):
Warning: 'ExportPanel' doesn't contain '_PT_' with prefix & suffix
register_class(...):
Warning: 'MT_mini_report' doesn't contain '_MT_' with prefix & suffix
target_file C:\Users\mimi\Desktop\clonk-blender-exporter-master\clonk-blender-exporter-master\export\Graphics.mesh.xml
Traceback (most recent call last):
File "C:\Users\mimi\Desktop\clonk-blender-exporter-master\clonk-blender-exporter-master\object.blend\ui.py", line 243, in execute
File "<string>", line 56, in dot_mesh
AttributeError: 'Context' object has no attribute 'depsgraph'
location: <unknown location>:-1
location: <unknown location>:-1

But I should fix the exporter so that it can also export a skeleton without an action.
I appended the clonk into the object.blend and its Actions.txt from the repo, but I still get the error. Although I successfully exported the skeleton using the default cube as mentioned above.

Is there anything special with the clonk? I "ported" and cleaned up the the file for 2.81 yesterday.

And you have to "import" the new exporter in the clonk. To do that you can copy the content of "load_scripts.py" into the target blender file and execute it. It will load the scripts into the .blend file.
Since the exporter is about to change, I kept any .blend file except object.blend clean and appended the item I want to export to object.blend when needed.
Yeah ok. That's what I mainly was doing too, putting them into named Collections and enabling their visibility.
>The main difference is basically how the layers are sorted.
Yeah ok. That's what I mainly was doing too, putting them into named Collections and enabling their visibility.

It is equipped with the current version of the exporter.
Contrary to the old exporter you can now define an Action.txt file to load. It is not automatically searched. This should prevent blender files do accidentally load the Action.txt.
(In the Clonk.blend I already specified the Action.txt)
Also I don't know if you have seen that in the exporter you can define tools to be liked with each action. This is just a convenience for seeing an attached tool in Blender while designing the animation. Its not yet properly documented.
Ok, I will use your file, since everything works as is. But (and I am sorry that I have to bring another thing up), when I
append my own Clonk Mesh, delete everything except the object and parent it to the skeleton, (but also with the technique I used before) I get this error:
<bpy_struct, Mesh("Knight_F_Cloth.003")> 1652
tri <bpy_struct, MeshLoopTriangle at 0x0000024A02417F98>
Traceback (most recent call last):
File "C:\Users\Apfelmann\Desktop\clonk\clonk.blend\ui.py", line 243, in execute
File "<string>", line 188, in dot_mesh
File "<string>", line 534, in extract_vertex_color
AttributeError: 'MeshLoopColor' object has no attribute 'color1'
location: <unknown location>:-1
is possibly something wrong with my mesh? I actually changed/created/deleted topology.
PS. Thank you very much for your ongoing efforts.
append my own Clonk Mesh, delete everything except the object and parent it to the skeleton, (but also with the technique I used before) I get this error:
<bpy_struct, Mesh("Knight_F_Cloth.003")> 1652
tri <bpy_struct, MeshLoopTriangle at 0x0000024A02417F98>
Traceback (most recent call last):
File "C:\Users\Apfelmann\Desktop\clonk\clonk.blend\ui.py", line 243, in execute
File "<string>", line 188, in dot_mesh
File "<string>", line 534, in extract_vertex_color
AttributeError: 'MeshLoopColor' object has no attribute 'color1'
location: <unknown location>:-1
is possibly something wrong with my mesh? I actually changed/created/deleted topology.
PS. Thank you very much for your ongoing efforts.

But, well, I think slowly we are finding all the bugs that can occur.
Thank you for your beta testing.
@Clonk: I think here we should work together to produce a new "official" version of the Clonk. So keep me update on your changes to the file.
I changed only the Steampunk model, for I want to use it as a base for a new one.
There are some overlapping vertices in the back that I adjusted. Also I tried to clean up some of quad flow around the lower back region.
Another main difference is, that the ears have been swapped for some reason.
It's hard to make changes on this model, for it's been designed to have a low triangle count. But is that even still a thing?
Does it make sense for me, clean up the flow of quads even more, to have a maintable mesh?
I just ask, because don't think that triangle count is notable anymore and I want to have a mesh, atleast for myself, to properly go on from.
There are some overlapping vertices in the back that I adjusted. Also I tried to clean up some of quad flow around the lower back region.
Another main difference is, that the ears have been swapped for some reason.
It's hard to make changes on this model, for it's been designed to have a low triangle count. But is that even still a thing?
Does it make sense for me, clean up the flow of quads even more, to have a maintable mesh?
I just ask, because don't think that triangle count is notable anymore and I want to have a mesh, atleast for myself, to properly go on from.
Attachment: clonk_changed.zip (1872k)

And well, to have a low polycount is still not a bad thing. So its advisable to not use more vertices then the mesh needs.
Maybe we even have to import the Clonk into a new clean Blender file to adjust the Layout to the current Blender versions defaults.
Again, I only editted the steampunk for now.
I think the mesh is now cleaner and should still be animated as before.
There is only one loop I didn't fully close, since it would add a lot vertices without gaining any detail.
I hereby license the file clonk_changed.zip under the CC-BY license
I think the mesh is now cleaner and should still be animated as before.
There is only one loop I didn't fully close, since it would add a lot vertices without gaining any detail.
I hereby license the file clonk_changed.zip under the CC-BY license
Attachment: clonk_changed.zip (1869k)
I just encountered another error :S
register_class(...):
Warning: 'MT_mini_report' doesn't contain '_MT_' with prefix & suffix
<bpy_struct, Object("MyArmature")>
ActMap track: {'Name': 'Action', 'ExportName': '', 'Start': -1, 'End': -1, 'Group': ''}
Traceback (most recent call last):
File "C:\Users\Apfelmann\Desktop\rg_clonk\mh.blend\ui.py", line 263, in execute
File "<string>", line 33, in dot_skeleton
File "<string>", line 582, in to_xml
AttributeError: 'NoneType' object has no attribute 'action'
The armature is just a single bone, no ActMap. I tried exporting the skeleton.
Could it be that I still use an outdated version?
EDIT: + another one
Done at 0.15 seconds
- Writing submeshes
Done at 0.16 seconds
- Created .mesh.xml at 0.17 seconds
FileNotFoundError [WinError 2] Das System kann die angegebene Datei nicht finden
C:\Users\Apfelmann\Desktop\rg_clonk\export\Scene.material
This one occurs with the mesh export. The Graphics.mesh is not generated.
register_class(...):
Warning: 'MT_mini_report' doesn't contain '_MT_' with prefix & suffix
<bpy_struct, Object("MyArmature")>
ActMap track: {'Name': 'Action', 'ExportName': '', 'Start': -1, 'End': -1, 'Group': ''}
Traceback (most recent call last):
File "C:\Users\Apfelmann\Desktop\rg_clonk\mh.blend\ui.py", line 263, in execute
File "<string>", line 33, in dot_skeleton
File "<string>", line 582, in to_xml
AttributeError: 'NoneType' object has no attribute 'action'
The armature is just a single bone, no ActMap. I tried exporting the skeleton.
Could it be that I still use an outdated version?
EDIT: + another one
Done at 0.15 seconds
- Writing submeshes
Done at 0.16 seconds
- Created .mesh.xml at 0.17 seconds
FileNotFoundError [WinError 2] Das System kann die angegebene Datei nicht finden
C:\Users\Apfelmann\Desktop\rg_clonk\export\Scene.material
This one occurs with the mesh export. The Graphics.mesh is not generated.

I reloaded all scripts, it does export now and looks fine on first glance in the editor.
Thank you
Thank you

Whats is the best option to export existing models that were created without Randrians .blend template with the new exporter? Copy all the python scripts to the existing project each time?

I prepared a script "load_scripts.py" that can be added to the .blend file and executed to import the other scripts.
If someone has another or a better idea, I also would be open.
We could also make the user register the Exporter as a Blender Addon. Could make it a bit harder than just having to open a .blend file which is ready made configured.
Maybe we can also use an exporter that allows both.

Already a few months ago I tried to export the normal Clonk with the latest changes from the repo and had some problems and errors with the scripts on export as well. That is why I made a few changes to the scripts and put them inside a Blender addon, that can actually be used in any blend file directly.
Some more changes and fixes I made:
- Resolved the error with: "Warning: 'MT_mini_report' doesn't contain '_MT_' with prefix & suffix" (There was a naming error on a call to CLONK_MT_mini_report)
- Put the OgreXMLConverter.exe inside the Addon folder so it will be found directly
- Export only deform bones
- Removed some print statements that heavily slowed down the export
- some smaller changes
Other than that I worked on the Clonk blend file itself and merged the two armatures together which makes working with it a little bit easier. I adjusted the addon in that regard as well, so it will only need one armature.
I'd really much like to share the changes I made. So Randrian if you want to look these changes and then maybe allow for a pull request, that'd be appreciated :)

There are more people having access to it, so you don't have to wait for one particular person.
It'd probably be helpful if, in addition, you could write a short post on how to animate your model (no idea if anyone will ever pick this up though).

That's a good point to push it to the resource repository. I think there is an old version of the scripts already, that aren't working anymore as far as I know.
Sure I can write a quick note about the model as well as uploading the model there. :)
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill