diff options
author | Janne Karhu <jhkarh@gmail.com> | 2011-02-16 13:57:58 +0300 |
---|---|---|
committer | Janne Karhu <jhkarh@gmail.com> | 2011-02-16 13:57:58 +0300 |
commit | ef920a50da2d9e31315e45ab225e1e52a66a8888 (patch) | |
tree | ae56b6da6cab3406c5a71d15b8efe9d24e6be07f /source | |
parent | d450e35f217bf41b91b7a3d66b3d7cdc68dd8b2b (diff) |
Particle settings can now be pinned too:
* Particle system's are comparable to texture slots, which can
only exist within an id block. Particle settings on the other
hand are idblocks which should be pinnable just like textures.
* When particle settings are pinned only properties that make
sense without the actual particle system are shown in the
particle panel.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/space_buttons/buttons_context.c | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index fe49c20c040..dda5887aef0 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -307,7 +307,12 @@ static int buttons_context_path_particle(ButsContextPath *path) { Object *ob; ParticleSystem *psys; + PointerRNA *ptr= &path->ptr[path->len-1]; + /* if we already have (pinned) particle settings, we're done */ + if(RNA_struct_is_a(ptr->type, &RNA_ParticleSettings)) { + return 1; + } /* if we have an object, get the active particle system */ if(buttons_context_path_object(path)) { ob= path->ptr[path->len-1].data; @@ -395,15 +400,25 @@ static int buttons_context_path_texture(ButsContextPath *path) } /* try particles */ if((path->tex_ctx == SB_TEXC_PARTICLES) && buttons_context_path_particle(path)) { - psys= path->ptr[path->len-1].data; - - if(psys && psys->part && GS(psys->part->id.name)==ID_PA) { - tex= give_current_particle_texture(psys->part); + if(path->ptr[path->len-1].type == &RNA_ParticleSettings) { + ParticleSettings *part = path->ptr[path->len-1].data; + tex= give_current_particle_texture(part); RNA_id_pointer_create(&tex->id, &path->ptr[path->len]); path->len++; return 1; } + else { + psys= path->ptr[path->len-1].data; + + if(psys && psys->part && GS(psys->part->id.name)==ID_PA) { + tex= give_current_particle_texture(psys->part); + + RNA_id_pointer_create(&tex->id, &path->ptr[path->len]); + path->len++; + return 1; + } + } } /* try material */ if(buttons_context_path_material(path)) { @@ -930,6 +945,14 @@ ID *buttons_context_id_path(const bContext *C) for(a=path->len-1; a>=0; a--) { ptr= &path->ptr[a]; + /* pin particle settings instead of system, since only settings are an idblock*/ + if(sbuts->mainb == BCONTEXT_PARTICLE && sbuts->flag & SB_PIN_CONTEXT) { + if(ptr->type == &RNA_ParticleSystem && ptr->data) { + ParticleSystem *psys = (ParticleSystem *)ptr->data; + return &psys->part->id; + } + } + if(ptr->id.data) { return ptr->id.data; break; |