Get parameter value during compilation

I’ve been writing my own expression parameter node and I’ve ran into a problem. My node is based on the scalar parameter expression node. which allows it to be edited from the material instance editor. However I’m having trouble getting the overwritten value. My node overrides the Compile() method but I am only able to get the DefaultValue from the base material. I have tried casting the Material property of my expression to a UMaterialInstance but that cast always fails.

The only thing that might work is the FCompiler (in that case it’s the FHLSLMaterialTranslator) has a FMaterial property that is correctly set to the Material Instance when working with the instance. However this property is protected and inaccessible without modifying the source code. I’ve looked inside FCompiler for any function that might return the scalar parameter value but have found nothing so far.

If anyone has any other solution they would be greatly appreciated!