Animation::Animation(BVH* newBVH,const QString& bvhFile) : frame(0),totalFrames(0),mirrored(false) { qDebug("Animation::Animation(%px)",this); bvh=newBVH; if(!bvh) { qDebug("Animation::Animation(): BVH initialisation failed."); return; } QString fileName; // pick up path from src.pro qmake file's DEFINES section, i.e. usr/share/qavimator //dataPath=QAVIMATOR_DATAPATH; #ifdef __APPLE__ dataPath=QApplication::applicationDirPath() + "/../Resources"; #else dataPath=QAVIMATOR_DATAPATH; #endif // load BVH that defines motion if (!bvhFile.isEmpty()) fileName=bvhFile; else fileName=dataPath+"/"+DEFAULT_POSE; loadBVH(fileName); calcPartMirrors(); useRotationLimits(true); setNumberOfFrames(bvh->lastLoadedNumberOfFrames); setAvatarScale(bvh->lastLoadedAvatarScale); setFigureType(bvh->lastLoadedFigureType); setLoopInPoint(bvh->lastLoadedLoopIn); setLoopOutPoint(bvh->lastLoadedLoopOut); setFrameTime(bvh->lastLoadedFrameTime); positionNode=bvh->lastLoadedPositionNode; addKeyFrameAllJoints(); ikTree.set(frames); setIK(IK_LHAND, false); setIK(IK_RHAND, false); setIK(IK_LFOOT, false); setIK(IK_RFOOT, false); setLoop(false); setDirty(false); currentPlayTime=0.0; setPlaystate(PLAYSTATE_STOPPED); connect(&timer,SIGNAL(timeout()),this,SLOT(playbackTimeout())); }
//----------------------------------------------------------------------------- // postBuild() //----------------------------------------------------------------------------- BOOL LLFloaterAnimPreview::postBuild() { if (!LLFloaterNameDesc::postBuild()) { return FALSE; } getChild<LLUICtrl>("name_form")->setCommitCallback(boost::bind(&LLFloaterAnimPreview::onCommitName, this)); childSetAction("reload_btn", onBtnReload, this); childSetAction("ok_btn", onBtnOK, this); setDefaultBtn(); if (sUseDummy) { LLRect rect = getRect(); translate(0, PREVIEW_TEXTURE_HEIGHT-30); reshape(rect.getWidth(), rect.getHeight() + PREVIEW_TEXTURE_HEIGHT-30); mPreviewRect.set(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT, getRect().getWidth() - PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD); mPreviewImageRect.set(0.f, 1.f, 1.f, 0.f); } mPlayButton = getChild<LLButton>( "play_btn"); mPlayButton->setClickedCallback(boost::bind(&LLFloaterAnimPreview::onBtnPlay, this)); // mPlayButton->setVisible(true); mPauseButton = getChild<LLButton>( "pause_btn"); mPauseButton->setClickedCallback(boost::bind(&LLFloaterAnimPreview::onBtnPause, this)); // mPauseButton->setVisible(false); mStopButton = getChild<LLButton>( "stop_btn"); mStopButton->setClickedCallback(boost::bind(&LLFloaterAnimPreview::onBtnStop, this)); loadBVH(); return TRUE; }