summaryrefslogtreecommitdiff
path: root/indra/newview/llpreviewanim.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-04-08 21:37:12 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-04-08 22:22:09 +0300
commit0e7403df70d3298ba39f2269b999dbda574ea117 (patch)
treefd2c427a2853d6933c5c535ff778b6e8c831677d /indra/newview/llpreviewanim.cpp
parent378855253a4cd65ee0b5f52f2bd887f2795cc99f (diff)
SL-14076 Preview should show more data about motions
Diffstat (limited to 'indra/newview/llpreviewanim.cpp')
-rw-r--r--indra/newview/llpreviewanim.cpp47
1 files changed, 43 insertions, 4 deletions
diff --git a/indra/newview/llpreviewanim.cpp b/indra/newview/llpreviewanim.cpp
index 12ac9e6fc5..d29609fc1e 100644
--- a/indra/newview/llpreviewanim.cpp
+++ b/indra/newview/llpreviewanim.cpp
@@ -35,14 +35,17 @@
#include "llkeyframemotion.h"
#include "llfilepicker.h"
#include "lllineeditor.h"
+#include "lltrans.h"
#include "lluictrlfactory.h"
#include "lluictrlfactory.h"
#include "lldatapacker.h"
extern LLAgent gAgent;
+const S32 ADVANCED_VPAD = 3;
LLPreviewAnim::LLPreviewAnim(const LLSD& key)
- : LLPreview( key )
+ : LLPreview( key ),
+ pMotion(NULL)
{
mCommitCallbackRegistrar.add("PreviewAnim.Play", boost::bind(&LLPreviewAnim::play, this, _2));
}
@@ -53,12 +56,19 @@ BOOL LLPreviewAnim::postBuild()
const LLInventoryItem* item = getItem();
if(item)
{
- gAgentAvatarp->createMotion(item->getAssetUUID()); // preload the animation
+ pMotion = gAgentAvatarp->createMotion(item->getAssetUUID()); // preload the animation
getChild<LLUICtrl>("desc")->setValue(item->getDescription());
}
childSetCommitCallback("desc", LLPreview::onText, this);
getChild<LLLineEditor>("desc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe);
+ getChild<LLTextBox>("adv_trigger")->setClickedCallback(boost::bind(&LLPreviewAnim::showAdvanced, this));
+ pAdvancedStatsTextBox = getChild<LLTextBox>("AdvancedStats");
+
+ // Assume that advanced stats start visible (for XUI preview tool's purposes)
+ pAdvancedStatsTextBox->setVisible(FALSE);
+ LLRect rect = getRect();
+ reshape(rect.getWidth(), rect.getHeight() - pAdvancedStatsTextBox->getRect().getHeight() - ADVANCED_VPAD, FALSE);
return LLPreview::postBuild();
}
@@ -167,8 +177,8 @@ void LLPreviewAnim::cleanup()
this->mDidStart = false;
getChild<LLUICtrl>("Inworld")->setValue(FALSE);
getChild<LLUICtrl>("Locally")->setValue(FALSE);
- getChild<LLUICtrl>("Inworld")->setEnabled(true);
- getChild<LLUICtrl>("Locally")->setEnabled(true);
+ getChild<LLUICtrl>("Inworld")->setEnabled(TRUE);
+ getChild<LLUICtrl>("Locally")->setEnabled(TRUE);
}
// virtual
@@ -182,3 +192,32 @@ void LLPreviewAnim::onClose(bool app_quitting)
gAgent.sendAnimationRequest(item->getAssetUUID(), ANIM_REQUEST_STOP);
}
}
+
+void LLPreviewAnim::showAdvanced()
+{
+ BOOL was_visible = pAdvancedStatsTextBox->getVisible();
+
+ if (was_visible)
+ {
+ pAdvancedStatsTextBox->setVisible(FALSE);
+ LLRect rect = getRect();
+ reshape(rect.getWidth(), rect.getHeight() - pAdvancedStatsTextBox->getRect().getHeight() - ADVANCED_VPAD, FALSE);
+ }
+ else
+ {
+ pAdvancedStatsTextBox->setVisible(TRUE);
+ LLRect rect = getRect();
+ reshape(rect.getWidth(), rect.getHeight() + pAdvancedStatsTextBox->getRect().getHeight() + ADVANCED_VPAD, FALSE);
+
+ // set text
+ if (pMotion)
+ {
+ 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()));
+ }
+ }
+}