[Bf-blender-cvs] [4fc2b8d] master: Added BKE_linestyle_use_textures() to check if stroke textures are enabled.

Tamito Kajiyama noreply at git.blender.org
Tue Aug 12 03:17:45 CEST 2014


Commit: 4fc2b8dcc624392919293efb8c7fbdc83ed1c28c
Author: Tamito Kajiyama
Date:   Sat Jul 19 15:33:15 2014 +0900
Branches: master
https://developer.blender.org/rB4fc2b8dcc624392919293efb8c7fbdc83ed1c28c

Added BKE_linestyle_use_textures() to check if stroke textures are enabled.

===================================================================

M	source/blender/blenkernel/BKE_linestyle.h
M	source/blender/blenkernel/intern/linestyle.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_linestyle.h b/source/blender/blenkernel/BKE_linestyle.h
index ec13463..ae10ba4 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 1d67908..f0c582d 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);




More information about the Bf-blender-cvs mailing list