diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2014-07-19 10:33:15 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2014-08-12 05:10:32 +0400 |
commit | 4fc2b8dcc624392919293efb8c7fbdc83ed1c28c (patch) | |
tree | 32ffefcf205bd595978fccf5cb6b11f88df37400 /source | |
parent | 1ddb8e238e1239998c810fca5733641005b0964f (diff) |
Added BKE_linestyle_use_textures() to check if stroke textures are enabled.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_linestyle.h | 10 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/linestyle.c | 21 |
2 files changed, 31 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_linestyle.h b/source/blender/blenkernel/BKE_linestyle.h index ec13463927d..ae10ba4caab 100644 --- a/source/blender/blenkernel/BKE_linestyle.h +++ b/source/blender/blenkernel/BKE_linestyle.h @@ -35,6 +35,10 @@ #include "DNA_linestyle_types.h" +#ifdef __cplusplus +extern "C" { +#endif + #define LS_MODIFIER_TYPE_COLOR 1 #define LS_MODIFIER_TYPE_ALPHA 2 #define LS_MODIFIER_TYPE_THICKNESS 3 @@ -76,6 +80,12 @@ char *BKE_linestyle_path_to_color_ramp(FreestyleLineStyle *linestyle, struct Col void BKE_linestyle_target_object_unlink(FreestyleLineStyle *linestyle, struct Object *ob); +bool BKE_linestyle_use_textures(FreestyleLineStyle *linestyle, const bool use_shading_nodes); + void BKE_linestyle_default_shader(const struct bContext *C, FreestyleLineStyle *linestyle); +#ifdef __cplusplus +} +#endif + #endif /* __BKE_LINESTYLE_H__ */ diff --git a/source/blender/blenkernel/intern/linestyle.c b/source/blender/blenkernel/intern/linestyle.c index 1d6790856bb..f0c582d3485 100644 --- a/source/blender/blenkernel/intern/linestyle.c +++ b/source/blender/blenkernel/intern/linestyle.c @@ -1154,6 +1154,27 @@ void BKE_linestyle_target_object_unlink(FreestyleLineStyle *linestyle, struct Ob } } +bool BKE_linestyle_use_textures(FreestyleLineStyle *linestyle, const bool use_shading_nodes) +{ + if (use_shading_nodes) { + if (linestyle && linestyle->use_nodes && linestyle->nodetree) { + bNode *node; + + for (node = linestyle->nodetree->nodes.first; node; node = node->next) { + if (node->typeinfo->nclass == NODE_CLASS_TEXTURE) { + return true; + } + } + } + } + else { + if (linestyle && (linestyle->flag & LS_TEXTURE)) { + return (linestyle->mtex[0] != NULL); + } + } + return false; +} + void BKE_linestyle_default_shader(const bContext *C, FreestyleLineStyle *linestyle) { Scene *scene = CTX_data_scene(C); |