Fix for bug #17809: crash with glsl materials and nodes refresh,
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Sat, 11 Oct 2008 18:52:36 +0000 (18:52 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Sat, 11 Oct 2008 18:52:36 +0000 (18:52 +0000)
didn't attach to the right materials to the lamp.

source/blender/gpu/intern/gpu_material.c

index 6dff5802c31ab6aea21c8b04d7bcbb10fcc73553..62c3f848284927ece3a2ee7887025f2b24614020 100644 (file)
@@ -693,7 +693,7 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
                                                shr->spec, &shr->spec);
                                
                                add_user_list(&mat->lamps, lamp);
-                               add_user_list(&lamp->materials, ma);
+                               add_user_list(&lamp->materials, shi->gpumat->ma);
                                return;
                        }
                        
@@ -702,7 +702,7 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
        }
        else if((G.fileflags & G_FILE_GLSL_NO_SHADOWS) && (lamp->mode & LA_ONLYSHADOW)) {
                add_user_list(&mat->lamps, lamp);
-               add_user_list(&lamp->materials, ma);
+               add_user_list(&lamp->materials, shi->gpumat->ma);
                return;
        }
        else
@@ -755,7 +755,7 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
        }
 
        add_user_list(&mat->lamps, lamp);
-       add_user_list(&lamp->materials, ma);
+       add_user_list(&lamp->materials, shi->gpumat->ma);
 }
 
 static void material_lights(GPUShadeInput *shi, GPUShadeResult *shr)