diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2014-08-28 18:40:38 +0400 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2014-08-28 22:41:05 +0400 |
commit | cf3ce7322a9b6c1453869a369eba02f4fd077234 (patch) | |
tree | 94f11f57da8c00ce780e878767517cf4e428c907 /source/blender/blenkernel/intern/material.c | |
parent | 512b7383525d7b9ccdca93816a08a579db148f23 (diff) |
Texture painting:
Include explicit control for texturing:
This commit introduces a painting mode option, available in
the slots panel. The default value "Material" will create slots from the
blender material, same as just merged from the paint branch.
The new option "Image", will use an explicit image field that artists can use
to select the image to paint on. This will should allow painting regardless
of the renderer used or for use in modifiers.
Diffstat (limited to 'source/blender/blenkernel/intern/material.c')
-rw-r--r-- | source/blender/blenkernel/intern/material.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 50147149b0c..e7500392c81 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -274,8 +274,7 @@ Material *localize_material(Material *ma) if (ma->ramp_col) man->ramp_col = MEM_dupallocN(ma->ramp_col); if (ma->ramp_spec) man->ramp_spec = MEM_dupallocN(ma->ramp_spec); - if (ma->texpaintslot) man->texpaintslot = MEM_dupallocN(man->texpaintslot); - + ma->texpaintslot = NULL; man->preview = NULL; if (ma->nodetree) @@ -1328,9 +1327,16 @@ void BKE_texpaint_slot_refresh_cache(Scene *scene, Material *ma) if (ma->texpaintslot) { MEM_freeN(ma->texpaintslot); + ma->tot_slots = 0; ma->texpaintslot = NULL; } + if (scene->toolsettings->imapaint.mode == IMAGEPAINT_MODE_IMAGE) { + ma->paint_active_slot = 0; + ma->paint_clone_slot = 0; + return; + } + if (use_nodes || ma->use_nodes) { bNode *node, *active_node; @@ -1342,10 +1348,9 @@ void BKE_texpaint_slot_refresh_cache(Scene *scene, Material *ma) count++; } - ma->tot_slots = count; - if (count == 0) { ma->paint_active_slot = 0; + ma->paint_clone_slot = 0; return; } ma->texpaintslot = MEM_callocN(sizeof(*ma->texpaintslot) * count, "texpaint_slots"); @@ -1367,10 +1372,9 @@ void BKE_texpaint_slot_refresh_cache(Scene *scene, Material *ma) } } - ma->tot_slots = count; - if (count == 0) { ma->paint_active_slot = 0; + ma->paint_clone_slot = 0; return; } @@ -1387,6 +1391,8 @@ void BKE_texpaint_slot_refresh_cache(Scene *scene, Material *ma) } } + ma->tot_slots = count; + if (ma->paint_active_slot >= count) { ma->paint_active_slot = count - 1; } |