fix [#27627] Strange behavior with solid open gl lights
authorCampbell Barton <ideasman42@gmail.com>
Fri, 10 Jun 2011 16:59:15 +0000 (16:59 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 10 Jun 2011 16:59:15 +0000 (16:59 +0000)
disable turning off all lights in the user preferences.

source/blender/makesrna/intern/rna_userdef.c

index b67805c..14af5ed 100644 (file)
@@ -245,6 +245,13 @@ static void rna_UserDef_weight_color_update(Main *bmain, Scene *scene, PointerRN
 
 static void rna_UserDef_viewport_lights_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
+       /* if all lights are off gpu_draw resets them all, [#27627]
+        * so disallow them all to be disabled */
+       if(U.light[0].flag==0 && U.light[1].flag==0 && U.light[2].flag==0) {
+               SolidLight *light= ptr->data;
+               light->flag |= 1;
+       }
+
        WM_main_add_notifier(NC_SPACE|ND_SPACE_VIEW3D|NS_VIEW3D_GPU, NULL);
        rna_userdef_update(bmain, scene, ptr);
 }