本文整理汇总了C++中LLAgent::getAvatarObject方法的典型用法代码示例。如果您正苦于以下问题:C++ LLAgent::getAvatarObject方法的具体用法?C++ LLAgent::getAvatarObject怎么用?C++ LLAgent::getAvatarObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLAgent
的用法示例。
在下文中一共展示了LLAgent::getAvatarObject方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: auditionAnim
// static
void LLPreviewAnim::auditionAnim( void *userdata )
{
LLPreviewAnim* self = (LLPreviewAnim*) userdata;
const LLInventoryItem *item = self->getItem();
if(item)
{
LLUUID itemID=item->getAssetUUID();
LLButton* btn = self->getChild<LLButton>("Anim audition btn");
if (btn)
{
btn->toggleState();
}
if (self->childGetValue("Anim audition btn").asBoolean() )
{
self->mPauseRequest = NULL;
gAgent.getAvatarObject()->startMotion(item->getAssetUUID());
LLVOAvatar* avatar = gAgent.getAvatarObject();
LLMotion* motion = avatar->findMotion(itemID);
if (motion)
{
motion->setDeactivateCallback(&endAnimCallback, (void *)(new LLHandle<LLFloater>(self->getHandle())));
}
}
else
{
gAgent.getAvatarObject()->stopMotion(itemID);
gAgent.sendAnimationRequest(itemID, ANIM_REQUEST_STOP);
}
}
}
示例2: getItem
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)
{
LLUICtrlFactory::getInstance()->buildFloater(this,"floater_preview_animation.xml");
childSetAction("Anim play btn",playAnim,this);
childSetAction("Anim audition btn",auditionAnim,this);
// <edit>
childSetAction("Anim copy uuid btn", copyAnimID, this);
// </edit>
childSetAction("Anim remake btn",dupliAnim,this);
childSetAction("Anim export btn",exportAnim,this);
childSetAction("Anim .anim btn",exportasdotAnim,this);
childSetEnabled("Anim remake btn", FALSE);
childSetEnabled("Anim export btn", FALSE);
childSetEnabled("Anim .anim btn", FALSE);
mAnimBuffer = NULL;
const LLInventoryItem* item = getItem();
childSetCommitCallback("desc", LLPreview::onText, this);
childSetText("desc", item->getDescription());
childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe);
setTitle(title);
if (!getHost())
{
LLRect curRect = getRect();
translate(rect.mLeft - curRect.mLeft, rect.mTop - curRect.mTop);
}
mAnimBuffer = NULL;
// preload the animation
if(item)
{
gAgent.getAvatarObject()->createMotion(item->getAssetUUID());
gAssetStorage->getAssetData(item->getAssetUUID(), LLAssetType::AT_ANIMATION, downloadCompleteCallback, (void *)(new LLHandle<LLFloater>(this->getHandle())), TRUE);
}
switch ( activate )
{
case 1:
{
playAnim( (void *) this );
break;
}
case 2:
{
auditionAnim( (void *) this );
break;
}
default:
{
//do nothing
}
}
}
示例3: onClose
// virtual
void LLPreviewAnim::onClose(bool app_quitting)
{
const LLInventoryItem *item = getItem();
if(item)
{
gAgent.getAvatarObject()->stopMotion(item->getAssetUUID());
gAgent.sendAnimationRequest(item->getAssetUUID(), ANIM_REQUEST_STOP);
LLVOAvatar* avatar = gAgent.getAvatarObject();
LLMotion* motion = avatar->findMotion(item->getAssetUUID());
if (motion)
{
// *TODO: minor memory leak here, user data is never deleted (Use real callbacks)
motion->setDeactivateCallback(NULL, (void *)NULL);
}
}
}
示例4: getItem
LLPreviewSound::LLPreviewSound(const std::string& name, const LLRect& rect, const std::string& title, const LLUUID& item_uuid, const LLUUID& object_uuid) :
LLPreview( name, rect, title, item_uuid, object_uuid)
{
LLUICtrlFactory::getInstance()->buildFloater(this,"floater_preview_sound.xml");
childSetAction("Sound play btn",&LLPreviewSound::playSound,this);
childSetAction("Sound audition btn",&LLPreviewSound::auditionSound,this);
// <edit>
childSetAction("Sound copy uuid btn", &LLPreviewSound::copyUUID, this);
childSetAction("Play ambient btn", &LLPreviewSound::playAmbient, this);
// </edit>
LLButton* button = getChild<LLButton>("Sound play btn");
button->setSoundFlags(LLView::SILENT);
button = getChild<LLButton>("Sound audition btn");
button->setSoundFlags(LLView::SILENT);
const LLInventoryItem* item = getItem();
childSetCommitCallback("desc", LLPreview::onText, this);
childSetText("desc", item->getDescription());
childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe);
// preload the sound
if(item && gAudiop)
{
gAudiop->preloadSound(item->getAssetUUID());
// <edit>
// that thing above doesn't actually start a sound transfer, so I will do it
//LLAudioSource *asp = new LLAudioSource(gAgent.getID(), gAgent.getID(), F32(1.0f), LLAudioEngine::AUDIO_TYPE_UI);
LLAudioSource *asp = gAgent.getAvatarObject()->getAudioSource(gAgent.getID());
LLAudioData *datap = gAudiop->getAudioData(item->getAssetUUID());
asp->addAudioData(datap, FALSE);
// </edit>
}
setTitle(title);
if (!getHost())
{
LLRect curRect = getRect();
translate(rect.mLeft - curRect.mLeft, rect.mTop - curRect.mTop);
}
}
示例5: getItem
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)
{
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);
if (!getHost())
{
LLRect curRect = getRect();
translate(rect.mLeft - curRect.mLeft, rect.mTop - curRect.mTop);
}
// preload the animation
if(item)
{
gAgent.getAvatarObject()->createMotion(item->getAssetUUID());
}
switch ( activate )
{
case 1:
{
playAnim( (void *) this );
break;
}
case 2:
{
auditionAnim( (void *) this );
break;
}
default:
{
//do nothing
}
}
}
示例6: postBuild
// virtual
BOOL LLPreviewAnim::postBuild()
{
const LLInventoryItem* item = getItem();
if(item)
{
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", &LLTextValidate::validateASCIIPrintableNoPipe);
return LLPreview::postBuild();
}
示例7: dupliAnim
void LLPreviewAnim::dupliAnim( void *userdata )
{
LLPreviewAnim* self = (LLPreviewAnim*) userdata;
//if(!self->childGetValue("Anim play btn").asBoolean())
//{
// printchat("anim must be playing to copy by this method; please try again");
// LLPreviewAnim::playAnim( userdata );
// return;
//}
const LLInventoryItem *item = self->getItem();
if(item)
{
if(self->mAnimBuffer == NULL)
{
return;
}
LLKeyframeMotion* motionp = NULL;
//LLBVHLoader* loaderp = NULL;
LLAssetID xMotionID;
LLTransactionID xTransactionID;
// generate unique id for this motion
xTransactionID.generate();
xMotionID = xTransactionID.makeAssetID(gAgent.getSecureSessionID());
motionp = (LLKeyframeMotion*)gAgent.getAvatarObject()->createMotion(xMotionID);
/*
// pass animation data through memory buffer
//loaderp->serialize(dp);
gAgent.getAvatarObject()->startMotion(item->getAssetUUID());
LLVOAvatar* avatar = gAgent.getAvatarObject();
LLMotion* motion = avatar->findMotion(item->getAssetUUID());
LLKeyframeMotion* tmp = (LLKeyframeMotion*)motion;
S32 file_size = tmp->getFileSize();
U8* buffer = new U8[file_size];
LLDataPackerBinaryBuffer dp(buffer, file_size);*/
LLDataPackerBinaryBuffer dp(self->mAnimBuffer, self->mAnimBufferSize);
LLVOAvatar* avatar = gAgent.getAvatarObject();
LLMotion* motion = avatar->findMotion(item->getAssetUUID());
LLKeyframeMotion* tmp = (LLKeyframeMotion*)motion;
tmp->serialize(dp);
dp.reset();
BOOL success = motionp && motionp->deserialize(dp);
//delete []buffer;
if (success)
{
motionp->setName(item->getName());
gAgent.getAvatarObject()->startMotion(xMotionID);
////////////////////////////////////////////////////////////////////
/*LLKeyframeMotion* */motionp = (LLKeyframeMotion*)gAgent.getAvatarObject()->findMotion(xMotionID);
S32 file_size = motionp->getFileSize();
U8* buffer = new U8[file_size];
LLDataPackerBinaryBuffer dp(buffer, file_size);
if (motionp->serialize(dp))
{
LLVFile file(gVFS, motionp->getID(), LLAssetType::AT_ANIMATION, LLVFile::APPEND);
S32 size = dp.getCurrentSize();
file.setMaxSize(size);
if (file.write((U8*)buffer, size))
{
std::string name = item->getName();
std::string desc = item->getDescription();
upload_new_resource(xTransactionID, // tid
LLAssetType::AT_ANIMATION,
name,
desc,
0,
LLAssetType::AT_NONE,
LLInventoryType::IT_ANIMATION,
PERM_NONE,PERM_NONE,PERM_NONE,
name,0,10,0);
}
else
{
llwarns << "Failure writing animation data." << llendl;
LLNotifications::instance().add("WriteAnimationFail");
}
}
delete [] buffer;
// clear out cache for motion data
gAgent.getAvatarObject()->removeMotion(xMotionID);
LLKeyframeDataCache::removeKeyframeData(xMotionID);
////////////////////////////////////////////////////////////////////
//.........这里部分代码省略.........