|
|
@@ -27,18 +27,18 @@
|
|
|
#include "../Resource/ResourceCache.h"
|
|
|
#include "../Scene/Scene.h"
|
|
|
#include "../Scene/SceneEvents.h"
|
|
|
-#include "../Urho2D/AnimatedSprite2D.h"
|
|
|
-#include "../Urho2D/AnimationSet2D.h"
|
|
|
-#include "../Urho2D/Sprite2D.h"
|
|
|
-#include "../Urho2D/SpriterInstance2D.h"
|
|
|
+#include "../Atomic2D/AnimatedSprite2D.h"
|
|
|
+#include "../Atomic2D/AnimationSet2D.h"
|
|
|
+#include "../Atomic2D/Sprite2D.h"
|
|
|
+#include "../Atomic2D/SpriterInstance2D.h"
|
|
|
|
|
|
#include "../DebugNew.h"
|
|
|
|
|
|
-#ifdef URHO3D_SPINE
|
|
|
+#ifdef ATOMIC_SPINE
|
|
|
#include <spine/spine.h>
|
|
|
#endif
|
|
|
|
|
|
-namespace Urho3D
|
|
|
+namespace Atomic
|
|
|
{
|
|
|
|
|
|
extern const char* URHO2D_CATEGORY;
|
|
|
@@ -54,7 +54,7 @@ const char* loopModeNames[] =
|
|
|
|
|
|
AnimatedSprite2D::AnimatedSprite2D(Context* context) :
|
|
|
StaticSprite2D(context),
|
|
|
-#ifdef URHO3D_SPINE
|
|
|
+#ifdef ATOMIC_SPINE
|
|
|
skeleton_(0),
|
|
|
animationStateData_(0),
|
|
|
animationState_(0),
|
|
|
@@ -74,14 +74,14 @@ void AnimatedSprite2D::RegisterObject(Context* context)
|
|
|
{
|
|
|
context->RegisterFactory<AnimatedSprite2D>(URHO2D_CATEGORY);
|
|
|
|
|
|
- URHO3D_COPY_BASE_ATTRIBUTES(StaticSprite2D);
|
|
|
- URHO3D_REMOVE_ATTRIBUTE("Sprite");
|
|
|
- URHO3D_ACCESSOR_ATTRIBUTE("Speed", GetSpeed, SetSpeed, float, 1.0f, AM_DEFAULT);
|
|
|
- URHO3D_ACCESSOR_ATTRIBUTE("Entity", GetEntity, SetEntity, String, String::EMPTY, AM_DEFAULT);
|
|
|
- URHO3D_MIXED_ACCESSOR_ATTRIBUTE("Animation Set", GetAnimationSetAttr, SetAnimationSetAttr, ResourceRef,
|
|
|
+ ATOMIC_COPY_BASE_ATTRIBUTES(StaticSprite2D);
|
|
|
+ ATOMIC_REMOVE_ATTRIBUTE("Sprite");
|
|
|
+ ATOMIC_ACCESSOR_ATTRIBUTE("Speed", GetSpeed, SetSpeed, float, 1.0f, AM_DEFAULT);
|
|
|
+ ATOMIC_ACCESSOR_ATTRIBUTE("Entity", GetEntity, SetEntity, String, String::EMPTY, AM_DEFAULT);
|
|
|
+ ATOMIC_MIXED_ACCESSOR_ATTRIBUTE("Animation Set", GetAnimationSetAttr, SetAnimationSetAttr, ResourceRef,
|
|
|
ResourceRef(AnimatedSprite2D::GetTypeStatic()), AM_DEFAULT);
|
|
|
- URHO3D_ACCESSOR_ATTRIBUTE("Animation", GetAnimation, SetAnimationAttr, String, String::EMPTY, AM_DEFAULT);
|
|
|
- URHO3D_ENUM_ACCESSOR_ATTRIBUTE("Loop Mode", GetLoopMode, SetLoopMode, LoopMode2D, loopModeNames, LM_DEFAULT, AM_DEFAULT);
|
|
|
+ ATOMIC_ACCESSOR_ATTRIBUTE("Animation", GetAnimation, SetAnimationAttr, String, String::EMPTY, AM_DEFAULT);
|
|
|
+ ATOMIC_ENUM_ACCESSOR_ATTRIBUTE("Loop Mode", GetLoopMode, SetLoopMode, LoopMode2D, loopModeNames, LM_DEFAULT, AM_DEFAULT);
|
|
|
}
|
|
|
|
|
|
void AnimatedSprite2D::OnSetEnabled()
|
|
|
@@ -94,7 +94,7 @@ void AnimatedSprite2D::OnSetEnabled()
|
|
|
if (scene)
|
|
|
{
|
|
|
if (enabled)
|
|
|
- SubscribeToEvent(scene, E_SCENEPOSTUPDATE, URHO3D_HANDLER(AnimatedSprite2D, HandleScenePostUpdate));
|
|
|
+ SubscribeToEvent(scene, E_SCENEPOSTUPDATE, ATOMIC_HANDLER(AnimatedSprite2D, HandleScenePostUpdate));
|
|
|
else
|
|
|
UnsubscribeFromEvent(scene, E_SCENEPOSTUPDATE);
|
|
|
}
|
|
|
@@ -113,7 +113,7 @@ void AnimatedSprite2D::SetAnimationSet(AnimationSet2D* animationSet)
|
|
|
|
|
|
SetSprite(animationSet_->GetSprite());
|
|
|
|
|
|
-#ifdef URHO3D_SPINE
|
|
|
+#ifdef ATOMIC_SPINE
|
|
|
if (animationSet_->GetSkeletonData())
|
|
|
{
|
|
|
spSkeletonData* skeletonData = animationSet->GetSkeletonData();
|
|
|
@@ -159,7 +159,7 @@ void AnimatedSprite2D::SetEntity(const String& entity)
|
|
|
|
|
|
entity_ = entity;
|
|
|
|
|
|
-#ifdef URHO3D_SPINE
|
|
|
+#ifdef ATOMIC_SPINE
|
|
|
if (skeleton_)
|
|
|
spSkeleton_setSkinByName(skeleton_, entity_.CString());
|
|
|
#endif
|
|
|
@@ -175,7 +175,7 @@ void AnimatedSprite2D::SetAnimation(const String& name, LoopMode2D loopMode)
|
|
|
if (!animationSet_ || !animationSet_->HasAnimation(animationName_))
|
|
|
return;
|
|
|
|
|
|
-#ifdef URHO3D_SPINE
|
|
|
+#ifdef ATOMIC_SPINE
|
|
|
if (skeleton_)
|
|
|
SetSpineAnimation();
|
|
|
#endif
|
|
|
@@ -217,9 +217,9 @@ void AnimatedSprite2D::OnSceneSet(Scene* scene)
|
|
|
if (scene)
|
|
|
{
|
|
|
if (scene == node_)
|
|
|
- URHO3D_LOGWARNING(GetTypeName() + " should not be created to the root scene node");
|
|
|
+ ATOMIC_LOGWARNING(GetTypeName() + " should not be created to the root scene node");
|
|
|
if (IsEnabledEffective())
|
|
|
- SubscribeToEvent(scene, E_SCENEPOSTUPDATE, URHO3D_HANDLER(AnimatedSprite2D, HandleScenePostUpdate));
|
|
|
+ SubscribeToEvent(scene, E_SCENEPOSTUPDATE, ATOMIC_HANDLER(AnimatedSprite2D, HandleScenePostUpdate));
|
|
|
}
|
|
|
else
|
|
|
UnsubscribeFromEvent(E_SCENEPOSTUPDATE);
|
|
|
@@ -233,7 +233,7 @@ void AnimatedSprite2D::SetAnimationAttr(const String& name)
|
|
|
|
|
|
void AnimatedSprite2D::UpdateSourceBatches()
|
|
|
{
|
|
|
-#ifdef URHO3D_SPINE
|
|
|
+#ifdef ATOMIC_SPINE
|
|
|
if (skeleton_ && animationState_)
|
|
|
UpdateSourceBatchesSpine();
|
|
|
#endif
|
|
|
@@ -252,7 +252,7 @@ void AnimatedSprite2D::HandleScenePostUpdate(StringHash eventType, VariantMap& e
|
|
|
|
|
|
void AnimatedSprite2D::UpdateAnimation(float timeStep)
|
|
|
{
|
|
|
-#ifdef URHO3D_SPINE
|
|
|
+#ifdef ATOMIC_SPINE
|
|
|
if (skeleton_ && animationState_)
|
|
|
UpdateSpineAnimation(timeStep);
|
|
|
#endif
|
|
|
@@ -260,7 +260,7 @@ void AnimatedSprite2D::UpdateAnimation(float timeStep)
|
|
|
UpdateSpriterAnimation(timeStep);
|
|
|
}
|
|
|
|
|
|
-#ifdef URHO3D_SPINE
|
|
|
+#ifdef ATOMIC_SPINE
|
|
|
void AnimatedSprite2D::SetSpineAnimation()
|
|
|
{
|
|
|
if (!animationStateData_)
|
|
|
@@ -268,7 +268,7 @@ void AnimatedSprite2D::SetSpineAnimation()
|
|
|
animationStateData_ = spAnimationStateData_create(animationSet_->GetSkeletonData());
|
|
|
if (!animationStateData_)
|
|
|
{
|
|
|
- URHO3D_LOGERROR("Create animation state data failed");
|
|
|
+ ATOMIC_LOGERROR("Create animation state data failed");
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
@@ -278,7 +278,7 @@ void AnimatedSprite2D::SetSpineAnimation()
|
|
|
animationState_ = spAnimationState_create(animationStateData_);
|
|
|
if (!animationState_)
|
|
|
{
|
|
|
- URHO3D_LOGERROR("Create animation state failed");
|
|
|
+ ATOMIC_LOGERROR("Create animation state failed");
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
@@ -414,13 +414,13 @@ void AnimatedSprite2D::SetSpriterAnimation()
|
|
|
|
|
|
if (!spriterInstance_->SetEntity(entity_.CString()))
|
|
|
{
|
|
|
- URHO3D_LOGERROR("Set entity failed");
|
|
|
+ ATOMIC_LOGERROR("Set entity failed");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (!spriterInstance_->SetAnimation(animationName_.CString(), (Spriter::LoopMode)loopMode_))
|
|
|
{
|
|
|
- URHO3D_LOGERROR("Set animation failed");
|
|
|
+ ATOMIC_LOGERROR("Set animation failed");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -508,7 +508,7 @@ void AnimatedSprite2D::UpdateSourceBatchesSpriter()
|
|
|
|
|
|
void AnimatedSprite2D::Dispose()
|
|
|
{
|
|
|
-#ifdef URHO3D_SPINE
|
|
|
+#ifdef ATOMIC_SPINE
|
|
|
if (animationState_)
|
|
|
{
|
|
|
spAnimationState_dispose(animationState_);
|