Page MenuHome

Collada export custom properties
Open, NormalPublic

Description

This patch adds functionality to the Collada exporter to export blender's custom properties on geometry, materials and scene nodes.

I'm not sure this is the best way to export this data to collada, but I tried to make it as clean as possible.

The main purpose I created this patch is because I'm about to begin a project with which I need to use Blender as my level editor, and the best way I see to export waypoints/triggers/etc from blender, is using custom properties and Collada format seems optimal.

Details

Type
Patch

Event Timeline

Assigning to myself. I'm short on time currently so if someone else has time to review feel free to reassign and work on it.

Ressigning to Arystanbek, since Nathan doesn't seem to have and and Arystanbek he is back doing collada fixing. Thanks for the patch.

I need this capability as well. Has this been included in a Blender release?
I would like to be able to export ANY custom properties into collada... and maybe establish a mechanism by which they can be imported as well, maybe by setting up a special attribute to be looked for by the importer.

Sergey,
I see that you re-assigned this task recently. Please let me know if help is needed. I am not familiar with the Blender codebase but I am an expert C++ developer and architect, and I am willing to invest some of my time to get this capability, and the import capability, implemented sooner than later.

Any help from a good developer is very welcome. In this particular issue we probably would add something to the "blender collada profile". Please feel free to give us a helping hand here. Thanks.

I'm very interested in this feature. Any progress?
If I wanted to implement this, where should I start?

Thank you,

The Collada exporter/importer is implemented in C++ and it is in the blender source code. IMHO the correct implementation should be done by defining (improving) a Collada Profile. We already have some basic Blender Collada profile defined (but i doubt this has ever ben made official).

The Blender Collada module is based on the OpenCollada libraries.

It might be interesting to first check if the Autodesk/MAYA Collada profile already contains the necessary elements. Then this profile could possibly be reused (i am not sure if this is good or bad). The benefit of doing this could be that Imports to/from Maya could become less troublesome.

I am also still interested, sorry if I was disconnected for a while.
I also would like to know how to start. I see that it is C++... which is great.

Do we have a stand-alone implementation of the "Profile" that we can study to learn about it... and some test data?

I hope I don't need to learn the whole Blender architecture from scratch.

Any pointers are appreciated.

Sorry forgot collada was not treated as an add on

I am also interested in this and IMHO this is an important feature for those engines that use blender as a level editor.

In my case, I maintain a patch that exports some custom variables somewhere in the .dae file (https://github.com/godlikepanos/anki-3d-engine/blob/master/tools/blender_anki_additions.patch). It's really annoying when I have to convince people to apply this patch and build blender from source (especially if they are artists).

@Panaglotis:
Can you store custom data on a per-vertex basis?

@Panaglotis:
Can you store custom data on a per-vertex basis?

No I haven't tried that. Since COLLADA supports vertex color + bone weights (as fas as I remember) I am covered. Hope I understood the question.

Hi! Will this patch support game properties exporting?
Thanks!

I am starting a big rewrite soon to make this module easier to maintain and easier to understand :)
And i will begin with Mesh export/import. We can have the custom properties added there...

Have you checked if the autodesk/Maya profile supports custom properties? Or any other published profile? Then we should take care to match with that profile. I believe it makes some sense to also support the import of custom properties. Especially if a common profile has them defined.

Is there any chance to take a quick look at that ?

There are list of custom profiles/extensions published on khronos wiki page:

https://www.khronos.org/collada/wiki/List_of_extensions_by_profile_name

I don't think these are updated recently, maybe Blender can adopt some of them? AFAIK modo still uses some of these profiles (modo401, MAX3D, MAYA, OKINO) when exporting (maybe when importing too)

I think that adopting is the better option only if those profiles are actually used by anybody. It would be helpful to see if Maya can export custom properties with its Collada exporter.

I have looked up which profiles are actually used in Blender and i found besides a lot of references to the still undocumented "blender" profile some sparse references to

MAYA, MAX3D, FCOLLADA

I also found one comment about FCOLLADA which implies this is "the most common used profile". However i can't tell if this is more an opinion or more a knowing. But since FCOLLADA supports custom properties, we should use this profile:

https://www.khronos.org/collada/wiki/Entity_user-defined_attributes_FCOLLADA_extension

and add support for import as well :)

AFAIK, FCOLLADA is discontinued software and I'm not sure anybody still uses it (I'm taking about software not profile),

If you are looking for Maya compatibility then;

Maya seems use this:
https://github.com/KhronosGroup/OpenCOLLADA/tree/master/COLLADAMaya

Take a look at bottom of README, It seems OpenCOLLADA for Maya exports extra maya properties under "OpenCOLLADAMaya" profile:

Extract from README:

Extra Attributes
This plug-in currently supports export of Maya extra attributes for the following Maya node types:
. Transform (in <node>)
. Mesh shape (in <geometry>)
. Light shape (in <light>)
. PhysX RigidBody (in <rigid_body>)
. PhysX PhysicsShape (in <shape>)
. PhysX RigidConstraint (in <rigid_constraint>)
Extra attributes are exported in <extra>/<technique profile="OpenCOLLADAMaya"> section of corresponding COLLADA element with the following syntax:
<param name="attribute_name" type="attribute_type">attribute_value</param>
. attribute_name is the name of the extra attribute.
. attribute_type is the type of the extra attribute. Supported types are:

		. "int" (Maya extra attribute type: Integer)
		. "string" (Maya extra attribute type: String or Enum)
		. "float" (Maya extra attribute type: Float)
		. "bool" (Maya extra attribute type: Boolean)
		. "double3" (Maya extra attribute type: Vector)

. attribute_value is the extra attribute value as text.

I couldn't see any documentation about these custom params, just wanted to share it