diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2021-04-08 21:37:12 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2021-04-08 22:22:09 +0300 |
commit | 0e7403df70d3298ba39f2269b999dbda574ea117 (patch) | |
tree | fd2c427a2853d6933c5c535ff778b6e8c831677d /indra/newview | |
parent | 378855253a4cd65ee0b5f52f2bd887f2795cc99f (diff) |
SL-14076 Preview should show more data about motions
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llpreviewanim.cpp | 47 | ||||
-rw-r--r-- | indra/newview/llpreviewanim.h | 8 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_preview_animation.xml | 120 |
3 files changed, 140 insertions, 35 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())); + } + } +} diff --git a/indra/newview/llpreviewanim.h b/indra/newview/llpreviewanim.h index 8eaed6ca1f..ebeee367f7 100644 --- a/indra/newview/llpreviewanim.h +++ b/indra/newview/llpreviewanim.h @@ -30,6 +30,9 @@ #include "llpreview.h" #include "llcharacter.h" +class LLMotion; +class LLTextBox; + class LLPreviewAnim : public LLPreview { public: @@ -40,11 +43,14 @@ public: void draw(); void cleanup(); void play(const LLSD& param); - + void showAdvanced(); + protected: LLUUID mItemID; bool mDidStart; + LLMotion* pMotion; + LLTextBox* pAdvancedStatsTextBox; }; #endif // LL_LLPREVIEWANIM_H diff --git a/indra/newview/skins/default/xui/en/floater_preview_animation.xml b/indra/newview/skins/default/xui/en/floater_preview_animation.xml index 3ea5f54f2c..d1f8da55be 100644 --- a/indra/newview/skins/default/xui/en/floater_preview_animation.xml +++ b/indra/newview/skins/default/xui/en/floater_preview_animation.xml @@ -1,66 +1,126 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <floater legacy_header_height="18" - height="85" + height="241" layout="topleft" name="preview_anim" help_topic="preview_anim" - width="280"> + width="320"> <floater.string name="Title"> Animation: [NAME] </floater.string> - <text - type="string" - length="1" - follows="left|top" - font="SansSerif" - height="19" - layout="topleft" - left="10" - name="desc txt" - top="25" - width="80"> - Description: - </text> - <line_editor - border_style="line" - border_thickness="1" - follows="left|top|right" - font="SansSerifSmall" - height="19" - layout="topleft" - left_delta="95" - max_length_bytes="127" - name="desc" - top="19" - width="170" /> <button height="20" label="Play Inworld" label_selected="Stop" + follows="left|top" layout="topleft" left="10" name="Inworld" tool_tip="Play this animation so that others can see it" - top="47" + top="25" width="125"> <button.commit_callback function="PreviewAnim.Play" parameter="Inworld" /> </button> + <text + type="string" + length="1" + follows="left|top" + font="SansSerif" + height="19" + layout="topleft" + left_pad="10" + name="desc inworld" + top_delta="3" + width="160"> + Other people can see + </text> <button height="20" label="Play Locally" label_selected="Stop" + follows="left|top" layout="topleft" - left_pad="5" + left="10" name="Locally" tool_tip="Play this animation so that only you can see it" - top_delta="0" + top_pad="5" width="125"> <button.commit_callback function="PreviewAnim.Play" parameter="Locally" /> </button> + <text + type="string" + length="1" + follows="left|top" + font="SansSerif" + height="19" + layout="topleft" + left_pad="10" + name="desc local" + top_delta="3" + width="160"> + Only you can see + </text> + <text + type="string" + length="1" + follows="left|top" + font="SansSerif" + height="19" + layout="topleft" + left="10" + name="desc txt" + top_pad="7" + width="80"> + Description: + </text> + <line_editor + border_style="line" + border_thickness="1" + follows="left|top|right" + font="SansSerifSmall" + height="19" + layout="topleft" + left="10" + right="-10" + max_length_bytes="127" + name="desc" + top_pad="0" /> + <text + type="string" + length="1" + follows="left|top" + font="SansSerif" + height="19" + layout="topleft" + left="10" + name="adv_trigger" + top_pad="7" + width="100" + text_color="EmphasisColor"> + Advanced + </text> + <text + type="string" + length="1" + follows="left|top" + font="SansSerif" + height="91" + layout="topleft" + left="10" + name="AdvancedStats" + top_pad="3" + width="200"> +Priority: [PRIORITY] +Duration: [DURATION]s +Ease In: [EASE_IN]s +Ease Out: [EASE_OUT]s +Loop: [IS_LOOP] +Joints: [NUM_JOINTS] + </text> </floater> |