Пример #1
0
	bool CAnimation::_togglePreviewMode(bool enabled)
	{
		bool isRunning = SceneManager::instance().isRunning();

		if(enabled)
		{
			// Cannot enable preview while running
			if (isRunning)
				return false;

			if(!mPreviewMode)
			{
				// Make sure not to re-enable preview mode if already enabled because it rebuilds the internal Animation
				// component, changing its ID. If animation evaluation is async then the new ID will not have any animation
				// attached for one frame. This can look weird when sampling the animation for preview purposes 
				// (e.g. scrubbing in editor), in which case animation will reset to T pose for a single frame before
				// settling on the chosen frame.
				restoreInternal(true);
				mPreviewMode = true;
			}

			return true;
		}
		else
		{
			if (!isRunning)
				destroyInternal();

			mPreviewMode = false;
			return false;
		}
	}
Пример #2
0
	void CAnimation::onEnabled()
	{
		if(mPreviewMode)
		{
			destroyInternal();
			mPreviewMode = false;
		}
		
		if(SceneManager::instance().isRunning())
			restoreInternal(false);
	}
Пример #3
0
	void CAnimation::restoreInternal(bool previewMode)
	{
		if (mInternal != nullptr)
			destroyInternal();

		mInternal = Animation::create();

		mAnimatedRenderable = SO()->getComponent<CRenderable>();

		if (!previewMode)
		{
			mInternal->onEventTriggered.connect(std::bind(&CAnimation::eventTriggered, this, _1, _2));

			mInternal->setWrapMode(mWrapMode);
			mInternal->setSpeed(mSpeed);
			mInternal->setCulling(mEnableCull);
		}

		_updateBounds();

		if (!previewMode)
		{
			if (mDefaultClip.isLoaded())
				mInternal->play(mDefaultClip);

			mPrimaryPlayingClip = mInternal->getClip(0);
			if (mPrimaryPlayingClip.isLoaded())
			{
				if (_scriptRebuildFloatProperties)
					_scriptRebuildFloatProperties(mPrimaryPlayingClip);
			}
		}

		setBoneMappings();

		if(!previewMode)
			updateSceneObjectMapping();

		if (mAnimatedRenderable != nullptr)
			mAnimatedRenderable->_registerAnimation(static_object_cast<CAnimation>(mThisHandle));
	}
	void CCharacterController::onDisabled()
	{
		destroyInternal();
	}
Пример #5
0
	void CAudioSource::onDisabled()
	{
		destroyInternal();
	}
Пример #6
0
	void CAudioSource::onDestroyed()
	{
		destroyInternal();
	}
Пример #7
0
	void CAnimation::onDestroyed()
	{
		destroyInternal();
	}
Пример #8
0
	void CAnimation::onDisabled()
	{
		destroyInternal();
	}
Пример #9
0
	void CRigidbody::onDisabled()
	{
		destroyInternal();
	}
Пример #10
0
	void CRigidbody::onDestroyed()
	{
		destroyInternal();
	}
	void ScriptHandleSliderBase::destroy()
	{
		ScriptHandleSliderManager::instance().unregisterSlider(this);

		destroyInternal();
	}
Пример #12
0
	void CCollider::onDisabled()
	{
		destroyInternal();
	}
Пример #13
0
	void CCollider::onDestroyed()
	{
		destroyInternal();
	}