diff options
Diffstat (limited to 'indra/newview/llpreviewanim.cpp')
-rw-r--r-- | indra/newview/llpreviewanim.cpp | 77 |
1 files changed, 38 insertions, 39 deletions
diff --git a/indra/newview/llpreviewanim.cpp b/indra/newview/llpreviewanim.cpp index 3212de0639..3bda30e0c6 100644 --- a/indra/newview/llpreviewanim.cpp +++ b/indra/newview/llpreviewanim.cpp @@ -36,8 +36,7 @@ #include "llbutton.h" #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 +46,56 @@ 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<LLFloater>* handlep = ((LLHandle<LLFloater>*)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() +{ + mCloseSignal.connect(boost::bind(&LLPreviewAnim::onClose, this)); + + 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; @@ -95,19 +108,6 @@ LLPreviewAnim::LLPreviewAnim(const std::string& name, const LLRect& rect, const } // static -void LLPreviewAnim::endAnimCallback( void *userdata ) -{ - LLHandle<LLFloater>* handlep = ((LLHandle<LLFloater>*)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 ) { LLPreviewAnim* self = (LLPreviewAnim*) userdata; @@ -181,7 +181,7 @@ void LLPreviewAnim::auditionAnim( void *userdata ) } } -void LLPreviewAnim::onClose(bool app_quitting) +void LLPreviewAnim::onClose() { const LLInventoryItem *item = getItem(); @@ -199,5 +199,4 @@ void LLPreviewAnim::onClose(bool app_quitting) motion->setDeactivateCallback(NULL, (void *)NULL); } } - destroy(); } |