//----------------------------------------------------------------------------- // onCommitHandPose() //----------------------------------------------------------------------------- void LLFloaterAnimPreview::onCommitHandPose() { if (!getEnabled()) return; resetMotion(); // sets hand pose }
//----------------------------------------------------------------------------- // onCommitEmote() //----------------------------------------------------------------------------- void LLFloaterAnimPreview::onCommitEmote() { if (!getEnabled()) return; resetMotion(); // ssts emote }
//----------------------------------------------------------------------------- // onCommitBaseAnim() //----------------------------------------------------------------------------- void LLFloaterAnimPreview::onCommitBaseAnim() { if (!getEnabled()) return; if (mAnimPreview) { LLVOAvatar* avatarp = mAnimPreview->getPreviewAvatar(); BOOL paused = avatarp->areAnimationsPaused(); // stop all other possible base motions avatarp->stopMotion(mIDList["Standing"], TRUE); avatarp->stopMotion(mIDList["Walking"], TRUE); avatarp->stopMotion(mIDList["Sitting"], TRUE); avatarp->stopMotion(mIDList["Flying"], TRUE); resetMotion(); if (!paused) { mPauseRequest = NULL; } } }
Alien::Alien(wsp::Image *img) { SetImage(img); DefineCollisionRectangle(28, 14, 42, 55); resetMotion(); resetPosition(); resetShotCountdown(); }
void Foam::polyMesh::clearPrimitives() { resetMotion(); points_.setSize(0); faces_.setSize(0); owner_.setSize(0); neighbour_.setSize(0); clearedPrimitives_ = true; }
//----------------------------------------------------------------------------- // onCommitEaseOut() //----------------------------------------------------------------------------- void LLFloaterAnimPreview::onCommitEaseOut() { if (!getEnabled()) return; LLVOAvatar* avatarp = mAnimPreview->getPreviewAvatar(); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID); motionp->setEaseOut((F32)getChild<LLUICtrl>("ease_out_time")->getValue().asReal()); resetMotion(); }
//----------------------------------------------------------------------------- // onBtnStop() //----------------------------------------------------------------------------- void LLFloaterAnimPreview::onBtnStop() { if (!getEnabled()) return; if (mMotionID.notNull() && mAnimPreview) { LLVOAvatar* avatarp = mAnimPreview->getPreviewAvatar(); resetMotion(); mPauseRequest = avatarp->requestPause(); } }
//----------------------------------------------------------------------------- // unloadMotion() //----------------------------------------------------------------------------- void LLFloaterAnimPreview::unloadMotion() { if (mMotionID.notNull() && mAnimPreview && !sUseDummy) { resetMotion(); mAnimPreview->getPreviewAvatar()->removeMotion(mMotionID); LLKeyframeDataCache::removeKeyframeData(mMotionID); } mMotionID.setNull(); mAnimPreview = NULL; }
void Alien::update() { Move(motionX, motionY); if(GetY() < 0) { SetY(0); resetMotion(); } else if(GetY() > 480-GetHeight()) { SetY(480-GetHeight()); resetMotion(); } int i; for(i=0;i<numEnemyShots;i++) { if(enemyShots[i]->isFired() == false) continue; if(CollidesWith(enemyShots[i])) { enemyShots[i]->remove(); resetPosition(); resetMotion(); resetShotCountdown(); score++; break; } } if(--lockMotionFrames == 0) resetMotion(); if(GetX() < 0) resetPosition(); if(--nextShotCountdown == 0) { resetShotCountdown(); for(i=0;i<numOwnShots;i++) { if(ownShots[i]->isFired() == false) { ownShots[i]->fire(GetX(), GetY() + (GetHeight() / 2) - 10, -6); break; } } } }
//----------------------------------------------------------------------------- // onCommitLoopOut() //----------------------------------------------------------------------------- void LLFloaterAnimPreview::onCommitLoopOut() { if (!getEnabled()) return; LLVOAvatar* avatarp = mAnimPreview->getPreviewAvatar(); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID); if (motionp) { motionp->setLoopOut((F32)getChild<LLUICtrl>("loop_out_point")->getValue().asReal() * 0.01f * motionp->getDuration()); resetMotion(); getChild<LLUICtrl>("loop_check")->setValue(LLSD(TRUE)); onCommitLoop(); } }
//----------------------------------------------------------------------------- // onBtnPlay() //----------------------------------------------------------------------------- void LLFloaterAnimPreview::onBtnPlay() { if (!getEnabled()) return; if (mMotionID.notNull() && mAnimPreview) { LLVOAvatar* avatarp = mAnimPreview->getPreviewAvatar(); if (!avatarp->isMotionActive(mMotionID)) { resetMotion(); mPauseRequest = NULL; } else if (avatarp->areAnimationsPaused()) { mPauseRequest = NULL; } } }
bool Foam::twoStrokeEngine::update() { // Detaching the interface if (attached()) { Info << "Decoupling sliding interfaces" << endl; makeSlidersLive(); // Changing topology by hand autoPtr<mapPolyMesh> topoChangeMap5 = topoChanger_.changeMesh(); if (topoChangeMap5->hasMotionPoints() && topoChangeMap5->morphing()) { Info << "Topology change; executing pre-motion after " << "sliding detach" << endl; movePoints(topoChangeMap5->preMotionPoints()); } Info << "sliding interfaces successfully decoupled!!!" << endl; } else { Info << "Sliding interfaces decoupled" << endl; } Info << "Executing layer action" << endl; // Piston Layering makeLayersLive(); // Changing topology by hand // /* Tommaso, 23/5/2008 // Find piston mesh modifier const label pistonLayerID = topoChanger_.findModifierID("pistonLayer"); if (pistonLayerID < 0) { FatalErrorIn("void engineFvMesh::moveAndMorph()") << "Piston modifier not found." << abort(FatalError); } scalar minLayerThickness = piston().minLayer(); scalar deltaZ = engTime().pistonDisplacement().value(); virtualPistonPosition() += deltaZ; Info << "virtualPistonPosition = " << virtualPistonPosition() << ", deckHeight = " << deckHeight() << ", pistonPosition = " << pistonPosition() << endl; if (realDeformation()) { // Dectivate piston layer Info << "Mesh deformation mode" << endl; topoChanger_[pistonLayerID].disable(); } else { // Activate piston layer Info << "Piston layering mode" << endl; topoChanger_[pistonLayerID].enable(); } // Changing topology by hand autoPtr<mapPolyMesh> topoChangeMap = topoChanger_.changeMesh(); // Work array for new points position. pointField newPoints = allPoints(); const pointField& refPoints = allPoints(); if (topoChangeMap->morphing()) { if (topoChangeMap->hasMotionPoints()) { Info<< "Topology change; executing pre-motion after " << "dynamic layering" << endl; movePoints(topoChangeMap->preMotionPoints()); newPoints = topoChangeMap->preMotionPoints(); } setV0(); resetMotion(); } // Reset the position of layered interfaces boolList scaleDisp(nPoints(), true); boolList pistonPoint(newPoints.size(), false); boolList headPoint(newPoints.size(), false); // Make a list of piston and head points. HJ, 2/Dec/2009 labelList pistonPoints; labelList headPoints; { label pistonCellIndex = cellZones().findZoneID("pistonCells"); if (pistonCellIndex < 0) { FatalErrorIn("bool twoStrokeEngine::update()") << "Cannot find cell zone pistonCells" << abort(FatalError); } const labelList& pistonCells = cellZones()[pistonCellIndex]; label headCellIndex = cellZones().findZoneID("headCells"); if (headCellIndex < 0) { FatalErrorIn("bool twoStrokeEngine::update()") << "Cannot find cell zone headCells" << abort(FatalError); } const labelList& headCells = cellZones()[headCellIndex]; const labelListList& cp = cellPoints(); boolList count(newPoints.size(), false); forAll (pistonCells, cellI) { const labelList& curCellPoints = cp[pistonCells[cellI]]; forAll (curCellPoints, i) { count[curCellPoints[i]] = true; } } // Count the points label nCounted = 0; forAll (count, pointI) { if (count[pointI] == true) { nCounted++; } } pistonPoints.setSize(nCounted); // Collect the points nCounted = 0; forAll (count, pointI) { if (count[pointI] == true) { pistonPoints[nCounted] = pointI; nCounted++; } } // Repeat for head points count = false; forAll (headCells, cellI) { const labelList& curCellPoints = cp[pistonCells[cellI]]; forAll (curCellPoints, i) { count[curCellPoints[i]] = true; } } // Count the points nCounted = 0; forAll (count, pointI) { if (count[pointI] == true) { nCounted++; } } headPoints.setSize(nCounted); // Collect the points nCounted = 0; forAll (count, pointI) { if (count[pointI] == true) { headPoints[nCounted] = pointI; nCounted++; } } } label nScaled = nPoints(); // label pistonPtsIndex = pointZones().findZoneID("pistonPoints"); // const labelList& pistonPoints = pointZones()[pistonPtsIndex]; // label headPtsIndex = pointZones().findZoneID("headPoints"); // const labelList& headPoints = pointZones()[headPtsIndex]; const scalarField& movingPointsM = movingPointsMask(); forAll(pistonPoints, i) { label pointI = pistonPoints[i]; pistonPoint[pointI] = true; point& p = newPoints[pointI]; if (p.z() < pistonPosition() - 1.0e-6) { scaleDisp[pointI] = false; nScaled--; } }
void Foam::layerSmooth::addZonesAndModifiers() { // Add the zones and mesh modifiers to operate piston motion if ( /* pointZones().size() > 0 || faceZones().size() > 0 || cellZones().size() > 0 || topoChanger_.size() > 0 */ pointZones().size() > 0 && faceZones().size() > 0 && topoChanger_.size() > 0 ) { Info<< "Time = " << engTime().theta() << endl; Info<< "void Foam::layerSmooth::addZonesAndModifiers() : " << "Zones and modifiers already present. Skipping." << endl; setVirtualPositions(); checkAndCalculate(); Info << "Point zones found = " << pointZones().size() << endl; Info << "Face zones found = " << faceZones().size() << endl; Info << "Cell zones found = " << cellZones().size() << endl; return; } else { pointZones().setSize(0); faceZones().setSize(0); cellZones().setSize(0); topoChanger_.setSize(0); } if ( engTime().engineDict().found("zOffsetGambit") && engTime().engineDict().found("zDisplGambit") ) { Info << "Assembling the cylinder mesh" << endl; scalar zOffset ( readScalar(engTime().engineDict().lookup("zOffsetGambit")) ); scalar zDispl ( readScalar(engTime().engineDict().lookup("zDisplGambit")) ); const pointField& ap = allPoints(); pointField pDispl = allPoints(); forAll(ap, pointI) { const point p = ap[pointI]; if (p.z() >= zOffset) { pDispl[pointI].z() -= zDispl; } } movePoints(pDispl); write(); resetMotion(); Info << "Cylinder mesh assembled" << endl; }