Browse Source

Fixes crash from unnamed animation sequences.
Unnamed sequences are now renamed 'ambient'. Crash found in shape models/glTF2/simple_skin/simple_skin.gltf.

OTHGMars 6 năm trước cách đây
mục cha
commit
04355156de

+ 4 - 0
Engine/source/ts/assimp/assimpAppSequence.cpp

@@ -16,6 +16,10 @@ AssimpAppSequence::AssimpAppSequence(aiAnimation *a) :
    seqStart(0.0f),
    mAnim(a)
 {
+   mSequenceName = mAnim->mName.C_Str();
+   if (mSequenceName.isEmpty())
+      mSequenceName = "ambient";
+
    // From: http://sir-kimmi.de/assimp/lib_html/data.html#anims
    // An aiAnimation has a duration. The duration as well as all time stamps are given in ticks.
    // To get the correct timing, all time stamp thus have to be divided by aiAnimation::mTicksPerSecond.

+ 2 - 1
Engine/source/ts/assimp/assimpAppSequence.h

@@ -22,6 +22,7 @@
 
 class AssimpAppSequence : public AppSequence
 {
+   String   mSequenceName;
    F32      seqStart;
    F32      seqEnd;
 
@@ -37,7 +38,7 @@ public:
    virtual S32 getNumTriggers() const { return 0; }
    virtual void getTrigger(S32 index, TSShape::Trigger& trigger) const { trigger.state = 0; }
 
-   virtual const char* getName() const { return mAnim->mName.C_Str(); }
+   virtual const char* getName() const { return mSequenceName.c_str(); }
 
    F32 getStart() const { return seqStart; }
    F32 getEnd() const { return seqEnd; }