diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index e961290510..37edd8aa5d 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -26294,5 +26294,16 @@ Change of this parameter will affect the layout of buttons in notification toast Value 0 + FSAnimationPreviewExpanded + + Comment + Expand or collapse the advanced animation information in the animation preview floater by default + Persist + 1 + Type + Boolean + Value + 0 + diff --git a/indra/newview/llpreviewanim.cpp b/indra/newview/llpreviewanim.cpp index cfc7b8aa9b..95557725ea 100644 --- a/indra/newview/llpreviewanim.cpp +++ b/indra/newview/llpreviewanim.cpp @@ -40,13 +40,17 @@ #include "lluictrlfactory.h" #include "lldatapacker.h" +#include "llviewercontrol.h" // Make advanced animation preview optional + extern LLAgent gAgent; -//const S32 ADVANCED_VPAD = 3; // Improved animation preview LLPreviewAnim::LLPreviewAnim(const LLSD& key) : LLPreview( key ) { mCommitCallbackRegistrar.add("PreviewAnim.Play", boost::bind(&LLPreviewAnim::play, this, _2)); + // Make advanced animation preview optional + mCommitCallbackRegistrar.add("PreviewAnim.Expand", boost::bind(&LLPreviewAnim::expand, this, _2)); + // } // virtual @@ -54,15 +58,15 @@ BOOL LLPreviewAnim::postBuild() { childSetCommitCallback("desc", LLPreview::onText, this); getChild("desc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe); - // Improved animation preview - //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); - // + // Make advanced animation preview optional + bool expanded = gSavedSettings.getBOOL("FSAnimationPreviewExpanded"); + + getChild("advanced_info_panel")->setVisible(!expanded); + getChild("btn_expand")->setToggleState(expanded); + + expand(LLSD()); + // return LLPreview::postBuild(); } @@ -214,42 +218,36 @@ void LLPreviewAnim::onClose(bool app_quitting) } } -// Improved animation preview -//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", 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())); -// } -// } -//} -// +// Make advanced animation preview optional +void LLPreviewAnim::expand(const LLSD& param) +{ + LLView* basic_info_panel = getChild("basic_info_panel"); + LLView* advanced_info_panel = getChild("advanced_info_panel"); + + // I don't get why we can't use getLocalRect().mTop or something similar to get the .top from the XML -Zi + S32 height = getRect().getHeight() - basic_info_panel->getRect().mTop; + S32 basic_info_height = basic_info_panel->getRect().getHeight(); + S32 advanced_info_height = advanced_info_panel->getRect().getHeight(); + + bool was_expanded = advanced_info_panel->getVisible(); + advanced_info_panel->setVisible(!was_expanded); + + height += basic_info_height; + if (!was_expanded) + { + height += advanced_info_height; + } + + LLRect rect = getRect(); + + rect.setLeftTopAndSize(rect.mLeft, rect.mTop, rect.getWidth(), height); + reshape(rect.getWidth(), rect.getHeight(), false); + + setRect(rect); + + if(getHost()) + { + getHost()->growToFit(rect.getWidth(), height); + } +} +// diff --git a/indra/newview/llpreviewanim.h b/indra/newview/llpreviewanim.h index 8f604f274a..ba5bb58277 100644 --- a/indra/newview/llpreviewanim.h +++ b/indra/newview/llpreviewanim.h @@ -45,15 +45,13 @@ public: void cleanup(); // cleanup 'playing' state void play(const LLSD& param); - // Improved animation preview - //void showAdvanced(); protected: + void expand(const LLSD& param); // Make advanced animation preview optional + LLUUID mItemID; // Not an item id, but a playing asset id bool mDidStart; - // Improved animation preview - //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 57f8d6ea23..78b2712a1b 100644 --- a/indra/newview/skins/default/xui/en/floater_preview_animation.xml +++ b/indra/newview/skins/default/xui/en/floater_preview_animation.xml @@ -1,7 +1,18 @@ + + + Animation: [NAME] + + + + Description: @@ -38,6 +59,7 @@ top_delta="-2" right="-10" /> + + + + + + Priority: [PRIORITY] Duration: [DURATION]s @@ -86,9 +134,9 @@ Loop: [IS_LOOP] length="1" follows="left|top" font="SansSerif" - height="91" + height="52" layout="topleft" - left_pad="5" + left_pad="10" name="AdvancedStatsRight" top_delta="0" width="150"> @@ -96,4 +144,5 @@ Ease In: [EASE_IN]s Ease Out: [EASE_OUT]s Joints: [NUM_JOINTS] +