# Can I use viewport modes as driver variable?

I am using an addon that replaces the default world in blender, however it's hindering the viewport performance in solid mode for about 20-30% fps drop. Is there a way I could make the driver that would switch the addon off when I go to solid view and back on when I go into render view ? The Addon I'm using is called "Physical Starlight And Atmosphere" and it has a checkbox to enable and disable it in the "N" Tab. I'm pretty sure there is some way to put a line of code into the driver's variable to make it work, i just don't know much about coding at all.

• I'm pretty sure it can not be done via Drivers. Drivers suppose to get float or integer value from the data path and work with it, but viewport modes paths are represented as strings. More to say, viewport modes are not something constant, they are context-dependent. You may have several windows with different viewport modes simultaneously or no opened 3D VIEW window at all - so there's no way for the driver to know where from to get the data. It probably may be done by another add-on or by editing existing one, but I suspect it would be quite tricky to perform. Aug 8 '20 at 8:54

## 1 Answer

In 2.90, I can right-click on the viewport shading buttons and select "copy as new driver". Then I can right-click on a property and select "paste driver". So, it looks like the functionality exists. But, the variable (named shading.type) seems to always read as zero, so maybe the function doesn't actually work in this version.