From 6dda182a76fed9c86ac9c159808f90cd341d65be Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Wed, 16 Mar 2011 18:21:31 +0000 Subject: Fix for [#26520] Point Density turbulence not accessible in Texture Properties. * Mistake in the ui file. * Also found a possible memory leak. --- release/scripts/ui/properties_texture.py | 15 ++++++++------- source/blender/blenkernel/intern/texture.c | 5 ++++- source/blender/render/intern/source/pointdensity.c | 10 ++++++---- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/release/scripts/ui/properties_texture.py b/release/scripts/ui/properties_texture.py index 0b9826916fe..a67df41ab8b 100644 --- a/release/scripts/ui/properties_texture.py +++ b/release/scripts/ui/properties_texture.py @@ -706,12 +706,13 @@ class TEXTURE_PT_pointdensity(TextureButtonsPanel, bpy.types.Panel): col.separator() - col.label(text="Color Source:") - col.prop(pd, "color_source", text="") - if pd.color_source in {'PARTICLE_SPEED', 'PARTICLE_VELOCITY'}: - col.prop(pd, "speed_scale") - if pd.color_source in {'PARTICLE_SPEED', 'PARTICLE_AGE'}: - layout.template_color_ramp(pd, "color_ramp", expand=True) + if pd.point_source == 'PARTICLE_SYSTEM': + col.label(text="Color Source:") + col.prop(pd, "color_source", text="") + if pd.color_source in {'PARTICLE_SPEED', 'PARTICLE_VELOCITY'}: + col.prop(pd, "speed_scale") + if pd.color_source in {'PARTICLE_SPEED', 'PARTICLE_AGE'}: + layout.template_color_ramp(pd, "color_ramp", expand=True) col = split.column() col.label() @@ -733,7 +734,7 @@ class TEXTURE_PT_pointdensity_turbulence(TextureButtonsPanel, bpy.types.Panel): return tex and (tex.type == 'POINT_DENSITY' and (engine in cls.COMPAT_ENGINES)) def draw_header(self, context): - pd = tex.point_density + pd = context.texture.point_density self.layout.prop(pd, "use_turbulence", text="") diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index 1d5840765bc..12aef5f4b29 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -1379,7 +1379,10 @@ void BKE_free_pointdensitydata(PointDensity *pd) MEM_freeN(pd->point_data); pd->point_data = NULL; } - if(pd->coba) MEM_freeN(pd->coba); + if(pd->coba) { + MEM_freeN(pd->coba); + pd->coba = NULL; + } } void BKE_free_pointdensity(PointDensity *pd) diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c index dc0f083094c..7ccf81b7755 100644 --- a/source/blender/render/intern/source/pointdensity.c +++ b/source/blender/render/intern/source/pointdensity.c @@ -68,10 +68,12 @@ static int point_data_used(PointDensity *pd) { int pd_bitflag = 0; - if ((pd->noise_influence == TEX_PD_NOISE_VEL) || (pd->color_source == TEX_PD_COLOR_PARTVEL) || (pd->color_source == TEX_PD_COLOR_PARTSPEED)) - pd_bitflag |= POINT_DATA_VEL; - if ((pd->noise_influence == TEX_PD_NOISE_AGE) || (pd->color_source == TEX_PD_COLOR_PARTAGE)) - pd_bitflag |= POINT_DATA_LIFE; + if (pd->source == TEX_PD_PSYS) { + if ((pd->noise_influence == TEX_PD_NOISE_VEL) || (pd->color_source == TEX_PD_COLOR_PARTVEL) || (pd->color_source == TEX_PD_COLOR_PARTSPEED)) + pd_bitflag |= POINT_DATA_VEL; + if ((pd->noise_influence == TEX_PD_NOISE_AGE) || (pd->color_source == TEX_PD_COLOR_PARTAGE)) + pd_bitflag |= POINT_DATA_LIFE; + } return pd_bitflag; } -- cgit v1.2.3