[Bf-blender-cvs] [eb9401e9aff] blender-v2.82-release: Cleanup: get rid of magic values for return flags of texture value getters.

Bastien Montagne noreply at git.blender.org
Tue Jan 14 19:43:08 CET 2020


Commit: eb9401e9aff86dcaf0a1120260c974d5f489104a
Author: Bastien Montagne
Date:   Tue Jan 14 19:38:28 2020 +0100
Branches: blender-v2.82-release
https://developer.blender.org/rBeb9401e9aff86dcaf0a1120260c974d5f489104a

Cleanup: get rid of magic values for return flags of texture value getters.

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

M	source/blender/makesdna/DNA_texture_types.h
M	source/blender/render/intern/source/imagetexture.c

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

diff --git a/source/blender/makesdna/DNA_texture_types.h b/source/blender/makesdna/DNA_texture_types.h
index ead1bcc943d..3d3d215b973 100644
--- a/source/blender/makesdna/DNA_texture_types.h
+++ b/source/blender/makesdna/DNA_texture_types.h
@@ -406,8 +406,8 @@ typedef struct ColorMapping {
 
 /* return value */
 #define TEX_INT 0
-#define TEX_RGB 1
-#define TEX_NOR 2
+#define TEX_RGB (1 << 0)
+#define TEX_NOR (1 << 1)
 
 /* pr_texture in material, world, light. */
 #define TEX_PR_TEXTURE 0
diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c
index 47d0986fabd..253741401f1 100644
--- a/source/blender/render/intern/source/imagetexture.c
+++ b/source/blender/render/intern/source/imagetexture.c
@@ -112,7 +112,7 @@ int imagewrap(Tex *tex,
   texres->tin = texres->ta = texres->tr = texres->tg = texres->tb = 0.0f;
 
   /* we need to set retval OK, otherwise texture code generates normals itself... */
-  retval = texres->nor ? 3 : 1;
+  retval = texres->nor ? (TEX_RGB | TEX_NOR) : TEX_RGB;
 
   /* quick tests */
   if (ima == NULL) {
@@ -1035,7 +1035,7 @@ static int imagewraposa_aniso(Tex *tex,
   texres->tin = texres->ta = texres->tr = texres->tg = texres->tb = 0.f;
 
   /* we need to set retval OK, otherwise texture code generates normals itself... */
-  retval = texres->nor ? 3 : 1;
+  retval = texres->nor ? (TEX_RGB | TEX_NOR) : TEX_RGB;
 
   /* quick tests */
   if (ibuf == NULL && ima == NULL) {
@@ -1492,7 +1492,7 @@ int imagewraposa(Tex *tex,
   texres->tin = texres->ta = texres->tr = texres->tg = texres->tb = 0.0f;
 
   /* we need to set retval OK, otherwise texture code generates normals itself... */
-  retval = texres->nor ? 3 : 1;
+  retval = texres->nor ? (TEX_RGB | TEX_NOR) : TEX_RGB;
 
   /* quick tests */
   if (ibuf == NULL && ima == NULL) {



More information about the Bf-blender-cvs mailing list