diff options
-rw-r--r-- | indra/newview/llpreviewanim.cpp | 28 | ||||
-rw-r--r-- | indra/newview/llpreviewanim.h | 1 |
2 files changed, 18 insertions, 11 deletions
diff --git a/indra/newview/llpreviewanim.cpp b/indra/newview/llpreviewanim.cpp index 97f1dcd5d0..7f01438425 100644 --- a/indra/newview/llpreviewanim.cpp +++ b/indra/newview/llpreviewanim.cpp @@ -44,8 +44,7 @@ extern LLAgent gAgent; const S32 ADVANCED_VPAD = 3; LLPreviewAnim::LLPreviewAnim(const LLSD& key) - : LLPreview( key ), - pMotion(NULL) + : LLPreview( key ) { mCommitCallbackRegistrar.add("PreviewAnim.Play", boost::bind(&LLPreviewAnim::play, this, _2)); } @@ -172,7 +171,7 @@ void LLPreviewAnim::refreshFromItem() } // Preload motion - pMotion = gAgentAvatarp->createMotion(item->getAssetUUID()); + gAgentAvatarp->createMotion(item->getAssetUUID()); LLPreview::refreshFromItem(); } @@ -215,15 +214,24 @@ void LLPreviewAnim::showAdvanced() LLRect rect = getRect(); reshape(rect.getWidth(), rect.getHeight() + pAdvancedStatsTextBox->getRect().getHeight() + ADVANCED_VPAD, FALSE); + LLMotion *motion = NULL; + const LLInventoryItem* item = getItem(); + if (item) + { + // if motion exists, will return existing one. + // Needed because viewer can purge motions + motion = gAgentAvatarp->createMotion(item->getAssetUUID()); + } + // set text - if (pMotion) + if (motion) { - pAdvancedStatsTextBox->setTextArg("[PRIORITY]", llformat("%d", pMotion->getPriority())); - pAdvancedStatsTextBox->setTextArg("[DURATION]", llformat("%.2f", pMotion->getDuration())); - pAdvancedStatsTextBox->setTextArg("[EASE_IN]", llformat("%.2f", pMotion->getEaseInDuration())); - pAdvancedStatsTextBox->setTextArg("[EASE_OUT]", llformat("%.2f", pMotion->getEaseOutDuration())); - pAdvancedStatsTextBox->setTextArg("[IS_LOOP]", (pMotion->getLoop() ? LLTrans::getString("PermYes") : LLTrans::getString("PermNo"))); - pAdvancedStatsTextBox->setTextArg("[NUM_JOINTS]", llformat("%d", pMotion->getNumJointMotions())); + pAdvancedStatsTextBox->setTextArg("[PRIORITY]", llformat("%d", motion->getPriority())); + pAdvancedStatsTextBox->setTextArg("[DURATION]", llformat("%.2f", motion->getDuration())); + pAdvancedStatsTextBox->setTextArg("[EASE_IN]", llformat("%.2f", motion->getEaseInDuration())); + pAdvancedStatsTextBox->setTextArg("[EASE_OUT]", llformat("%.2f", motion->getEaseOutDuration())); + pAdvancedStatsTextBox->setTextArg("[IS_LOOP]", (motion->getLoop() ? LLTrans::getString("PermYes") : LLTrans::getString("PermNo"))); + pAdvancedStatsTextBox->setTextArg("[NUM_JOINTS]", llformat("%d", motion->getNumJointMotions())); } } } diff --git a/indra/newview/llpreviewanim.h b/indra/newview/llpreviewanim.h index 14cd53b500..9f4ad4fa69 100644 --- a/indra/newview/llpreviewanim.h +++ b/indra/newview/llpreviewanim.h @@ -51,7 +51,6 @@ protected: LLUUID mItemID; // Not an item id, but a playing asset id bool mDidStart; - LLMotion* pMotion; LLTextBox* pAdvancedStatsTextBox; }; |