本文整理汇总了C++中LLVOAvatar::findMotion方法的典型用法代码示例。如果您正苦于以下问题:C++ LLVOAvatar::findMotion方法的具体用法?C++ LLVOAvatar::findMotion怎么用?C++ LLVOAvatar::findMotion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLVOAvatar
的用法示例。
在下文中一共展示了LLVOAvatar::findMotion方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: validateEaseOut
//-----------------------------------------------------------------------------
// validateEaseOut()
//-----------------------------------------------------------------------------
BOOL LLFloaterAnimPreview::validateEaseOut(LLUICtrl* spin, void* data)
{
LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data;
if (!previewp->getEnabled())
return FALSE;
LLVOAvatar* avatarp;
if (previewp->mInWorld)
{
if (!gAgent.getAvatarObject())
{
return FALSE;
}
avatarp = gAgent.getAvatarObject();
}
else
{
if (!previewp->mAnimPreview)
{
return FALSE;
}
avatarp = previewp->mAnimPreview->getDummyAvatar();
}
LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID);
if (!motionp->getLoop())
{
F32 new_ease_out = llclamp((F32)previewp->childGetValue("ease_out_time").asReal(), 0.f, motionp->getDuration() - motionp->getEaseInDuration());
previewp->childSetValue("ease_out_time", LLSD(new_ease_out));
}
return TRUE;
}
示例2: 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);
}
}
}
示例3: onCommitName
//-----------------------------------------------------------------------------
// onCommitName()
//-----------------------------------------------------------------------------
void LLFloaterAnimPreview::onCommitName(LLUICtrl* ctrl, void* data)
{
LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data;
if (!previewp->getEnabled())
return;
LLVOAvatar* avatarp;
if (previewp->mInWorld)
{
if (!gAgent.getAvatarObject())
{
return;
}
avatarp = gAgent.getAvatarObject();
}
else
{
if (!previewp->mAnimPreview)
{
return;
}
avatarp = previewp->mAnimPreview->getDummyAvatar();
}
LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID);
if (motionp)
{
motionp->setName(previewp->childGetValue("name_form").asString());
}
LLFloaterNameDesc::doCommit(ctrl, data);
}
示例4: onCommitEaseOut
//-----------------------------------------------------------------------------
// onCommitEaseOut()
//-----------------------------------------------------------------------------
void LLFloaterAnimPreview::onCommitEaseOut(LLUICtrl* ctrl, void* data)
{
LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data;
if (!previewp->getEnabled())
return;
LLVOAvatar* avatarp;
if (previewp->mInWorld)
{
if (!gAgent.getAvatarObject())
{
return;
}
avatarp = gAgent.getAvatarObject();
}
else
{
if (!previewp->mAnimPreview)
{
return;
}
avatarp = previewp->mAnimPreview->getDummyAvatar();
}
LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID);
motionp->setEaseOut((F32)previewp->childGetValue("ease_out_time").asReal());
previewp->resetMotion();
}
示例5: onSliderMove
//-----------------------------------------------------------------------------
// onSliderMove()
//-----------------------------------------------------------------------------
void LLFloaterAnimPreview::onSliderMove(LLUICtrl* ctrl, void*user_data)
{
LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)user_data;
if (!previewp->getEnabled())
return;
LLVOAvatar* avatarp;
if (previewp->mInWorld)
{
if (!gAgent.getAvatarObject())
{
return;
}
avatarp = gAgent.getAvatarObject();
}
else
{
if (!previewp->mAnimPreview)
{
return;
}
avatarp = previewp->mAnimPreview->getDummyAvatar();
}
F32 slider_value = (F32)previewp->childGetValue("playback_slider").asReal();
LLUUID base_id = previewp->mIDList[previewp->childGetValue("preview_base_anim").asString()];
LLMotion* motionp = avatarp->findMotion(previewp->mMotionID);
F32 duration = motionp->getDuration();// + motionp->getEaseOutDuration();
F32 delta_time = duration * slider_value;
avatarp->deactivateAllMotions();
avatarp->startMotion(base_id, delta_time + BASE_ANIM_TIME_OFFSET);
avatarp->startMotion(previewp->mMotionID, delta_time);
previewp->mPauseRequest = avatarp->requestPause();
previewp->refresh();
}
示例6: onCommitLoopOut
//-----------------------------------------------------------------------------
// onCommitLoopOut()
//-----------------------------------------------------------------------------
void LLFloaterAnimPreview::onCommitLoopOut(LLUICtrl* ctrl, void* data)
{
LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data;
if (!previewp->getEnabled())
return;
LLVOAvatar* avatarp;
if (previewp->mInWorld)
{
if (!gAgent.getAvatarObject())
{
return;
}
avatarp = gAgent.getAvatarObject();
}
else
{
if (!previewp->mAnimPreview)
{
return;
}
avatarp = previewp->mAnimPreview->getDummyAvatar();
}
LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID);
if (motionp)
{
motionp->setLoopOut((F32)previewp->childGetValue("loop_out_point").asReal() * 0.01f * motionp->getDuration());
previewp->resetMotion();
previewp->childSetValue("loop_check", LLSD(TRUE));
onCommitLoop(ctrl, data);
}
}
示例7: onCommitPriority
//-----------------------------------------------------------------------------
// onCommitPriority()
//-----------------------------------------------------------------------------
void LLFloaterAnimPreview::onCommitPriority(LLUICtrl* ctrl, void* data)
{
LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data;
if (!previewp->getEnabled())
return;
LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar();
LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID);
motionp->setPriority(llfloor((F32)previewp->childGetValue("priority").asReal()));
}
示例8: onCommitEaseIn
//-----------------------------------------------------------------------------
// onCommitEaseIn()
//-----------------------------------------------------------------------------
void LLFloaterAnimPreview::onCommitEaseIn(LLUICtrl* ctrl, void* data)
{
LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data;
if (!previewp->getEnabled())
return;
LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar();
LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID);
motionp->setEaseIn((F32)previewp->childGetValue("ease_in_time").asReal());
previewp->resetMotion();
}
示例9: refresh
//-----------------------------------------------------------------------------
// refresh()
//-----------------------------------------------------------------------------
void LLFloaterAnimPreview::refresh()
{
if (!mAnimPreview)
{
childShow("bad_animation_text");
mPlayButton->setEnabled(FALSE);
mStopButton->setEnabled(FALSE);
childDisable("ok_btn");
}
else
{
childHide("bad_animation_text");
mPlayButton->setEnabled(TRUE);
LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
if (avatarp->isMotionActive(mMotionID))
{
mStopButton->setEnabled(TRUE);
LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID);
if (avatarp->areAnimationsPaused())
{
mPlayButton->setImages(std::string("button_anim_play.tga"),
std::string("button_anim_play_selected.tga"));
}
else
{
if (motionp)
{
F32 fraction_complete = motionp->getLastUpdateTime() / motionp->getDuration();
childSetValue("playback_slider", fraction_complete);
}
mPlayButton->setImages(std::string("button_anim_pause.tga"),
std::string("button_anim_pause_selected.tga"));
}
}
else
{
mPauseRequest = avatarp->requestPause();
mPlayButton->setImages(std::string("button_anim_play.tga"),
std::string("button_anim_play_selected.tga"));
mStopButton->setEnabled(TRUE); // stop also resets, leave enabled.
}
childEnable("ok_btn");
mAnimPreview->requestUpdate();
}
}
示例10: onCommitLoop
//-----------------------------------------------------------------------------
// onCommitLoop()
//-----------------------------------------------------------------------------
void LLFloaterAnimPreview::onCommitLoop(LLUICtrl* ctrl, void* data)
{
LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data;
if (!previewp->getEnabled())
return;
LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar();
LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID);
if (motionp)
{
motionp->setLoop(previewp->childGetValue("loop_check").asBoolean());
motionp->setLoopIn((F32)previewp->childGetValue("loop_in_point").asReal() * 0.01f * motionp->getDuration());
motionp->setLoopOut((F32)previewp->childGetValue("loop_out_point").asReal() * 0.01f * motionp->getDuration());
}
}
示例11: validateEaseIn
//-----------------------------------------------------------------------------
// validateEaseIn()
//-----------------------------------------------------------------------------
BOOL LLFloaterAnimPreview::validateEaseIn(LLUICtrl* spin, void* data)
{
LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data;
if (!previewp->getEnabled())
return FALSE;
LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar();
LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID);
if (!motionp->getLoop())
{
F32 new_ease_in = llclamp((F32)previewp->childGetValue("ease_in_time").asReal(), 0.f, motionp->getDuration() - motionp->getEaseOutDuration());
previewp->childSetValue("ease_in_time", LLSD(new_ease_in));
}
return TRUE;
}
示例12: onCommitLoopIn
//-----------------------------------------------------------------------------
// onCommitLoopIn()
//-----------------------------------------------------------------------------
void LLFloaterAnimPreview::onCommitLoopIn(LLUICtrl* ctrl, void* data)
{
LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data;
if (!previewp->getEnabled())
return;
LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar();
LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID);
if (motionp)
{
motionp->setLoopIn((F32)previewp->childGetValue("loop_in_point").asReal() / 100.f);
previewp->resetMotion();
previewp->childSetValue("loop_check", LLSD(TRUE));
onCommitLoop(ctrl, data);
}
}
示例13: resetMotion
//-----------------------------------------------------------------------------
// resetMotion()
//-----------------------------------------------------------------------------
void LLFloaterAnimPreview::resetMotion()
{
LLVOAvatar* avatarp;
if (mInWorld)
{
avatarp = gAgent.getAvatarObject();
}
else
{
avatarp = mAnimPreview->getDummyAvatar();
}
if (!avatarp)
{
return;
}
BOOL paused = avatarp->areAnimationsPaused();
// *TODO: Fix awful casting hack
LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID);
// Set emotion
std::string emote = childGetValue("emote_combo").asString();
motionp->setEmote(mIDList[emote]);
LLUUID base_id = mIDList[childGetValue("preview_base_anim").asString()];
avatarp->deactivateAllMotions();
avatarp->startMotion(base_id, BASE_ANIM_TIME_OFFSET);
avatarp->startMotion(mMotionID, 0.0f);
childSetValue("playback_slider", 0.0f);
// Set pose
std::string handpose = childGetValue("hand_pose_combo").asString();
avatarp->startMotion( ANIM_AGENT_HAND_MOTION, 0.0f );
motionp->setHandPose(LLHandMotion::getHandPose(handpose));
if (paused)
{
mPauseRequest = avatarp->requestPause();
}
else
{
mPauseRequest = NULL;
}
}
示例14: 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);
}
}
}
示例15: 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);
////////////////////////////////////////////////////////////////////
//.........这里部分代码省略.........