diff options
author | Janne Karhu <jhkarh@gmail.com> | 2011-02-12 17:38:34 +0300 |
---|---|---|
committer | Janne Karhu <jhkarh@gmail.com> | 2011-02-12 17:38:34 +0300 |
commit | fafbd9d71b95776d1c7583476de74fccefab7f10 (patch) | |
tree | 838e0fbc2e53c0700a87ebc1fdf4798837ffda3e /source/blender/editors | |
parent | c8c86aa6a12a253680aa266ce1c5d51b1b39005a (diff) |
Particles todo item: particle textures
* Effecting particle properties with textures was possible in 2.49,
but not in 2.5 anymore.
* Now particles have their own textures (available in texture panel
for objects with particle systems), which are totally separate from
the material textures.
* Currently a basic set of particle properties is available for
texture control. Some others could still be added, but the whole
system is not intended as an "change anything with a texture" as
this kind of functionality will be provided with node particles in
the future much better.
* Combined with the previously added "particle texture coordinates"
this new functionality also solves the problem of animating particle
properties through the particle lifetime nicely.
* Currently the textures only use the intensity of the texture in
"multiply" blending mode, so in order for the textures to effect
a particle parameter there has to be a non-zero value defined for
the parameter in the particle settings. Other blend modes can be
added later if they're considered useful enough.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/space_buttons/buttons_context.c | 19 | ||||
-rw-r--r-- | source/blender/editors/space_buttons/buttons_header.c | 3 | ||||
-rw-r--r-- | source/blender/editors/space_buttons/space_buttons.c | 1 |
3 files changed, 23 insertions, 0 deletions
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index d075958ffef..ee8b67a146a 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -360,6 +360,7 @@ static int buttons_context_path_texture(ButsContextPath *path) Lamp *la; Brush *br; World *wo; + ParticleSystem *psys; Tex *tex; PointerRNA *ptr= &path->ptr[path->len-1]; int orig_len = path->len; @@ -392,6 +393,18 @@ static int buttons_context_path_texture(ButsContextPath *path) return 1; } } + /* 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); + + RNA_id_pointer_create(&tex->id, &path->ptr[path->len]); + path->len++; + return 1; + } + } /* try material */ if(buttons_context_path_material(path)) { ma= path->ptr[path->len-1].data; @@ -733,6 +746,12 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r if(br) CTX_data_pointer_set(result, &br->id, &RNA_BrushTextureSlot, &br->mtex); } + else if((ptr=get_pointer_type(path, &RNA_ParticleSystem))) { + ParticleSettings *part= ((ParticleSystem *)ptr->data)->part; + + if(part) + CTX_data_pointer_set(result, &part->id, &RNA_ParticleSettingsTextureSlot, part->mtex[(int)part->texact]); + } return 1; } diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c index 18882a68e52..bfc5a27883d 100644 --- a/source/blender/editors/space_buttons/buttons_header.c +++ b/source/blender/editors/space_buttons/buttons_header.c @@ -66,6 +66,9 @@ static void set_texture_context(bContext *C, SpaceButs *sbuts) case BCONTEXT_WORLD: sbuts->texture_context = SB_TEXC_WORLD; break; + case BCONTEXT_PARTICLE: + sbuts->texture_context = SB_TEXC_PARTICLES; + break; } } diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index b33231f190c..61485987cc9 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -281,6 +281,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn) case ND_PARTICLE: if (wmn->action == NA_EDITED) buttons_area_redraw(sa, BCONTEXT_PARTICLE); + sbuts->preview= 1; break; case ND_DRAW: buttons_area_redraw(sa, BCONTEXT_OBJECT); |