summaryrefslogtreecommitdiff
path: root/indra/newview/llpreviewanim.cpp
diff options
context:
space:
mode:
authorMnikolenko Productengine <mnikolenko@productengine.com>2022-03-02 00:46:10 +0200
committerMnikolenko Productengine <mnikolenko@productengine.com>2022-03-02 00:46:10 +0200
commit0aaf5284dced4ec41924c771a382d12ddc5f3d1b (patch)
tree448ad9399feee611f992ceeb667cd4e47e9ab594 /indra/newview/llpreviewanim.cpp
parent882600de2afa366729be870355767282247be0ef (diff)
parent6ca09a94554ec01f5c94ec60fffd01d7e33f3546 (diff)
Merge branch 'master' into DRTVWR-539
# Conflicts: # autobuild.xml # doc/contributions.txt # indra/cmake/GLOD.cmake # indra/llcommon/tests/llprocess_test.cpp # indra/newview/VIEWER_VERSION.txt # indra/newview/lldrawpoolavatar.cpp # indra/newview/llfloatermodelpreview.cpp # indra/newview/llmodelpreview.cpp # indra/newview/llviewertexturelist.cpp # indra/newview/llvovolume.cpp # indra/newview/viewer_manifest.py
Diffstat (limited to 'indra/newview/llpreviewanim.cpp')
-rw-r--r--indra/newview/llpreviewanim.cpp73
1 files changed, 63 insertions, 10 deletions
diff --git a/indra/newview/llpreviewanim.cpp b/indra/newview/llpreviewanim.cpp
index 12ac9e6fc5..7f01438425 100644
--- a/indra/newview/llpreviewanim.cpp
+++ b/indra/newview/llpreviewanim.cpp
@@ -35,11 +35,13 @@
#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 )
@@ -50,20 +52,19 @@ LLPreviewAnim::LLPreviewAnim(const LLSD& key)
// virtual
BOOL LLPreviewAnim::postBuild()
{
- const LLInventoryItem* item = getItem();
- if(item)
- {
- 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();
}
-// static
// llinventorybridge also calls into here
void LLPreviewAnim::play(const LLSD& param)
{
@@ -161,14 +162,28 @@ void LLPreviewAnim::draw()
}
// virtual
+void LLPreviewAnim::refreshFromItem()
+{
+ const LLInventoryItem* item = getItem();
+ if (!item)
+ {
+ return;
+ }
+
+ // Preload motion
+ gAgentAvatarp->createMotion(item->getAssetUUID());
+
+ LLPreview::refreshFromItem();
+}
+
void LLPreviewAnim::cleanup()
{
this->mItemID = LLUUID::null;
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 +197,41 @@ 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);
+
+ 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 (motion)
+ {
+ 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()));
+ }
+ }
+}