Particles todo item: particle textures
[blender-staging.git] / source / blender / editors / space_buttons / buttons_context.c
index d075958ffef303e25ff9ad8d318ac2e5c3bdc1b0..ee8b67a146ac9d293e34b1681feeebeb25c103f6 100644 (file)
@@ -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;
        }