From 9ec432034dc3c45d7ce763eb02dae4cc7f6b8da8 Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Sun, 21 Jun 2009 08:04:56 +0000 Subject: merge -r 122421-124917 viewer-2.0.0-2 -> viewer-2.0.0-3 ignore-dead-branch --- indra/newview/llpreviewanim.cpp | 71 ++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 36 deletions(-) (limited to 'indra/newview/llpreviewanim.cpp') diff --git a/indra/newview/llpreviewanim.cpp b/indra/newview/llpreviewanim.cpp index 3212de0639..6857d14fff 100644 --- a/indra/newview/llpreviewanim.cpp +++ b/indra/newview/llpreviewanim.cpp @@ -37,7 +37,7 @@ #include "llresmgr.h" #include "llinventory.h" #include "llinventoryview.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llagent.h" // gAgent #include "llkeyframemotion.h" #include "llfilepicker.h" @@ -47,42 +47,54 @@ extern LLAgent gAgent; -LLPreviewAnim::LLPreviewAnim(const std::string& name, const LLRect& rect, const std::string& title, const LLUUID& item_uuid, const S32& activate, const LLUUID& object_uuid ) : - LLPreview( name, rect, title, item_uuid, object_uuid) +LLPreviewAnim::LLPreviewAnim(const LLSD& key) + : LLPreview( key ) { - LLUICtrlFactory::getInstance()->buildFloater(this,"floater_preview_animation.xml"); - - childSetAction("Anim play btn",playAnim,this); - childSetAction("Anim audition btn",auditionAnim,this); - - const LLInventoryItem* item = getItem(); - - childSetCommitCallback("desc", LLPreview::onText, this); - childSetText("desc", item->getDescription()); - childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe); - - setTitle(title); + //Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this,"floater_preview_animation.xml", FALSE); +} - if (!getHost()) +// static +void LLPreviewAnim::endAnimCallback( void *userdata ) +{ + LLHandle* handlep = ((LLHandle*)userdata); + LLFloater* self = handlep->get(); + delete handlep; // done with the handle + if (self) { - LLRect curRect = getRect(); - translate(rect.mLeft - curRect.mLeft, rect.mTop - curRect.mTop); + self->childSetValue("Anim play btn", FALSE); + self->childSetValue("Anim audition btn", FALSE); } +} - // preload the animation +// virtual +BOOL LLPreviewAnim::postBuild() +{ + const LLInventoryItem* item = getItem(); if(item) { - gAgent.getAvatarObject()->createMotion(item->getAssetUUID()); + gAgent.getAvatarObject()->createMotion(item->getAssetUUID()); // preload the animation + childSetText("desc", item->getDescription()); } + + childSetAction("Anim play btn",playAnim, this); + childSetAction("Anim audition btn",auditionAnim, this); + + childSetCommitCallback("desc", LLPreview::onText, this); + childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe); - switch ( activate ) + return LLPreview::postBuild(); +} + +void LLPreviewAnim::activate(e_activation_type type) +{ + switch ( type ) { - case 1: + case PLAY: { playAnim( (void *) this ); break; } - case 2: + case AUDITION: { auditionAnim( (void *) this ); break; @@ -94,19 +106,6 @@ LLPreviewAnim::LLPreviewAnim(const std::string& name, const LLRect& rect, const } } -// static -void LLPreviewAnim::endAnimCallback( void *userdata ) -{ - LLHandle* handlep = ((LLHandle*)userdata); - LLFloater* self = handlep->get(); - delete handlep; // done with the handle - if (self) - { - self->childSetValue("Anim play btn", FALSE); - self->childSetValue("Anim audition btn", FALSE); - } -} - // static void LLPreviewAnim::playAnim( void *userdata ) { -- cgit v1.2.3