Fix for [#24107] Hair/General particle glitch- Presets
authorJanne Karhu <jhkarh@gmail.com>
Tue, 5 Oct 2010 09:32:35 +0000 (09:32 +0000)
committerJanne Karhu <jhkarh@gmail.com>
Tue, 5 Oct 2010 09:32:35 +0000 (09:32 +0000)
release/scripts/ui/properties_particle.py
source/blender/makesrna/intern/rna_particle.c

index 7f630d6e5ff15e29f837a2e852a3674d8884f219..ff49b0e4e9f264d11a82babe4a9f2ef9d70d7926 100644 (file)
@@ -28,12 +28,10 @@ from properties_physics_common import basic_force_field_falloff_ui
 
 def particle_panel_enabled(context, psys):
     phystype = psys.settings.physics_type
-    if phystype == 'NO' or phystype == 'KEYED':
+    if psys.settings.type in ('EMITTER', 'REACTOR') and phystype in ('NO', 'KEYED'):
         return True
-    if psys.settings.type in ('EMITTER', 'REACTOR') or (psys.settings.type == 'HAIR' and psys.use_hair_dynamics):
-        return (psys.point_cache.is_baked is False) and (not psys.is_edited) and (not context.particle_system_editable)
     else:
-        return True
+        return (psys.point_cache.is_baked is False) and (not psys.is_edited) and (not context.particle_system_editable)
 
 
 def particle_panel_poll(cls, context):
index 1151215f5f717aff9258be5f7397195e40b9e5c9..7a8165e9aa5f9556e3d6a3daf447bf6b762b94ed 100644 (file)
@@ -325,15 +325,21 @@ static PointerRNA rna_particle_settings_get(PointerRNA *ptr)
 static void rna_particle_settings_set(PointerRNA *ptr, PointerRNA value)
 {
        ParticleSystem *psys= (ParticleSystem*)ptr->data;
+       int old_type = 0;
 
-       if(psys->part)
+
+       if(psys->part) {
+               old_type = psys->part->type;
                psys->part->id.us--;
+       }
 
        psys->part = (ParticleSettings *)value.data;
 
        if(psys->part) {
                psys->part->id.us++;
                psys_check_boid_data(psys);
+               if(old_type != psys->part->type)
+                       psys->recalc |= PSYS_RECALC_TYPE;
        }
 }
 static void rna_Particle_abspathtime_update(Main *bmain, Scene *scene, PointerRNA *ptr)