Problem with Material drivers for nodes properties I'm following these instructions https://blender.stackexchange.com/a/75652 (paragraph "Setting drivers"), and also the video linked here https://blender.stackexchange.com/a/5384 video: https://vimeo.com/40389198, to understand how to implement a driver Texture Panner.  

I added a driver to a Mapping node translateY property by going to Datablock->Objects->Cube->Material Slots->Material.001->Material->Material.001->Node Tree->Nodes->Mapping->Location->Y, selecting Y and pressing D (note: right-clicking the property->Add Driver yields different results).  

The expression of the driver sets the Mapping translateY to frame_current * 0.05.  

The Debug value is ok and if I render the animation it works as expected.
However the viewport doesn't update the value for preview while scrolling frames.   

Is there a workaround to preview it (with scripting maybe?) ? 



Edit 1:


Reloaded the file which  had an incorrect texture 


This is the code snippet I used in 2.8 experimental. Since the drivers UI part hasn't been implemented yet, drivers can only be accessed with Python. It works in Cycles but not Eevee as of May 2018.  

For an approach which works in 2.79 check D. Skarn's answer.

import bpy

mydriver = bpy.data.objects["Cube"].material_slots["Material.001"].material.node_tree.nodes["Mapping"].driver_add('translation',1)

scn = bpy.data.scenes["Scene"]

def getframe_fn():
 return scn.frame_current

bpy.app.driver_namespace["getframe"] = getframe_fn
mydriver.driver.expression = 'getframe()*0.05'  


Thank you all for the help!
This is how I solved it in my addon. I made a property on materials specifying if I want to update that one live.

from bpy.app.handlers import persistent

@persistent
def live_update_materials(dummy):
    for mat in bpy.data.materials:
        if mat.wow_m2_material.LiveUpdate:
            mat.invert_z = mat.invert_z

bpy.app.handlers.frame_change_pre.append(live_update_materials)


This will reduce the animation playback FPS in the viewport, since the shader will be recompiled on every frame change. But it lets you preview the changes live and is not decreasing the FPS hard to on good hardware.