Event handling for Light Direction change

I am using GLSLShader to create some custom shading.
I would like to set up an event handler to watch the Light.Direction Property.
Whenever the Light.Direction changes, it should triggers a method I have.

How should I do it?

Thank you in advance.

        RhinoDoc.LightTableEvent += Utils.UpdateLightDirection;

I just tried this, but it doesn’t detect change/modification in Sun nor Skylight.

Will post my research if I know the answer.

EDIT: A further research shows there is actually a EventHandler for Sun

Rhino.Render.Sun.Changed += Utils.UpdateLightDirection;

This is how I solved the problem.

1 Like