Merged changes in the trunk up to revision 30952.
[blender-staging.git] / source / blender / editors / render / render_shading.c
index cd652664f73efd058766a8c91cc0dd26226f61f4..ba4052601394c3e41ae8466e7cbbbb00da038c2e 100644 (file)
@@ -213,6 +213,21 @@ static void image_changed(Main *bmain, Image *ima)
                        texture_changed(bmain, tex);
 }
 
+static void scene_changed(Main *bmain, Scene *sce)
+{
+       Object *ob;
+       Material *ma;
+
+       /* glsl */
+       for(ob=bmain->object.first; ob; ob=ob->id.next)
+               if(ob->gpulamp.first)
+                       GPU_lamp_free(ob);
+
+       for(ma=bmain->mat.first; ma; ma=ma->id.next)
+               if(ma->gpumaterial.first)
+                       GPU_material_free(ma);
+}
+
 void ED_render_id_flush_update(Main *bmain, ID *id)
 {
        if(!id)
@@ -234,6 +249,9 @@ void ED_render_id_flush_update(Main *bmain, ID *id)
                case ID_IM:
                        image_changed(bmain, (Image*)id);
                        break;
+               case ID_SCE:
+                       scene_changed(bmain, (Scene*)id);
+                       break;
                default:
                        break;
        }