diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-10-15 22:27:41 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-10-15 22:27:41 +0400 |
commit | 66725a189e277744f134e4c098c6dbecd979689f (patch) | |
tree | 3e2453a76558307a4ffeb21e280beaa2277eb81a | |
parent | d464e2454eb4816f58786fd4bbd419c759e764dc (diff) |
disallow editing particle settings when first entering particle editmode, would crash instantly when changing the amount for eg.
-rw-r--r-- | release/scripts/ui/buttons_particle.py | 22 | ||||
-rw-r--r-- | source/blender/editors/space_buttons/buttons_context.c | 9 |
2 files changed, 19 insertions, 12 deletions
diff --git a/release/scripts/ui/buttons_particle.py b/release/scripts/ui/buttons_particle.py index 81ddab40ec9..b0be974727a 100644 --- a/release/scripts/ui/buttons_particle.py +++ b/release/scripts/ui/buttons_particle.py @@ -6,8 +6,8 @@ from buttons_physics_common import effector_weights_ui from buttons_physics_common import basic_force_field_settings_ui from buttons_physics_common import basic_force_field_falloff_ui -def particle_panel_enabled(psys): - return psys.point_cache.baked==False and psys.edited==False +def particle_panel_enabled(context, psys): + return psys.point_cache.baked==False and psys.edited==False and (not context.particle_system_editable) def particle_panel_poll(context): psys = context.particle_system @@ -78,7 +78,7 @@ class PARTICLE_PT_particles(ParticleButtonsPanel): return row=col.row() - row.enabled = particle_panel_enabled(psys) + row.enabled = particle_panel_enabled(context, psys) row.itemR(part, "type", text="") row.itemR(psys, "seed") @@ -89,7 +89,7 @@ class PARTICLE_PT_particles(ParticleButtonsPanel): else: split.itemL(text="") row = split.row() - row.enabled = particle_panel_enabled(psys) + row.enabled = particle_panel_enabled(context, psys) row.itemR(part, "hair_step") if psys.edited==True: if psys.global_hair: @@ -99,7 +99,7 @@ class PARTICLE_PT_particles(ParticleButtonsPanel): layout.itemO("particle.disconnect_hair") layout.itemL(text="") elif part.type=='REACTOR': - split.enabled = particle_panel_enabled(psys) + split.enabled = particle_panel_enabled(context, psys) split.itemR(psys, "reactor_target_object") split.itemR(psys, "reactor_target_particle_system", text="Particle System") @@ -118,7 +118,7 @@ class PARTICLE_PT_emission(ParticleButtonsPanel): psys = context.particle_system part = psys.settings - layout.enabled = particle_panel_enabled(psys) and not psys.multiple_caches + layout.enabled = particle_panel_enabled(context, psys) and not psys.multiple_caches row = layout.row() row.active = part.distribution != 'GRID' @@ -221,7 +221,7 @@ class PARTICLE_PT_cache(ParticleButtonsPanel): psys = context.particle_system - point_cache_ui(self, psys.point_cache, particle_panel_enabled(psys), not psys.hair_dynamics, 0) + point_cache_ui(self, psys.point_cache, particle_panel_enabled(context, psys), not psys.hair_dynamics, 0) class PARTICLE_PT_velocity(ParticleButtonsPanel): __label__ = "Velocity" @@ -239,7 +239,7 @@ class PARTICLE_PT_velocity(ParticleButtonsPanel): psys = context.particle_system part = psys.settings - layout.enabled = particle_panel_enabled(psys) + layout.enabled = particle_panel_enabled(context, psys) split = layout.split() @@ -284,7 +284,7 @@ class PARTICLE_PT_rotation(ParticleButtonsPanel): psys = context.particle_system part = psys.settings - layout.enabled = particle_panel_enabled(psys) + layout.enabled = particle_panel_enabled(context, psys) split = layout.split() split.itemL(text="Initial Rotation:") @@ -322,7 +322,7 @@ class PARTICLE_PT_physics(ParticleButtonsPanel): psys = context.particle_system part = psys.settings - layout.enabled = particle_panel_enabled(psys) + layout.enabled = particle_panel_enabled(context, psys) row = layout.row() row.itemR(part, "physics_type", expand=True) @@ -461,7 +461,7 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel): boids = context.particle_system.settings.boids layout = self.layout - layout.enabled = particle_panel_enabled(context.particle_system) + layout.enabled = particle_panel_enabled(context, context.particle_system) # Currently boids can only use the first state so these are commented out for now. #row = layout.row() diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 8072853bcb8..eb88ea8519e 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -554,7 +554,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r static const char *dir[] = { "world", "object", "mesh", "armature", "lattice", "curve", "meta_ball", "lamp", "camera", "material", "material_slot", - "texture", "texture_slot", "bone", "edit_bone", "particle_system", + "texture", "texture_slot", "bone", "edit_bone", "particle_system", "particle_system_editable", "cloth", "soft_body", "fluid", "smoke", "collision", "brush", NULL}; CTX_data_dir_set(result, dir); @@ -658,6 +658,13 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r set_pointer_type(path, result, &RNA_ParticleSystem); return 1; } + else if(CTX_data_equals(member, "particle_system_editable")) { + if(PE_poll(C)) + set_pointer_type(path, result, &RNA_ParticleSystem); + else + CTX_data_pointer_set(result, NULL, &RNA_ParticleSystem, NULL); + return 1; + } else if(CTX_data_equals(member, "cloth")) { PointerRNA *ptr= get_pointer_type(path, &RNA_Object); |