| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
- //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
- #pragma once
- #include "BsCorePrerequisites.h"
- #include "Scene/BsComponent.h"
- namespace bs
- {
- /** @addtogroup Components
- * @{
- */
- /**
- * Component that maps animation for specific bone also be applied to the SceneObject this component is attached to.
- * The component will attach to the first found parent Animation component.
- */
- class BS_CORE_EXPORT BS_SCRIPT_EXPORT(m:Animation,n:Bone) CBone : public Component
- {
- public:
- CBone(const HSceneObject& parent);
- virtual ~CBone() {}
-
- /** Determines the name of the bone the component is referencing. */
- BS_SCRIPT_EXPORT(n:Name,pr:setter)
- void setBoneName(const String& name);
- /** @copydoc setBoneName */
- BS_SCRIPT_EXPORT(n:Name,pr:getter)
- const String& getBoneName() const { return mBoneName; }
- /** @name Internal
- * @{
- */
- /**
- * Changes the parent animation of this component.
- *
- * @param[in] animation New animation parent, can be null.
- * @param[in] isInternal If true the bone will just be changed internally, but parent animation will not be
- * notified.
- */
- void _setParent(const HAnimation& animation, bool isInternal = false);
- /** @} */
- private:
- /** Attempts to find the parent Animation component and registers itself with it. */
- void updateParentAnimation();
- /************************************************************************/
- /* COMPONENT OVERRIDES */
- /************************************************************************/
- protected:
- friend class SceneObject;
- /** @copydoc Component::onDestroyed() */
- void onDestroyed() override;
- /** @copydoc Component::onDisabled() */
- void onDisabled() override;
- /** @copydoc Component::onEnabled() */
- void onEnabled() override;
- /** @copydoc Component::onTransformChanged() */
- void onTransformChanged(TransformChangedFlags flags) override;
- protected:
- using Component::destroyInternal;
- String mBoneName;
- HAnimation mParent;
- /************************************************************************/
- /* RTTI */
- /************************************************************************/
- public:
- friend class CBoneRTTI;
- static RTTITypeBase* getRTTIStatic();
- RTTITypeBase* getRTTI() const override;
- protected:
- CBone(); // Serialization only
- };
- /** @} */
- }
|