Added anim source info update on setTexture(). Added check for successful texture addition before updating the most recently added textures info.

This commit is contained in:
Josh Wilson 2005-09-28 22:15:37 +00:00
parent 6ffd095fdf
commit e660f53c6d

View File

@ -31,7 +31,9 @@
INLINE void SpriteParticleRenderer::
set_texture(Texture *tex, const string &tex_path, float texels_per_unit) {
set_texture(tex,texels_per_unit);
get_last_anim()->set_source_info(tex_path);
//moved to "set_texture(Texture *tex, float texels_per_unit)" for backwards compatibility
//get_last_anim()->set_source_info(tex_path);
}
INLINE void SpriteParticleRenderer::
@ -46,6 +48,8 @@ set_texture(Texture *tex, float texels_per_unit) {
// We scale the particle size by the size of the texture.
set_size(tex->get_x_size() / texels_per_unit,
tex->get_y_size() / texels_per_unit);
get_last_anim()->set_source_info(tex->get_filename());
}
init_geoms();
}
@ -60,10 +64,14 @@ set_texture(Texture *tex, float texels_per_unit) {
////////////////////////////////////////////////////////////////////
INLINE void SpriteParticleRenderer::
add_texture(Texture *tex, const string &tex_path, float texels_per_unit, bool resize) {
int anim_count = _anims.size();
add_texture(tex,texels_per_unit,resize);
if (anim_count < (int)_anims.size()) {
get_last_anim()->set_source_info(tex_path);
}
}
INLINE void SpriteParticleRenderer::
add_texture(Texture *tex, float texels_per_unit, bool resize) {
if (_anims.size() == 0) {