summaryrefslogtreecommitdiff
path: root/indra/newview/llpreviewanim.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpreviewanim.cpp')
-rw-r--r--indra/newview/llpreviewanim.cpp71
1 files changed, 35 insertions, 36 deletions
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<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()
+{
+ 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 +107,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;