Skip to content
Snippets Groups Projects
Commit 5f839114 authored by Andrey Kleshchev's avatar Andrey Kleshchev
Browse files

SL-16443 Fix crash at showAdvanced

parent e607cafa
No related branches found
No related tags found
No related merge requests found
......@@ -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()));
}
}
}
......@@ -51,7 +51,6 @@ class LLPreviewAnim : public LLPreview
LLUUID mItemID; // Not an item id, but a playing asset id
bool mDidStart;
LLMotion* pMotion;
LLTextBox* pAdvancedStatsTextBox;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment