Files
SingularityViewer/indra/newview/llfloaterexploreanimations.cpp
Shyotl ffb285c6ff Huge renderer update (WIP). Still plenty to do, especially pertaining to UI.
-Nametag bubble visbility is oddly inconsistent. May vanish with future planned UI merges...
-VBOs are PAINFULLY slow on ATI hardware. This repos self-compiled davep/shining-fixes branch, so I'll leave the ball in LL's court for now regarding that.
2011-12-09 14:02:29 -06:00

375 lines
9.8 KiB
C++

// <edit>
#include "llviewerprecompiledheaders.h"
#include "llfloaterexploreanimations.h"
#include "lluictrlfactory.h"
#include "llscrolllistctrl.h"
#include "llfloateranimpreview.h"
#include "llvoavatar.h"
#include "lllocalinventory.h"
#include "llviewercamera.h"
#include "llviewerwindow.h"
#include "lltoolmgr.h"
// <stuff for jelly roll>
#include "llfloatertools.h"
#include "llselectmgr.h"
// </stuff for jelly roll>
std::map< LLUUID, std::list< LLAnimHistoryItem* > > LLFloaterExploreAnimations::animHistory;
LLFloaterExploreAnimations* LLFloaterExploreAnimations::sInstance;
LLAnimHistoryItem::LLAnimHistoryItem(LLUUID assetid)
{
mAssetID = assetid;
}
LLFloaterExploreAnimations::LLFloaterExploreAnimations(LLUUID avatarid)
: LLFloater()
{
mLastMouseX = 0;
mLastMouseY = 0;
LLFloaterExploreAnimations::sInstance = this;
mAvatarID = avatarid;
mAnimPreview = new LLPreviewAnimation(256, 256);
mAnimPreview->setZoom(2.0f);
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_explore_animations.xml");
}
void LLFloaterExploreAnimations::close(bool app_quitting)
{
LLFloater::close(app_quitting);
}
LLFloaterExploreAnimations::~LLFloaterExploreAnimations()
{
mAnimPreview = NULL;
LLFloaterExploreAnimations::sInstance = NULL;
}
BOOL LLFloaterExploreAnimations::postBuild(void)
{
childSetCommitCallback("anim_list", onSelectAnimation, this);
LLRect r = getRect();
mPreviewRect.set(r.getWidth() - 266, r.getHeight() - 25, r.getWidth() - 10, r.getHeight() - 256);
update();
return TRUE;
}
void LLFloaterExploreAnimations::update()
{
LLScrollListCtrl* list = getChild<LLScrollListCtrl>("anim_list");
LLUUID selection = list->getSelectedValue().asUUID();
list->clearRows(); // do this differently probably
std::list<LLAnimHistoryItem*> history = animHistory[mAvatarID];
std::list<LLAnimHistoryItem*>::iterator iter = history.begin();
std::list<LLAnimHistoryItem*>::iterator end = history.end();
for( ; iter != end; ++iter)
{
LLAnimHistoryItem* item = (*iter);
LLSD element;
element["id"] = item->mAssetID;
LLSD& name_column = element["columns"][0];
name_column["column"] = "name";
name_column["value"] = item->mAssetID.asString();
LLSD& info_column = element["columns"][1];
info_column["column"] = "info";
if(item->mPlaying)
info_column["value"] = "Playing";
else
info_column["value"] = llformat("%.1f min ago", (LLTimer::getElapsedSeconds() - item->mTimeStopped) / 60.f);
list->addElement(element, ADD_BOTTOM);
}
list->selectByID(selection);
}
void LLFloaterExploreAnimations::draw()
{
LLFloater::draw();
LLRect r = getRect();
mPreviewRect.set(r.getWidth() - 266, r.getHeight() - 25, r.getWidth() - 10, r.getHeight() - 256);
gGL.color3f(1.f, 1.f, 1.f);
gGL.getTexUnit(0)->bind(mAnimPreview);
gGL.begin( LLRender::QUADS );
{
gGL.texCoord2f(0.f, 1.f);
gGL.vertex2i(mPreviewRect.mLeft, mPreviewRect.mTop);
gGL.texCoord2f(0.f, 0.f);
gGL.vertex2i(mPreviewRect.mLeft, mPreviewRect.mBottom);
gGL.texCoord2f(1.f, 0.f);
gGL.vertex2i(mPreviewRect.mRight, mPreviewRect.mBottom);
gGL.texCoord2f(1.f, 1.f);
gGL.vertex2i(mPreviewRect.mRight, mPreviewRect.mTop);
}
gGL.end();
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
//LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
//if (!avatarp->areAnimationsPaused())
//{
// mAnimPreview->requestUpdate();
//}
}
// static
void LLFloaterExploreAnimations::startAnim(LLUUID avatarid, LLUUID assetid)
{
std::string asset_str = assetid.asString();
if(asset_str.find("17132261-c061") != std::string::npos) return; // dog1
else if(asset_str.find("fea558cb-8b9b") != std::string::npos) return; // dog2
else if(asset_str.find("50cb5750-0743") != std::string::npos) return; // dog3