Revision: 48585
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48585
Author:   campbellbarton
Date:     2012-07-04 11:48:42 +0000 (Wed, 04 Jul 2012)
Log Message:
-----------
cycles changes:
- images that can't be loaded because of the limit are printed in the console.
- textures that can't be found show up as pink (so we know somethings wrong).

Modified Paths:
--------------
    trunk/blender/intern/cycles/render/image.cpp
    trunk/blender/intern/cycles/render/image.h
    trunk/blender/intern/cycles/render/nodes.cpp

Modified: trunk/blender/intern/cycles/render/image.cpp
===================================================================
--- trunk/blender/intern/cycles/render/image.cpp        2012-07-04 11:39:28 UTC 
(rev 48584)
+++ trunk/blender/intern/cycles/render/image.cpp        2012-07-04 11:48:42 UTC 
(rev 48585)
@@ -109,8 +109,11 @@
 
                if(slot == float_images.size()) {
                        /* max images limit reached */
-                       if(float_images.size() == TEX_NUM_FLOAT_IMAGES)
+                       if(float_images.size() == TEX_NUM_FLOAT_IMAGES) {
+                               printf("ImageManager::add_image: byte image 
limit reached %d, skipping '%s'\n",
+                                      TEX_NUM_IMAGES, filename.c_str());
                                return -1;
+                       }
 
                        float_images.resize(float_images.size() + 1);
                }
@@ -141,8 +144,11 @@
 
                if(slot == images.size()) {
                        /* max images limit reached */
-                       if(images.size() == TEX_NUM_IMAGES)
+                       if(images.size() == TEX_NUM_IMAGES) {
+                               printf("ImageManager::add_image: byte image 
limit reached %d, skipping '%s'\n",
+                                      TEX_NUM_IMAGES, filename.c_str());
                                return -1;
+                       }
 
                        images.resize(images.size() + 1);
                }
@@ -353,13 +359,13 @@
                        device->tex_free(tex_img);
 
                if(!file_load_float_image(img, tex_img)) {
-                       /* on failure to load, we set a 1x1 pixels black image 
*/
+                       /* on failure to load, we set a 1x1 pixels pink image */
                        float *pixels = (float*)tex_img.resize(1, 1);
 
-                       pixels[0] = 0.0f;
-                       pixels[1] = 0.0f;
-                       pixels[2] = 0.0f;
-                       pixels[3] = 0.0f;
+                       pixels[0] = TEX_IMAGE_MISSING_R;
+                       pixels[1] = TEX_IMAGE_MISSING_G;
+                       pixels[2] = TEX_IMAGE_MISSING_B;
+                       pixels[3] = TEX_IMAGE_MISSING_A;
                }
 
                string name;
@@ -380,13 +386,13 @@
                        device->tex_free(tex_img);
 
                if(!file_load_image(img, tex_img)) {
-                       /* on failure to load, we set a 1x1 pixels black image 
*/
+                       /* on failure to load, we set a 1x1 pixels pink image */
                        uchar *pixels = (uchar*)tex_img.resize(1, 1);
 
-                       pixels[0] = 0;
-                       pixels[1] = 0;
-                       pixels[2] = 0;
-                       pixels[3] = 0;
+                       pixels[0] = (TEX_IMAGE_MISSING_R * 255);
+                       pixels[1] = (TEX_IMAGE_MISSING_G * 255);
+                       pixels[2] = (TEX_IMAGE_MISSING_B * 255);
+                       pixels[3] = (TEX_IMAGE_MISSING_A * 255);
                }
 
                string name;

Modified: trunk/blender/intern/cycles/render/image.h
===================================================================
--- trunk/blender/intern/cycles/render/image.h  2012-07-04 11:39:28 UTC (rev 
48584)
+++ trunk/blender/intern/cycles/render/image.h  2012-07-04 11:48:42 UTC (rev 
48585)
@@ -31,6 +31,12 @@
 #define TEX_IMAGE_MAX                  (TEX_NUM_IMAGES + TEX_NUM_FLOAT_IMAGES)
 #define TEX_IMAGE_FLOAT_START  TEX_NUM_IMAGES
 
+/* color to use when textures are not found */
+#define TEX_IMAGE_MISSING_R 1
+#define TEX_IMAGE_MISSING_G 0
+#define TEX_IMAGE_MISSING_B 1
+#define TEX_IMAGE_MISSING_A 1
+
 class Device;
 class DeviceScene;
 class Progress;

Modified: trunk/blender/intern/cycles/render/nodes.cpp
===================================================================
--- trunk/blender/intern/cycles/render/nodes.cpp        2012-07-04 11:39:28 UTC 
(rev 48584)
+++ trunk/blender/intern/cycles/render/nodes.cpp        2012-07-04 11:48:42 UTC 
(rev 48585)
@@ -184,10 +184,12 @@
                /* image not found */
                if(!color_out->links.empty()) {
                        compiler.add_node(NODE_VALUE_V, 
color_out->stack_offset);
-                       compiler.add_node(NODE_VALUE_V, make_float3(0, 0, 0));
+                       compiler.add_node(NODE_VALUE_V, 
make_float3(TEX_IMAGE_MISSING_R,
+                                                                   
TEX_IMAGE_MISSING_G,
+                                                                   
TEX_IMAGE_MISSING_B));
                }
                if(!alpha_out->links.empty())
-                       compiler.add_node(NODE_VALUE_F, __float_as_int(0.0f), 
alpha_out->stack_offset);
+                       compiler.add_node(NODE_VALUE_F, 
__float_as_int(TEX_IMAGE_MISSING_A), alpha_out->stack_offset);
        }
 }
 
@@ -288,10 +290,12 @@
                /* image not found */
                if(!color_out->links.empty()) {
                        compiler.add_node(NODE_VALUE_V, 
color_out->stack_offset);
-                       compiler.add_node(NODE_VALUE_V, make_float3(0, 0, 0));
+                       compiler.add_node(NODE_VALUE_V, 
make_float3(TEX_IMAGE_MISSING_R,
+                                                                   
TEX_IMAGE_MISSING_G,
+                                                                   
TEX_IMAGE_MISSING_B));
                }
                if(!alpha_out->links.empty())
-                       compiler.add_node(NODE_VALUE_F, __float_as_int(0.0f), 
alpha_out->stack_offset);
+                       compiler.add_node(NODE_VALUE_F, 
__float_as_int(TEX_IMAGE_MISSING_A), alpha_out->stack_offset);
        }
 }
 

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to