summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-12-03 19:50:55 +0200
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-12-03 19:51:48 +0200
commit5f8391147dc6977640eb9986a5ba836e2702747e (patch)
treebc416e2dc33f6437fad3f0f0d668464316755461 /indra
parente607cafa2a6d7c5add9a2cb05625cc1f98a0f1ab (diff)
SL-16443 Fix crash at showAdvanced
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llpreviewanim.cpp28
-rw-r--r--indra/newview/llpreviewanim.h1
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;
};