# How to reset OpenGl for Solid lighting?

I read the original Reset OpenGL lights, I understand, but I don't do Python. How would I "reset" my settings as shown? I've had trouble with these forever, so my Solid lighting as I work is bizarre. Even with a new startup they're kaflooey.

Added bonus: How to "put back" the settings I have now if I screw up?

• To see your current settings, Paste the first snippet into the text editor and press Run script. To reset to defaults, run the last snippet in the same fashion. To reset to the settings you printed before, replace the last three lines of the last snippet with the output of the first snippet and run it. – gandalf3 Jan 29 '15 at 4:42

You can print the current settings to a console with a simple script:

import bpy

def round_vec3(vec): return tuple(map(lambda c: round(c, 3), vec))

solid_lights = bpy.context.user_preferences.system.solid_lights

for i, light in enumerate(solid_lights):
print()
print("Light %i:" % i)
print("  Use:", light.use)
print("  Direction:", round_vec3(light.direction))
print("  Diffuse Color:", round_vec3(light.diffuse_color))
print("  Specular Color:", round_vec3(light.specular_color))


Based on the settings for solid lights in startup.blend, here's a script to reset your current settings to the defaults:

import bpy

lights = [
{
'use': True,
'direction': (-0.892, 0.3, 0.9),
'diffuse_color': (0.8, 0.8, 0.8),
'specular_color': (0.5, 0.5, 0.5)
},
{
'use': True,
'direction': (0.588, 0.46, 0.248),
'diffuse_color': (0.498, 0.5, 0.6),
'specular_color': (0.2, 0.2, 0.2)
},
{
'use': True,
'direction': (0.216, -0.392, -0.216),
'diffuse_color': (0.798, 0.838, 1.0),
'specular_color': (0.066, 0.0, 0.0)
}
]

solid_lights = bpy.context.user_preferences.system.solid_lights

for s, l in zip(solid_lights, lights):
for k, v in l.items():
setattr(s, k, v)


If you don't want to deal with Python, just install this addon version of the script and click the Reset Solid Lights button in the User Preferences header (where the Save settings button is) while you are on the System tab:

bl_info = {
"name": "Reset Solid Lights",
"author": "CoDEmanX",
"version": (1, 0),
"blender": (2, 65, 0),
"location": "User Preferences > System",
"description": "Reset OpenGL Solid Lights to factory defaults",
"warning": "",
"wiki_url": "",
"category": "User Interface"}

import bpy
from bpy.types import Operator

# OpenGL solid lights settings like in factory startup.blend
lights = [
{
'use': True,
'direction': (-0.892, 0.3, 0.9),
'diffuse_color': (0.8, 0.8, 0.8),
'specular_color': (0.5, 0.5, 0.5)
},
{
'use': True,
'direction': (0.588, 0.46, 0.248),
'diffuse_color': (0.498, 0.5, 0.6),
'specular_color': (0.2, 0.2, 0.2)
},
{
'use': True,
'direction': (0.216, -0.392, -0.216),
'diffuse_color': (0.798, 0.838, 1.0),
'specular_color': (0.066, 0.0, 0.0)
}
]

class WM_OT_solid_lights_reset(Operator):
__doc__ = bl_info["description"]
bl_label = bl_info["name"]
bl_idname = "wm.solid_lights_reset"
bl_options = {'REGISTER'}

def execute(self, context):

solid_lights = bpy.context.user_preferences.system.solid_lights

for s, l in zip(solid_lights, lights):
for k, v in l.items():
setattr(s, k, v)

return {'FINISHED'}

def userpref_button(self, context):
if context.user_preferences.active_section == 'SYSTEM':
self.layout.operator(WM_OT_solid_lights_reset.bl_idname)

def register():
bpy.utils.register_class(WM_OT_solid_lights_reset)

def unregister():
bpy.utils.unregister_class(WM_OT_solid_lights_reset)

if __name__ == "__main__":
register()

• Not sure, but it could be that the OP isn't looking for a python solution. They said that they had already read this post.. – gandalf3 Jan 29 '15 at 8:39
• Well, there's no alternative IMO. If you right-click and Reset to Default Value on the direction widgets, you'll end up with all directions set to Vector((0.0, 1.0, 0.0)). Colors reset to black. You probably don't want to create a new file derived from startup.blend to inherit the OpenGL solid light settings, then copy and paste all your stuff from the original .blend. – CodeManX Jan 29 '15 at 9:09
• Added addon version of script to reset solid lights. Copy, paste to text file and save as .py script. Install via User Preferences > Addon > Install from file and enable. A new button will show up when you are on the System tab. – CodeManX Jan 29 '15 at 9:29
• Using CoDEmanX .py script installed via UP>Addon>Install seems to have done the trick. Bravo! – NeverGiveUp Jan 29 '15 at 19:03
• There is also the quickPrefs in addons contrib that can change the GL lights to a list of presets including the default. – sambler Jan 30 '15 at 4:00

Have you tried changing these settings to get things looking the way you would like.

Click and drag over the spheres to change the light direction and click the color bars to activate a color selector popup.

• I did know about these, and in prior versions did change them. But I longed for a reset/default after fiddling with them. Thus I'm now all set. Thx. – NeverGiveUp Jan 30 '15 at 15:04