Archive 17/01/2023.

How to use blend shapes?

artgolf1000

Hi,

I have exported a 3d model with blend shapes and a skeleton animation with Blender’s Urho3D add-on:
body.mdl
body.ani

But I can not figure out how to use blend shapes, can somebody show me a piece of code?

Thank you.

codingmonkey

Hi!
As I remember blendshapes stored in mdl binary file, That’s why there is no needing in additional *.ani files to animate blandshapes.
For using morph you just need get it or set weight from/for AnimatedModel with methods

[code]const Vector< ModelMorph > & GetMorphs () const

unsigned GetNumMorphs () const
Return number of vertex morphs.

float GetMorphWeight (unsigned index) const
Return vertex morph weight by index.

float GetMorphWeight (const String &name) const
Return vertex morph weight by name.

float GetMorphWeight (StringHash nameHash) const
Return vertex morph weight by name hash. [/code]
see doc: urho3d.github.io/documentation/ … model.html

Mike

Also check http://discourse.urho3d.io/t/animation-for-morphs-file-format/628/1

artgolf1000

Thanks, I have found that ‘AssetImporter’ does not support exporting blend shapes at present, I guess it is a TODO work in future.

Lumak

edit: wow, did I even read the 1st post before writing this?! I must’ve been asleep when I wrote it. Pls, ignore.