diff options
author | Lukas Toenne <lukas.toenne@googlemail.com> | 2012-07-25 16:07:19 +0400 |
---|---|---|
committer | Lukas Toenne <lukas.toenne@googlemail.com> | 2012-07-25 16:07:19 +0400 |
commit | 7eaef1068dbec8dda48aadbed8c0e86e1245ad63 (patch) | |
tree | 2561066f3ef6e44bc55835b0a8b631471b904a4d /source/blender/editors/space_buttons | |
parent | 1bb491348b039eff2cc4e56267efcb43d24fccae (diff) |
Fix #31419, Changing Boid-Properties impossible with pinned Particle Menu.
Boid operators now retrieve the particle settings from the context directly, instead of always using the particle system (which is only needed to get to the settings anyway). When particle settings are pinned there is no particle system in the context, causing the operators to fail.
Diffstat (limited to 'source/blender/editors/space_buttons')
-rw-r--r-- | source/blender/editors/space_buttons/buttons_context.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 6154a1cc5ce..c41d2521ee8 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -683,7 +683,7 @@ const char *buttons_context_dir[] = { "world", "object", "mesh", "armature", "lattice", "curve", "meta_ball", "lamp", "speaker", "camera", "material", "material_slot", "texture", "texture_slot", "texture_user", "bone", "edit_bone", - "pose_bone", "particle_system", "particle_system_editable", + "pose_bone", "particle_system", "particle_system_editable", "particle_settings", "cloth", "soft_body", "fluid", "smoke", "collision", "brush", "dynamic_paint", NULL }; @@ -890,6 +890,27 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r CTX_data_pointer_set(result, NULL, &RNA_ParticleSystem, NULL); return 1; } + else if (CTX_data_equals(member, "particle_settings")) { + /* only available when pinned */ + PointerRNA *ptr = get_pointer_type(path, &RNA_ParticleSettings); + + if (ptr && ptr->data) { + CTX_data_pointer_set(result, ptr->id.data, &RNA_ParticleSettings, ptr->data); + return 1; + } + else { + /* get settings from active particle system instead */ + PointerRNA *ptr = get_pointer_type(path, &RNA_ParticleSystem); + + if (ptr && ptr->data) { + ParticleSettings *part = ((ParticleSystem *)ptr->data)->part; + CTX_data_pointer_set(result, ptr->id.data, &RNA_ParticleSettings, part); + return 1; + } + } + set_pointer_type(path, result, &RNA_ParticleSettings); + return 1; + } else if (CTX_data_equals(member, "cloth")) { PointerRNA *ptr = get_pointer_type(path, &RNA_Object); |