diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2014-05-03 13:51:53 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2014-05-03 13:54:59 +0400 |
commit | b7f085d9c128f31d576c732c6439b5a71e8922ee (patch) | |
tree | 8a1fdc2e95470f61d9121b18b125dc272e87d536 /source/blender/blenkernel/intern/texture.c | |
parent | 6ec2d72eca618be05e9bf0723886b10e6d5efa46 (diff) |
Patch D246: Texture Marks for freestyle strokes, written and contributed by Paolo Acampora.
Reviewers: brecht, kjym3, #freestyle
Reviewed By: brecht, kjym3
Differential Revision: https://developer.blender.org/D246
Diffstat (limited to 'source/blender/blenkernel/intern/texture.c')
-rw-r--r-- | source/blender/blenkernel/intern/texture.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index 75f2fd121dc..3e95da622ac 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -51,6 +51,7 @@ #include "DNA_node_types.h" #include "DNA_color_types.h" #include "DNA_particle_types.h" +#include "DNA_linestyle_types.h" #include "IMB_imbuf.h" @@ -999,6 +1000,41 @@ void set_current_lamp_texture(Lamp *la, Tex *newtex) } } +Tex *give_current_linestyle_texture(FreestyleLineStyle *linestyle) +{ + MTex *mtex = NULL; + Tex *tex = NULL; + + if (linestyle) { + mtex = linestyle->mtex[(int)(linestyle->texact)]; + if (mtex) tex = mtex->tex; + } + + return tex; +} + +void set_current_linestyle_texture(FreestyleLineStyle *linestyle, Tex *newtex) +{ + int act = linestyle->texact; + + if (linestyle->mtex[act] && linestyle->mtex[act]->tex) + id_us_min(&linestyle->mtex[act]->tex->id); + + if (newtex) { + if (!linestyle->mtex[act]) { + linestyle->mtex[act] = add_mtex(); + linestyle->mtex[act]->texco = TEXCO_STROKE; + } + + linestyle->mtex[act]->tex = newtex; + id_us_plus(&newtex->id); + } + else if (linestyle->mtex[act]) { + MEM_freeN(linestyle->mtex[act]); + linestyle->mtex[act] = NULL; + } +} + bNode *give_current_material_texture_node(Material *ma) { if (ma && ma->use_nodes && ma->nodetree) @@ -1048,6 +1084,10 @@ bool give_active_mtex(ID *id, MTex ***mtex_ar, short *act) *mtex_ar = ((Lamp *)id)->mtex; if (act) *act = (((Lamp *)id)->texact); break; + case ID_LS: + *mtex_ar = ((FreestyleLineStyle *)id)->mtex; + if (act) *act = (((FreestyleLineStyle *)id)->texact); + break; case ID_PA: *mtex_ar = ((ParticleSettings *)id)->mtex; if (act) *act = (((ParticleSettings *)id)->texact); @@ -1076,6 +1116,9 @@ void set_active_mtex(ID *id, short act) case ID_LA: ((Lamp *)id)->texact = act; break; + case ID_LS: + ((FreestyleLineStyle *)id)->texact = act; + break; case ID_PA: ((ParticleSettings *)id)->texact = act; break; |