本文整理汇总了C++中LLKeyframeMotion::getDuration方法的典型用法代码示例。如果您正苦于以下问题:C++ LLKeyframeMotion::getDuration方法的具体用法?C++ LLKeyframeMotion::getDuration怎么用?C++ LLKeyframeMotion::getDuration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLKeyframeMotion
的用法示例。
在下文中一共展示了LLKeyframeMotion::getDuration方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
}
示例2: validateEaseOut
//-----------------------------------------------------------------------------
// validateEaseOut()
//-----------------------------------------------------------------------------
BOOL LLFloaterAnimPreview::validateEaseOut(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_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;
}
示例3: onCommitLoopOut
//-----------------------------------------------------------------------------
// onCommitLoopOut()
//-----------------------------------------------------------------------------
void LLFloaterAnimPreview::onCommitLoopOut(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->setLoopOut((F32)previewp->childGetValue("loop_out_point").asReal() * 0.01f * motionp->getDuration());
previewp->resetMotion();
previewp->childSetValue("loop_check", LLSD(TRUE));
onCommitLoop(ctrl, data);
}
}
示例4: postBuild
//.........这里部分代码省略.........
std::string exten = gDirUtilp->getExtension(mFilename);
if (exten == "bvh")
{
// loading a bvh file
// now load bvh file
S32 file_size;
LLAPRFile infile ;
infile.open(mFilenameAndPath, LL_APR_RB, LLAPRFile::global, &file_size);
if (!infile.getFileHandle())
{
llwarns << "Can't open BVH file:" << mFilename << llendl;
}
else
{
char* file_buffer;
file_buffer = new char[file_size + 1];
if (file_size == infile.read(file_buffer, file_size))
{
file_buffer[file_size] = '\0';
llinfos << "Loading BVH file " << mFilename << llendl;
loaderp = new LLBVHLoader(file_buffer);
}
infile.close() ;
delete[] file_buffer;
}
}
if (loaderp && loaderp->isInitialized() && loaderp->getDuration() <= MAX_ANIM_DURATION)
{
// generate unique id for this motion
mTransactionID.generate();
mMotionID = mTransactionID.makeAssetID(gAgent.getSecureSessionID());
mAnimPreview = new LLPreviewAnimation(256, 256);
// motion will be returned, but it will be in a load-pending state, as this is a new motion
// this motion will not request an asset transfer until next update, so we have a chance to
// load the keyframe data locally
motionp = (LLKeyframeMotion*)mAnimPreview->getDummyAvatar()->createMotion(mMotionID);
// create data buffer for keyframe initialization
S32 buffer_size = loaderp->getOutputSize();
U8* buffer = new U8[buffer_size];
LLDataPackerBinaryBuffer dp(buffer, buffer_size);
// pass animation data through memory buffer
loaderp->serialize(dp);
dp.reset();
BOOL success = motionp && motionp->deserialize(dp);
delete []buffer;
if (success)
{
setAnimCallbacks() ;
const LLBBoxLocal &pelvis_bbox = motionp->getPelvisBBox();
LLVector3 temp = pelvis_bbox.getCenter();
示例5: onCommitLoop
//-----------------------------------------------------------------------------
// onCommitLoop()
//-----------------------------------------------------------------------------
void LLFloaterAnimPreview::onCommitLoop(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->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());
}
}
示例6: validateEaseIn
//-----------------------------------------------------------------------------
// validateEaseIn()
//-----------------------------------------------------------------------------
BOOL LLFloaterAnimPreview::validateEaseIn(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_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;
}