<commit_before>#include "stage/entity/FsSprite2D.h"
#include "stage/entity/FsSprite2DData.h"
#include "graphics/FsTexture2D.h"
#include "support/util/FsArray.h"
#include "support/util/FsDict.h"
#include "support/util/FsInteger.h"
#include "FsGlobal.h"
#include "mgr/FsProgramMgr.h"


NS_FS_BEGIN

class AnimationCacheData: public FsObject 
{
	public:
		static AnimationCacheData* create(Sprite2DAnimation* anim)
		{
			AnimationCacheData* ret=new AnimationCacheData();
			ret->init(anim);
			return ret;
		}

	protected:
		AnimationCacheData()
		{
			m_fps=0;
			m_offsetx=0;
			m_offsety=0;
		}
		bool init(Sprite2DAnimation* anim)
		{
			m_fps=anim->getFps();
			return true;
		}

	public:
		const char* className() 
		{
			return "AnimationCacheData";
		}

	public:
		int m_fps;
		float m_offsetx,m_offsety;
};

Sprite2D* Sprite2D::create(const char* name)
{

	Sprite2D* ret=new Sprite2D;
	if(!ret->init(name))
	{
		FS_TRACE_WARN("init Sprite Data Failed");
		delete ret;
		ret=NULL;
	}

	return ret;
}


Sprite2D* Sprite2D::create()
{
	Sprite2D* ret=new Sprite2D;
	if(!ret->init())
	{
		delete ret;
		ret=NULL;
	}
	return ret;
}


void Sprite2D::setAnimation(const char*  name)
{

	Sprite2DAnimation* anim=m_data->getAnimation(name);
	setAnimation(anim);
}
const char* Sprite2D::getAnimation()
{
	if(m_curAnimation)
	{
		return NULL;
	}

	FsString* name=m_curAnimation->getName();
	return name->cstr();
}

bool Sprite2D::hasAnimation(const char* name)
{
	Sprite2DAnimation* anim=m_data->getAnimation(name);
	bool ret=(anim!=NULL);
	return ret;
}

void Sprite2D::updateAnimation(float dt)
{
	if(!m_curAnimation||m_stop)
	{
		return ;
	}<commit_msg>@add debug information for sprite2d setAnimation when animation not found<commit_after>#include "stage/entity/FsSprite2D.h"
#include "stage/entity/FsSprite2DData.h"
#include "graphics/FsTexture2D.h"
#include "support/util/FsArray.h"
#include "support/util/FsDict.h"
#include "support/util/FsInteger.h"
#include "FsGlobal.h"
#include "mgr/FsProgramMgr.h"


NS_FS_BEGIN

class AnimationCacheData: public FsObject 
{
	public:
		static AnimationCacheData* create(Sprite2DAnimation* anim)
		{
			AnimationCacheData* ret=new AnimationCacheData();
			ret->init(anim);
			return ret;
		}

	protected:
		AnimationCacheData()
		{
			m_fps=0;
			m_offsetx=0;
			m_offsety=0;
		}
		bool init(Sprite2DAnimation* anim)
		{
			m_fps=anim->getFps();
			return true;
		}

	public:
		const char* className() 
		{
			return "AnimationCacheData";
		}

	public:
		int m_fps;
		float m_offsetx,m_offsety;
};

Sprite2D* Sprite2D::create(const char* name)
{

	Sprite2D* ret=new Sprite2D;
	if(!ret->init(name))
	{
		FS_TRACE_WARN("init Sprite Data Failed");
		delete ret;
		ret=NULL;
	}

	return ret;
}


Sprite2D* Sprite2D::create()
{
	Sprite2D* ret=new Sprite2D;
	if(!ret->init())
	{
		delete ret;
		ret=NULL;
	}
	return ret;
}


void Sprite2D::setAnimation(const char*  name)
{

	Sprite2DAnimation* anim=m_data->getAnimation(name);
	FS_TRACE_WARN_ON(anim==NULL,"Can't Find Anim(%s)",name);

	setAnimation(anim);
}
const char* Sprite2D::getAnimation()
{
	if(m_curAnimation)
	{
		return NULL;
	}

	FsString* name=m_curAnimation->getName();
	return name->cstr();
}

bool Sprite2D::hasAnimation(const char* name)
{
	Sprite2DAnimation* anim=m_data->getAnimation(name);
	bool ret=(anim!=NULL);
	return ret;
}

void Sprite2D::updateAnimation(float dt)
{
	if(!m_curAnimation||m_stop)
	{
		return ;
	}
{'fraction_non_alphanumeric': 0.1397252265419468, 'fraction_numerical': 0.013154048523823443, 'mean_word_length': 4.809847198641766, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4643292', 'n_tokens_mistral': 1473, 'n_tokens_neox': 1366, 'n_words': 240}