From e660f53c6d6ffcee501d26f94abdfeeda641dee6 Mon Sep 17 00:00:00 2001 From: Josh Wilson Date: Wed, 28 Sep 2005 22:15:37 +0000 Subject: [PATCH] Added anim source info update on setTexture(). Added check for successful texture addition before updating the most recently added textures info. --- panda/src/particlesystem/spriteParticleRenderer.I | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/panda/src/particlesystem/spriteParticleRenderer.I b/panda/src/particlesystem/spriteParticleRenderer.I index 42393ad3b3..8fafbb4c6a 100644 --- a/panda/src/particlesystem/spriteParticleRenderer.I +++ b/panda/src/particlesystem/spriteParticleRenderer.I @@ -30,8 +30,10 @@ //////////////////////////////////////////////////////////////////// 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); + set_texture(tex,texels_per_unit); + + //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,8 +64,12 @@ 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); - get_last_anim()->set_source_info(tex_path); + if (anim_count < (int)_anims.size()) { + get_last_anim()->set_source_info(tex_path); + } + } INLINE void SpriteParticleRenderer::