WIP: Dae-animation support
This MR implements a basic bridge for osgAnimations(dae) to OpenMW in the most format-agnostic way possible. Took a while to figure out what goes where, and this is the first system that works. I haven't given any thought to optimization, just tried to make one simple thing that works.
I'm not sure what to do next. It's probably a good time to give some feedback. Is this a good approach in the first place?
Issues of this MR:
- Currently, the root bone of object has to be named "root". If root bone with this name isn't found, the game crashes.
- The BasicAnimationManager is currently found only for model with a similar structure as Seymour.dae, it might or might not work for other models.
- There are sometimes errors when loading models, result is marker_error. This happens when loading a save with a dae-model that wasn't there during the save (loading from memory with istringstram). This is likely related to OpenMW vfs using relative paths, and Collada plugin only accepting URI-paths.
- Collada models only accept "file" URI-paths for textures, this is an OSG limitation.
- Relative paths for image textures don't work with OpenMW's vfs yet.
- Animated characters can't move in the world yet, possibly related to world translations
- Bounding box support in files is not tested/researched
- Doesn't properly support and control correctly which animations are played. This is not straightforward to solve, because animations in OpenMW are (to my understanding, partly guesswork) controlled by timed keyframes that are all pieces of one animation. In nif-format (again, guessing) textkeys are used to store information of each animation's place in timeframe. Collada, BasicAnimationManager and Godot's exporter handle animations through separate clips (which have start and end). KeyFrameManager (callback) gets time, but not the animation that is played. Intermediate layer might have to frame-by-frame convert this "nif-time" into correct clips in osgAnimation::BasicAnimationManager.
- caps do matter in animation names (e.g. "Idle" doesn't work, while "idle" does)
OSG dae plugin issues
- Plugin doesn't clone pluginOptions.options (image loader can't handle relative paths in dae) See: https://github.com/openscenegraph/OpenSceneGraph/pull/967
- Plugin doesn't get names of bones and skeleton to osg nodes (this helps recognizing certain nodes) See: https://github.com/openscenegraph/OpenSceneGraph/pull/968
- Plugin prevents using other URI than "file", which prevents using OpenMW's virtual file system See: https://github.com/openscenegraph/OpenSceneGraph/pull/969
- Animation clip end-time is named "duration" in OSG. This needs research...
Issues with Godot Engine's "Better" Collada exporter for Blender
- Exporter doesn't work at all with Blender version >= 2.8 See: https://github.com/godotengine/collada-exporter/pull/123 (which includes similar change as simple, more tested https://github.com/artellblender/collada-exporter-2.8/pull/3 )
- Exporter doesn't convert UV coordinates to correct space, results in turned textures See: https://github.com/godotengine/collada-exporter/issues/121
- Exporter fails to export alpha See: https://github.com/godotengine/collada-exporter/issues/122
- Exporter doesn't give animation clips id's (id="something"), but does give names (name="something"). This doesn't play well with osg dae plugin that seems to read id's, but not names.
Issues of Unkown cause
- "Failed to find matching <bind_vertex_input> for CHANNEL1, Error: Extra content at the end of the document" is a common error in dae animation files. It might be an exporter problem, or OSG dae plugin parsing problem.