Light related uniforms (GPU_DYNAMIC_LAMP... types etc) already have a reference to the according lamp object. With this patch I added the same for material related uniforms (GPU_DYNAMIC_MAT_...). This is needed for exporters that are accessing the uniforms via the python interface. I already tested it with an exented version of the X3D exporter, which i will submit via patches as well.
This is my first patch here, so excuse me if i file it in the wrong sections etc.