From 0e7403df70d3298ba39f2269b999dbda574ea117 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 8 Apr 2021 21:37:12 +0300 Subject: SL-14076 Preview should show more data about motions --- indra/newview/llpreviewanim.cpp | 47 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 4 deletions(-) (limited to 'indra/newview/llpreviewanim.cpp') 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("desc")->setValue(item->getDescription()); } childSetCommitCallback("desc", LLPreview::onText, this); getChild("desc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe); + getChild("adv_trigger")->setClickedCallback(boost::bind(&LLPreviewAnim::showAdvanced, this)); + pAdvancedStatsTextBox = getChild("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("Inworld")->setValue(FALSE); getChild("Locally")->setValue(FALSE); - getChild("Inworld")->setEnabled(true); - getChild("Locally")->setEnabled(true); + getChild("Inworld")->setEnabled(TRUE); + getChild("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())); + } + } +} -- cgit v1.2.3 From e611a30fe742dbae02d20062532ca92473da9bed Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 27 May 2021 22:44:47 +0300 Subject: SL-14076 Fix motion preloading --- indra/newview/llpreviewanim.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'indra/newview/llpreviewanim.cpp') diff --git a/indra/newview/llpreviewanim.cpp b/indra/newview/llpreviewanim.cpp index d29609fc1e..97f1dcd5d0 100644 --- a/indra/newview/llpreviewanim.cpp +++ b/indra/newview/llpreviewanim.cpp @@ -53,13 +53,6 @@ LLPreviewAnim::LLPreviewAnim(const LLSD& key) // virtual BOOL LLPreviewAnim::postBuild() { - const LLInventoryItem* item = getItem(); - if(item) - { - pMotion = gAgentAvatarp->createMotion(item->getAssetUUID()); // preload the animation - getChild("desc")->setValue(item->getDescription()); - } - childSetCommitCallback("desc", LLPreview::onText, this); getChild("desc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe); getChild("adv_trigger")->setClickedCallback(boost::bind(&LLPreviewAnim::showAdvanced, this)); @@ -73,7 +66,6 @@ BOOL LLPreviewAnim::postBuild() return LLPreview::postBuild(); } -// static // llinventorybridge also calls into here void LLPreviewAnim::play(const LLSD& param) { @@ -171,6 +163,20 @@ void LLPreviewAnim::draw() } // virtual +void LLPreviewAnim::refreshFromItem() +{ + const LLInventoryItem* item = getItem(); + if (!item) + { + return; + } + + // Preload motion + pMotion = gAgentAvatarp->createMotion(item->getAssetUUID()); + + LLPreview::refreshFromItem(); +} + void LLPreviewAnim::cleanup() { this->mItemID = LLUUID::null; -- cgit v1.2.3 From 5f8391147dc6977640eb9986a5ba836e2702747e Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 3 Dec 2021 19:50:55 +0200 Subject: SL-16443 Fix crash at showAdvanced --- indra/newview/llpreviewanim.cpp | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'indra/newview/llpreviewanim.cpp') 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())); } } } -- cgit v1.2.3