diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-06-27 15:41:53 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-07-06 21:06:09 +0300 |
commit | 74fd17e9d788394fa5bf781bb3e60bca7617b22c (patch) | |
tree | a27bcd7e67f74cd0abfeb06b6b9f13e049d736f2 /release/scripts | |
parent | 4ac048f4e4ef1945fe085c3c0ebf263eb51d8d1b (diff) |
UI/Python: rename Lamps to Lights, to follow more standard terminology.
Internally it's still mostly named lamps, though some modules like Cycles
were already calling them lights.
Diffstat (limited to 'release/scripts')
37 files changed, 495 insertions, 538 deletions
diff --git a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py index bbeb1780355..1d3a0a23267 100644 --- a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py +++ b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py @@ -385,7 +385,7 @@ def dump_rna_messages(msgs, reports, settings, verbose=False): return def full_class_id(cls): - """Gives us 'ID.Lamp.AreaLamp' which is best for sorting.""" + """Gives us 'ID.Light.AreaLight' which is best for sorting.""" # Always the same issue, some classes listed in blacklist should actually no more exist (they have been # unregistered), but are still listed by __subclasses__() calls... :/ if cls in blacklist_rna_class: diff --git a/release/scripts/modules/bl_previews_utils/bl_previews_render.py b/release/scripts/modules/bl_previews_utils/bl_previews_render.py index 2efd6349d73..f2c766b2b2d 100644 --- a/release/scripts/modules/bl_previews_utils/bl_previews_render.py +++ b/release/scripts/modules/bl_previews_utils/bl_previews_render.py @@ -31,7 +31,7 @@ from mathutils import ( ) -INTERN_PREVIEW_TYPES = {'MATERIAL', 'LAMP', 'WORLD', 'TEXTURE', 'IMAGE'} +INTERN_PREVIEW_TYPES = {'MATERIAL', 'LIGHT', 'WORLD', 'TEXTURE', 'IMAGE'} OBJECT_TYPES_RENDER = {'MESH', 'CURVE', 'SURFACE', 'META', 'FONT'} @@ -73,15 +73,15 @@ def do_previews(do_objects, do_collections, do_scenes, do_data_intern): # Helpers. RenderContext = collections.namedtuple("RenderContext", ( - "scene", "world", "camera", "lamp", "camera_data", "lamp_data", "image", # All those are names! - "backup_scene", "backup_world", "backup_camera", "backup_lamp", "backup_camera_data", "backup_lamp_data", + "scene", "world", "camera", "light", "camera_data", "light_data", "image", # All those are names! + "backup_scene", "backup_world", "backup_camera", "backup_light", "backup_camera_data", "backup_light_data", )) RENDER_PREVIEW_SIZE = bpy.app.render_preview_size def render_context_create(engine, objects_ignored): if engine == '__SCENE': - backup_scene, backup_world, backup_camera, backup_lamp, backup_camera_data, backup_lamp_data = [()] * 6 + backup_scene, backup_world, backup_camera, backup_light, backup_camera_data, backup_light_data = [()] * 6 scene = bpy.context.screen.scene exclude_props = {('world',), ('camera',), ('tool_settings',), ('preview',)} backup_scene = tuple(rna_backup_gen(scene, exclude_props=exclude_props)) @@ -96,20 +96,20 @@ def do_previews(do_objects, do_collections, do_scenes, do_data_intern): camera.rotation_euler = Euler((1.1635528802871704, 0.0, 0.7853981852531433), 'XYZ') # (66.67, 0.0, 45.0) scene.camera = camera scene.objects.link(camera) - # TODO: add lamp if none found in scene? - lamp = None - lamp_data = None + # TODO: add light if none found in scene? + light = None + light_data = None else: - backup_scene, backup_world, backup_camera, backup_lamp, backup_camera_data, backup_lamp_data = [None] * 6 + backup_scene, backup_world, backup_camera, backup_light, backup_camera_data, backup_light_data = [None] * 6 scene = bpy.data.scenes.new("TEMP_preview_render_scene") world = bpy.data.worlds.new("TEMP_preview_render_world") camera_data = bpy.data.cameras.new("TEMP_preview_render_camera") camera = bpy.data.objects.new("TEMP_preview_render_camera", camera_data) - lamp_data = bpy.data.lamps.new("TEMP_preview_render_lamp", 'SPOT') - lamp = bpy.data.objects.new("TEMP_preview_render_lamp", lamp_data) + light_data = bpy.data.lights.new("TEMP_preview_render_light", 'SPOT') + light = bpy.data.objects.new("TEMP_preview_render_light", light_data) - objects_ignored.add((camera.name, lamp.name)) + objects_ignored.add((camera.name, light.name)) scene.world = world @@ -117,10 +117,10 @@ def do_previews(do_objects, do_collections, do_scenes, do_data_intern): scene.camera = camera scene.objects.link(camera) - lamp.rotation_euler = Euler((0.7853981852531433, 0.0, 1.7453292608261108), 'XYZ') # (45.0, 0.0, 100.0) - lamp_data.falloff_type = 'CONSTANT' - lamp_data.spot_size = 1.0471975803375244 # 60 - scene.objects.link(lamp) + light.rotation_euler = Euler((0.7853981852531433, 0.0, 1.7453292608261108), 'XYZ') # (45.0, 0.0, 100.0) + light_data.falloff_type = 'CONSTANT' + light_data.spot_size = 1.0471975803375244 # 60 + scene.objects.link(light) if engine == 'BLENDER_RENDER': scene.render.engine = 'BLENDER_RENDER' @@ -154,9 +154,9 @@ def do_previews(do_objects, do_collections, do_scenes, do_data_intern): image.filepath = scene.render.filepath return RenderContext( - scene.name, world.name if world else None, camera.name, lamp.name if lamp else None, - camera_data.name, lamp_data.name if lamp_data else None, image.name, - backup_scene, backup_world, backup_camera, backup_lamp, backup_camera_data, backup_lamp_data, + scene.name, world.name if world else None, camera.name, light.name if light else None, + camera_data.name, light_data.name if light_data else None, image.name, + backup_scene, backup_world, backup_camera, backup_light, backup_camera_data, backup_light_data, ) def render_context_delete(render_context): @@ -171,8 +171,8 @@ def do_previews(do_objects, do_collections, do_scenes, do_data_intern): scene.camera = None if render_context.camera: scene.objects.unlink(bpy.data.objects[render_context.camera, None]) - if render_context.lamp: - scene.objects.unlink(bpy.data.objects[render_context.lamp, None]) + if render_context.light: + scene.objects.unlink(bpy.data.objects[render_context.light, None]) bpy.data.scenes.remove(scene, do_unlink=True) scene = None else: @@ -213,18 +213,18 @@ def do_previews(do_objects, do_collections, do_scenes, do_data_intern): print("ERROR:", e) success = False - if render_context.lamp: + if render_context.light: try: - lamp = bpy.data.objects[render_context.lamp, None] - if render_context.backup_lamp is None: + light = bpy.data.objects[render_context.light, None] + if render_context.backup_light is None: if scene is not None: - scene.objects.unlink(lamp) - lamp.user_clear() - bpy.data.objects.remove(lamp) - bpy.data.lamps.remove(bpy.data.lamps[render_context.lamp_data, None]) + scene.objects.unlink(light) + light.user_clear() + bpy.data.objects.remove(light) + bpy.data.lights.remove(bpy.data.lights[render_context.light_data, None]) else: - rna_backup_restore(lamp, render_context.backup_lamp) - rna_backup_restore(bpy.data.lamps[render_context.lamp_data, None], render_context.backup_lamp_data) + rna_backup_restore(light, render_context.backup_light) + rna_backup_restore(bpy.data.lights[render_context.light_data, None], render_context.backup_light_data) except Exception as e: print("ERROR:", e) success = False @@ -305,7 +305,7 @@ def do_previews(do_objects, do_collections, do_scenes, do_data_intern): scene = bpy.data.scenes[render_context.scene, None] if objects is not None: camera = bpy.data.objects[render_context.camera, None] - lamp = bpy.data.objects[render_context.lamp, None] if render_context.lamp is not None else None + light = bpy.data.objects[render_context.light, None] if render_context.light is not None else None cos = objects_bbox_calc(camera, objects, offset_matrix) loc, ortho_scale = camera.camera_fit_coords(scene, cos) camera.location = loc @@ -320,9 +320,9 @@ def do_previews(do_objects, do_collections, do_scenes, do_data_intern): max_dist = dist camera.data.clip_start = min_dist / 2 camera.data.clip_end = max_dist * 2 - if lamp: - loc, ortho_scale = lamp.camera_fit_coords(scene, cos) - lamp.location = loc + if light: + loc, ortho_scale = light.camera_fit_coords(scene, cos) + light.location = loc scene.update() bpy.ops.render.render(write_still=True) diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index b14565e2a9a..c4bf8422d3f 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -61,7 +61,7 @@ class Library(bpy_types.ID): # we could make this an attribute in rna. attr_links = ("actions", "armatures", "brushes", "cameras", "curves", "grease_pencil", "collections", "images", - "lamps", "lattices", "materials", "metaballs", + "lights", "lattices", "materials", "metaballs", "meshes", "node_groups", "objects", "scenes", "sounds", "speakers", "textures", "texts", "fonts", "worlds") diff --git a/release/scripts/presets/interface_theme/24x_blues.xml b/release/scripts/presets/interface_theme/24x_blues.xml index 36cfeeb5980..18b866eeb0f 100644 --- a/release/scripts/presets/interface_theme/24x_blues.xml +++ b/release/scripts/presets/interface_theme/24x_blues.xml @@ -253,7 +253,7 @@ text_keyframe="#ddd700" camera="#000000" empty="#000000" - lamp="#00000028" + light="#00000028" speaker="#000000" vertex="#000000" vertex_select="#ff8500" diff --git a/release/scripts/presets/interface_theme/back_to_black.xml b/release/scripts/presets/interface_theme/back_to_black.xml index 1636f5b5cf6..464625d0ba5 100644 --- a/release/scripts/presets/interface_theme/back_to_black.xml +++ b/release/scripts/presets/interface_theme/back_to_black.xml @@ -253,7 +253,7 @@ text_keyframe="#ddd700" camera="#535353" empty="#535353" - lamp="#fff0d328" + light="#fff0d328" speaker="#535353" vertex="#72cfdd" vertex_select="#ff8500" diff --git a/release/scripts/presets/interface_theme/blender_24x.xml b/release/scripts/presets/interface_theme/blender_24x.xml index 818e557adf0..d0459e02115 100644 --- a/release/scripts/presets/interface_theme/blender_24x.xml +++ b/release/scripts/presets/interface_theme/blender_24x.xml @@ -244,7 +244,7 @@ gp_vertex="#000000" gp_vertex_select="#ff8500" gp_vertex_size="3" - lamp="#00000028" + light="#00000028" speaker="#000000" camera="#000000" view_overlay="#000000" diff --git a/release/scripts/presets/interface_theme/blender_27x.xml b/release/scripts/presets/interface_theme/blender_27x.xml index 6a78dd5fc8f..db9d042ae55 100644 --- a/release/scripts/presets/interface_theme/blender_27x.xml +++ b/release/scripts/presets/interface_theme/blender_27x.xml @@ -304,7 +304,7 @@ text_keyframe="#ddd700" camera="#000000" empty="#000000" - lamp="#00000028" + light="#00000028" speaker="#000000" vertex="#000000" vertex_select="#ff8500" diff --git a/release/scripts/presets/interface_theme/dark_blue_gradient.xml b/release/scripts/presets/interface_theme/dark_blue_gradient.xml index d226f8531b2..589aeab3a50 100644 --- a/release/scripts/presets/interface_theme/dark_blue_gradient.xml +++ b/release/scripts/presets/interface_theme/dark_blue_gradient.xml @@ -244,7 +244,7 @@ gp_vertex="#000000" gp_vertex_select="#ff8500" gp_vertex_size="3" - lamp="#00000028" + light="#00000028" speaker="#000000" camera="#000000" view_overlay="#000000" diff --git a/release/scripts/presets/interface_theme/default++.xml b/release/scripts/presets/interface_theme/default++.xml index 413fbc1aa71..3599a094381 100644 --- a/release/scripts/presets/interface_theme/default++.xml +++ b/release/scripts/presets/interface_theme/default++.xml @@ -253,7 +253,7 @@ text_keyframe="#ddd700" camera="#000000" empty="#000000" - lamp="#00000028" + light="#00000028" speaker="#000000" vertex="#000000" vertex_select="#ff8500" diff --git a/release/scripts/presets/interface_theme/elsyiun.xml b/release/scripts/presets/interface_theme/elsyiun.xml index b9292856fe9..51af13a6009 100644 --- a/release/scripts/presets/interface_theme/elsyiun.xml +++ b/release/scripts/presets/interface_theme/elsyiun.xml @@ -244,7 +244,7 @@ gp_vertex="#000000" gp_vertex_select="#ff8500" gp_vertex_size="3" - lamp="#00000028" + light="#00000028" speaker="#000000" camera="#000000" view_overlay="#000000" diff --git a/release/scripts/presets/interface_theme/flatty_light.xml b/release/scripts/presets/interface_theme/flatty_light.xml index bdcf381f8f9..497b6575731 100644 --- a/release/scripts/presets/interface_theme/flatty_light.xml +++ b/release/scripts/presets/interface_theme/flatty_light.xml @@ -304,7 +304,7 @@ text_keyframe="#ddd700" camera="#b3b3b3" empty="#b3b3b3" - lamp="#cccccc33" + light="#cccccc33" speaker="#b3b3b3" vertex="#000000" vertex_select="#ff8500" diff --git a/release/scripts/presets/interface_theme/graph.xml b/release/scripts/presets/interface_theme/graph.xml index a032d8bd3b2..904fcdf41ec 100644 --- a/release/scripts/presets/interface_theme/graph.xml +++ b/release/scripts/presets/interface_theme/graph.xml @@ -244,7 +244,7 @@ gp_vertex="#000000" gp_vertex_select="#ff8500" gp_vertex_size="3" - lamp="#00000028" + light="#00000028" speaker="#000000" camera="#8d8c8d" view_overlay="#000000" diff --git a/release/scripts/presets/interface_theme/hexagon.xml b/release/scripts/presets/interface_theme/hexagon.xml index 4b24abc5fa7..1ca52b76253 100644 --- a/release/scripts/presets/interface_theme/hexagon.xml +++ b/release/scripts/presets/interface_theme/hexagon.xml @@ -244,7 +244,7 @@ gp_vertex="#000000" gp_vertex_select="#ff8500" gp_vertex_size="3" - lamp="#00000028" + light="#00000028" speaker="#000000" camera="#000000" view_overlay="#000000" diff --git a/release/scripts/presets/interface_theme/modern_minimalist.xml b/release/scripts/presets/interface_theme/modern_minimalist.xml index 8ba9402ecdb..3b982514f4f 100644 --- a/release/scripts/presets/interface_theme/modern_minimalist.xml +++ b/release/scripts/presets/interface_theme/modern_minimalist.xml @@ -253,7 +253,7 @@ text_keyframe="#ddd700" camera="#8d8c8d" empty="#8d8c8d" - lamp="#8d8c8d40" + light="#8d8c8d40" speaker="#8d8c8d" vertex="#bfbfbf" vertex_select="#00bdff" diff --git a/release/scripts/presets/interface_theme/north.xml b/release/scripts/presets/interface_theme/north.xml index 69cb90a64ce..8ab51261994 100644 --- a/release/scripts/presets/interface_theme/north.xml +++ b/release/scripts/presets/interface_theme/north.xml @@ -253,7 +253,7 @@ text_keyframe="#ddd700" camera="#000000" empty="#000000" - lamp="#00000028" + light="#00000028" speaker="#000000" vertex="#000000" vertex_select="#f2b252" diff --git a/release/scripts/presets/interface_theme/rtheme.xml b/release/scripts/presets/interface_theme/rtheme.xml index 27f33aa2fe5..34d4f6bd0db 100644 --- a/release/scripts/presets/interface_theme/rtheme.xml +++ b/release/scripts/presets/interface_theme/rtheme.xml @@ -244,7 +244,7 @@ gp_vertex="#000000" gp_vertex_select="#ff8500" gp_vertex_size="3" - lamp="#00000028" + light="#00000028" speaker="#000000" camera="#000000" view_overlay="#000000" diff --git a/release/scripts/presets/interface_theme/sandyslate.xml b/release/scripts/presets/interface_theme/sandyslate.xml index c5bae419bca..0b4756a40e8 100644 --- a/release/scripts/presets/interface_theme/sandyslate.xml +++ b/release/scripts/presets/interface_theme/sandyslate.xml @@ -244,7 +244,7 @@ gp_vertex="#000000" gp_vertex_select="#ff8500" gp_vertex_size="3" - lamp="#ff000080" + light="#ff000080" speaker="#979797" camera="#ff0000" view_overlay="#000000" diff --git a/release/scripts/presets/interface_theme/science_lab.xml b/release/scripts/presets/interface_theme/science_lab.xml index 2fe4cf99e41..e8a32f6ac29 100644 --- a/release/scripts/presets/interface_theme/science_lab.xml +++ b/release/scripts/presets/interface_theme/science_lab.xml @@ -244,7 +244,7 @@ gp_vertex="#000000" gp_vertex_select="#ff8500" gp_vertex_size="3" - lamp="#dbac00b9" + light="#dbac00b9" speaker="#229cd8" camera="#e28400" view_overlay="#666666" diff --git a/release/scripts/presets/interface_theme/softblend.xml b/release/scripts/presets/interface_theme/softblend.xml index ab0a5994838..ce20f7d4085 100644 --- a/release/scripts/presets/interface_theme/softblend.xml +++ b/release/scripts/presets/interface_theme/softblend.xml @@ -244,7 +244,7 @@ gp_vertex="#000000" gp_vertex_select="#ff8500" gp_vertex_size="3" - lamp="#ffe56666" + light="#ffe56666" speaker="#c2e787" camera="#000000" view_overlay="#000000" diff --git a/release/scripts/presets/interface_theme/true_blue_menu.xml b/release/scripts/presets/interface_theme/true_blue_menu.xml index 2b464ae120e..26e39f3bcdf 100644 --- a/release/scripts/presets/interface_theme/true_blue_menu.xml +++ b/release/scripts/presets/interface_theme/true_blue_menu.xml @@ -253,7 +253,7 @@ text_keyframe="#ddd700" camera="#000000" empty="#a78721" - lamp="#d6df1628" + light="#d6df1628" speaker="#a83f2d" vertex="#657780" vertex_select="#00cccb" diff --git a/release/scripts/presets/sunsky/classic.py b/release/scripts/presets/sunsky/classic.py deleted file mode 100644 index edb065d553c..00000000000 --- a/release/scripts/presets/sunsky/classic.py +++ /dev/null @@ -1,14 +0,0 @@ -import bpy -bpy.context.lamp.sky.atmosphere_turbidity = 4.0 -bpy.context.lamp.sky.sky_blend_type = 'ADD' -bpy.context.lamp.sky.sky_blend = 1.0 -bpy.context.lamp.sky.horizon_brightness = 10.0 -bpy.context.lamp.sky.spread = 1.49011614159e-09 -bpy.context.lamp.sky.sky_color_space = 'SMPTE' -bpy.context.lamp.sky.sky_exposure = 1.0 -bpy.context.lamp.sky.sun_brightness = 1.00000011921 -bpy.context.lamp.sky.sun_size = 1.00000166893 -bpy.context.lamp.sky.backscattered_light = 0.0 -bpy.context.lamp.sky.sun_intensity = 4.0 -bpy.context.lamp.sky.atmosphere_inscattering = 1.0 -bpy.context.lamp.sky.atmosphere_extinction = 1.0 diff --git a/release/scripts/presets/sunsky/desert.py b/release/scripts/presets/sunsky/desert.py deleted file mode 100644 index 8dd587a6eaf..00000000000 --- a/release/scripts/presets/sunsky/desert.py +++ /dev/null @@ -1,14 +0,0 @@ -import bpy -bpy.context.lamp.sky.atmosphere_turbidity = 6.0 -bpy.context.lamp.sky.sky_blend_type = 'ADD' -bpy.context.lamp.sky.sky_blend = 1.0 -bpy.context.lamp.sky.horizon_brightness = 4.99999761581 -bpy.context.lamp.sky.spread = 1.49011614159e-09 -bpy.context.lamp.sky.sky_color_space = 'SMPTE' -bpy.context.lamp.sky.sky_exposure = 1.0 -bpy.context.lamp.sky.sun_brightness = 1.00000011921 -bpy.context.lamp.sky.sun_size = 4.0 -bpy.context.lamp.sky.backscattered_light = 1.0 -bpy.context.lamp.sky.sun_intensity = 1.0 -bpy.context.lamp.sky.atmosphere_inscattering = 1.0 -bpy.context.lamp.sky.atmosphere_extinction = 1.0 diff --git a/release/scripts/presets/sunsky/mountain.py b/release/scripts/presets/sunsky/mountain.py deleted file mode 100644 index f0540af8100..00000000000 --- a/release/scripts/presets/sunsky/mountain.py +++ /dev/null @@ -1,14 +0,0 @@ -import bpy -bpy.context.lamp.sky.atmosphere_turbidity = 2.00000023842 -bpy.context.lamp.sky.sky_blend_type = 'ADD' -bpy.context.lamp.sky.sky_blend = 1.0 -bpy.context.lamp.sky.horizon_brightness = 0.100000016391 -bpy.context.lamp.sky.spread = 1.0 -bpy.context.lamp.sky.sky_color_space = 'SMPTE' -bpy.context.lamp.sky.sky_exposure = 1.0 -bpy.context.lamp.sky.sun_brightness = 1.99999988079 -bpy.context.lamp.sky.sun_size = 4.0 -bpy.context.lamp.sky.backscattered_light = -1.0 -bpy.context.lamp.sky.sun_intensity = 10.0 -bpy.context.lamp.sky.atmosphere_inscattering = 1.0 -bpy.context.lamp.sky.atmosphere_extinction = 1.0 diff --git a/release/scripts/startup/bl_operators/anim.py b/release/scripts/startup/bl_operators/anim.py index 250c88b9009..d898239d7a9 100644 --- a/release/scripts/startup/bl_operators/anim.py +++ b/release/scripts/startup/bl_operators/anim.py @@ -110,7 +110,7 @@ class ANIM_OT_keying_set_export(Operator): # - special handling is needed for "nested" ID-blocks # (e.g. nodetree in Material) if ksp.id.bl_rna.identifier.startswith("ShaderNodeTree"): - # Find material or lamp using this node tree... + # Find material or light using this node tree... id_bpy_path = "bpy.data.nodes[\"%s\"]" found = False @@ -121,14 +121,14 @@ class ANIM_OT_keying_set_export(Operator): break if not found: - for lamp in bpy.data.lamps: - if lamp.node_tree == ksp.id: - id_bpy_path = "bpy.data.lamps[\"%s\"].node_tree" % (lamp.name) + for light in bpy.data.lights: + if light.node_tree == ksp.id: + id_bpy_path = "bpy.data.lights[\"%s\"].node_tree" % (light.name) found = True break if not found: - self.report({'WARN'}, "Could not find material or lamp using Shader Node Tree - %s" % (ksp.id)) + self.report({'WARN'}, "Could not find material or light using Shader Node Tree - %s" % (ksp.id)) elif ksp.id.bl_rna.identifier.startswith("CompositorNodeTree"): # Find compositor nodetree using this node tree... for scene in bpy.data.scenes: diff --git a/release/scripts/startup/bl_operators/clip.py b/release/scripts/startup/bl_operators/clip.py index 5f3075b403f..95c4bbbfba9 100644 --- a/release/scripts/startup/bl_operators/clip.py +++ b/release/scripts/startup/bl_operators/clip.py @@ -915,17 +915,17 @@ class CLIP_OT_setup_tracking_scene(Operator): return [(layers_a[i] | layers_b[i]) for i in range(len(layers_a))] @staticmethod - def _createLamp(scene): - lamp = bpy.data.lamps.new(name="Lamp", type='POINT') - lampob = bpy.data.objects.new(name="Lamp", object_data=lamp) - scene.objects.link(lampob) + def _createLight(scene): + light = bpy.data.lights.new(name="Light", type='POINT') + lightob = bpy.data.objects.new(name="Light", object_data=light) + scene.objects.link(lightob) - lampob.matrix_local = Matrix.Translation((4.076, 1.005, 5.904)) + lightob.matrix_local = Matrix.Translation((4.076, 1.005, 5.904)) - lamp.distance = 30 - lamp.shadow_method = 'RAY_SHADOW' + light.distance = 30 + light.shadow_method = 'RAY_SHADOW' - return lampob + return lightob def _createSampleObject(self, scene): vertices = self._getPlaneVertices(1.0, -1.0) + \ @@ -947,20 +947,20 @@ class CLIP_OT_setup_tracking_scene(Operator): all_layers = self._mergeLayers(fg.layers, bg.layers) - # ensure all lamps are active on foreground and background - has_lamp = False + # ensure all lights are active on foreground and background + has_light = False has_mesh = False for ob in scene.objects: - if ob.type == 'LAMP': + if ob.type == 'LIGHT': ob.layers = all_layers - has_lamp = True + has_light = True elif ob.type == 'MESH' and "is_ground" not in ob: has_mesh = True - # create sample lamp if there's no lamps in the scene - if not has_lamp: - lamp = self._createLamp(scene) - lamp.layers = all_layers + # create sample light if there's no lights in the scene + if not has_light: + light = self._createLight(scene) + light.layers = all_layers # create sample object if there's no meshes in the scene if not has_mesh: diff --git a/release/scripts/startup/bl_ui/__init__.py b/release/scripts/startup/bl_ui/__init__.py index da9054fb681..51ba45cdcd7 100644 --- a/release/scripts/startup/bl_ui/__init__.py +++ b/release/scripts/startup/bl_ui/__init__.py @@ -34,7 +34,7 @@ _modules = [ "properties_data_camera", "properties_data_curve", "properties_data_empty", - "properties_data_lamp", + "properties_data_light", "properties_data_lattice", "properties_data_mesh", "properties_data_metaball", diff --git a/release/scripts/startup/bl_ui/properties_data_lamp.py b/release/scripts/startup/bl_ui/properties_data_lamp.py deleted file mode 100644 index d613967584c..00000000000 --- a/release/scripts/startup/bl_ui/properties_data_lamp.py +++ /dev/null @@ -1,363 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy -from bpy.types import Menu, Panel -from rna_prop_ui import PropertyPanel - - -class DataButtonsPanel: - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - bl_context = "data" - - @classmethod - def poll(cls, context): - engine = context.engine - return context.lamp and (engine in cls.COMPAT_ENGINES) - - -class DATA_PT_context_lamp(DataButtonsPanel, Panel): - bl_label = "" - bl_options = {'HIDE_HEADER'} - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'} - - def draw(self, context): - layout = self.layout - - ob = context.object - lamp = context.lamp - space = context.space_data - - split = layout.split(percentage=0.65) - - if ob: - split.template_ID(ob, "data") - elif lamp: - split.template_ID(space, "pin_id") - - -class DATA_PT_preview(DataButtonsPanel, Panel): - bl_label = "Preview" - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'} - - def draw(self, context): - self.layout.template_preview(context.lamp) - - -class DATA_PT_lamp(DataButtonsPanel, Panel): - bl_label = "Lamp" - COMPAT_ENGINES = {'BLENDER_RENDER'} - - def draw(self, context): - layout = self.layout - - lamp = context.lamp - - layout.row().prop(lamp, "type", expand=True) - - layout.use_property_split = True - - col = col.column() - col.prop(lamp, "color") - col.prop(lamp, "energy") - - if lamp.type in {'POINT', 'SPOT'}: - - col = col.column() - col.label(text="Falloff") - col.prop(lamp, "falloff_type") - col.prop(lamp, "distance") - col.prop(lamp, "shadow_soft_size") - - if lamp.falloff_type == 'LINEAR_QUADRATIC_WEIGHTED': - sub = col.column(align=True) - sub.prop(lamp, "linear_attenuation", slider=True, text="Linear") - sub.prop(lamp, "quadratic_attenuation", slider=True, text="Quadratic") - - elif lamp.falloff_type == 'INVERSE_COEFFICIENTS': - col.label(text="Inverse Coefficients") - sub = col.column(align=True) - sub.prop(lamp, "constant_coefficient", text="Constant") - sub.prop(lamp, "linear_coefficient", text="Linear") - sub.prop(lamp, "quadratic_coefficient", text="Quadratic") - - if lamp.type == 'AREA': - col.prop(lamp, "distance") - - col = split.column() - col.label() - - -class DATA_PT_EEVEE_lamp(DataButtonsPanel, Panel): - bl_label = "Lamp" - COMPAT_ENGINES = {'BLENDER_EEVEE'} - - def draw(self, context): - layout = self.layout - lamp = context.lamp - - layout.row().prop(lamp, "type", expand=True) - - layout.use_property_split = True - - col = layout.column() - col.prop(lamp, "color") - col.prop(lamp, "energy") - col.prop(lamp, "specular_factor", text="Specular") - - col.separator() - - if lamp.type in {'POINT', 'SPOT', 'SUN'}: - col.prop(lamp, "shadow_soft_size", text="Radius") - elif lamp.type == 'AREA': - col.prop(lamp, "shape") - - sub = col.column(align=True) - - if lamp.shape in {'SQUARE', 'DISK'}: - sub.prop(lamp, "size") - elif lamp.shape in {'RECTANGLE', 'ELLIPSE'}: - sub.prop(lamp, "size", text="Size X") - sub.prop(lamp, "size_y", text="Y") - - -class DATA_PT_EEVEE_shadow(DataButtonsPanel, Panel): - bl_label = "Shadow" - COMPAT_ENGINES = {'BLENDER_EEVEE'} - - @classmethod - def poll(cls, context): - lamp = context.lamp - engine = context.engine - return (lamp and lamp.type in {'POINT', 'SUN', 'SPOT', 'AREA'}) and (engine in cls.COMPAT_ENGINES) - - def draw_header(self, context): - lamp = context.lamp - self.layout.prop(lamp, "use_shadow", text="") - - def draw(self, context): - layout = self.layout - layout.use_property_split = True - - lamp = context.lamp - - layout.active = lamp.use_shadow - - col = layout.column() - sub = col.column(align=True) - sub.prop(lamp, "shadow_buffer_clip_start", text="Clip Start") - sub.prop(lamp, "shadow_buffer_clip_end", text="End") - - col.prop(lamp, "shadow_buffer_soft", text="Softness") - - col.separator() - - col.prop(lamp, "shadow_buffer_bias", text="Bias") - col.prop(lamp, "shadow_buffer_exp", text="Exponent") - col.prop(lamp, "shadow_buffer_bleed_bias", text="Bleed Bias") - - -class DATA_PT_EEVEE_shadow_cascaded_shadow_map(DataButtonsPanel, Panel): - bl_label = "Cascaded Shadow Map" - bl_parent_id = "DATA_PT_EEVEE_shadow" - bl_options = {'DEFAULT_CLOSED'} - COMPAT_ENGINES = {'BLENDER_EEVEE'} - - @classmethod - def poll(cls, context): - lamp = context.lamp - engine = context.engine - - return (lamp and lamp.type == 'SUN') and (engine in cls.COMPAT_ENGINES) - - def draw(self, context): - layout = self.layout - lamp = context.lamp - layout.use_property_split = True - - col = layout.column() - - col.prop(lamp, "shadow_cascade_count", text="Count") - col.prop(lamp, "shadow_cascade_fade", text="Fade") - - col.prop(lamp, "shadow_cascade_max_distance", text="Max Distance") - col.prop(lamp, "shadow_cascade_exponent", text="Distribution") - - -class DATA_PT_EEVEE_shadow_contact(DataButtonsPanel, Panel): - bl_label = "Contact Shadows" - bl_parent_id = "DATA_PT_EEVEE_shadow" - COMPAT_ENGINES = {'BLENDER_EEVEE'} - - @classmethod - def poll(cls, context): - lamp = context.lamp - engine = context.engine - return (lamp and lamp.type in {'POINT', 'SUN', 'SPOT', 'AREA'}) and (engine in cls.COMPAT_ENGINES) - - def draw_header(self, context): - lamp = context.lamp - - layout = self.layout - layout.active = lamp.use_shadow - layout.prop(lamp, "use_contact_shadow", text="") - - def draw(self, context): - layout = self.layout - lamp = context.lamp - layout.use_property_split = True - - col = layout.column() - col.active = lamp.use_shadow and lamp.use_contact_shadow - - col.prop(lamp, "contact_shadow_distance", text="Distance") - col.prop(lamp, "contact_shadow_soft_size", text="Softness") - col.prop(lamp, "contact_shadow_bias", text="Bias") - col.prop(lamp, "contact_shadow_thickness", text="Thickness") - - -class DATA_PT_area(DataButtonsPanel, Panel): - bl_label = "Area Shape" - COMPAT_ENGINES = {'BLENDER_RENDER'} - - @classmethod - def poll(cls, context): - lamp = context.lamp - engine = context.engine - return (lamp and lamp.type == 'AREA') and (engine in cls.COMPAT_ENGINES) - - def draw(self, context): - layout = self.layout - - lamp = context.lamp - - col = layout.column() - col.row().prop(lamp, "shape", expand=True) - sub = col.row(align=True) - - if lamp.shape in {'SQUARE', 'DISK'}: - sub.prop(lamp, "size") - elif lamp.shape in {'RECTANGLE', 'ELLIPSE'}: - sub.prop(lamp, "size", text="Size X") - sub.prop(lamp, "size_y", text="Size Y") - - -class DATA_PT_spot(DataButtonsPanel, Panel): - bl_label = "Spot Shape" - COMPAT_ENGINES = {'BLENDER_RENDER'} - - @classmethod - def poll(cls, context): - lamp = context.lamp - engine = context.engine - return (lamp and lamp.type == 'SPOT') and (engine in cls.COMPAT_ENGINES) - - def draw(self, context): - layout = self.layout - - lamp = context.lamp - - split = layout.split() - - col = split.column() - sub = col.column() - sub.prop(lamp, "spot_size", text="Size") - sub.prop(lamp, "spot_blend", text="Blend", slider=True) - col.prop(lamp, "use_square") - col.prop(lamp, "show_cone") - - col = split.column() - - col.active = (lamp.shadow_method != 'BUFFER_SHADOW' or lamp.shadow_buffer_type != 'DEEP') - col.prop(lamp, "use_halo") - sub = col.column(align=True) - sub.active = lamp.use_halo - sub.prop(lamp, "halo_intensity", text="Intensity") - if lamp.shadow_method == 'BUFFER_SHADOW': - sub.prop(lamp, "halo_step", text="Step") - - -class DATA_PT_spot(DataButtonsPanel, Panel): - bl_label = "Spot Shape" - bl_parent_id = "DATA_PT_EEVEE_lamp" - COMPAT_ENGINES = {'BLENDER_EEVEE'} - - @classmethod - def poll(cls, context): - lamp = context.lamp - engine = context.engine - return (lamp and lamp.type == 'SPOT') and (engine in cls.COMPAT_ENGINES) - - def draw(self, context): - layout = self.layout - layout.use_property_split = True - - lamp = context.lamp - - col = layout.column() - - col.prop(lamp, "spot_size", text="Size") - col.prop(lamp, "spot_blend", text="Blend", slider=True) - - col.prop(lamp, "show_cone") - - -class DATA_PT_falloff_curve(DataButtonsPanel, Panel): - bl_label = "Falloff Curve" - bl_options = {'DEFAULT_CLOSED'} - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'} - - @classmethod - def poll(cls, context): - lamp = context.lamp - engine = context.engine - - return (lamp and lamp.type in {'POINT', 'SPOT'} and lamp.falloff_type == 'CUSTOM_CURVE') and (engine in cls.COMPAT_ENGINES) - - def draw(self, context): - lamp = context.lamp - - self.layout.template_curve_mapping(lamp, "falloff_curve", use_negative_slope=True) - - -class DATA_PT_custom_props_lamp(DataButtonsPanel, PropertyPanel, Panel): - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'} - _context_path = "object.data" - _property_type = bpy.types.Lamp - - -classes = ( - DATA_PT_context_lamp, - DATA_PT_preview, - DATA_PT_lamp, - DATA_PT_EEVEE_lamp, - DATA_PT_EEVEE_shadow, - DATA_PT_EEVEE_shadow_contact, - DATA_PT_EEVEE_shadow_cascaded_shadow_map, - DATA_PT_area, - DATA_PT_spot, - DATA_PT_falloff_curve, - DATA_PT_custom_props_lamp, -) - -if __name__ == "__main__": # only for live edit. - from bpy.utils import register_class - for cls in classes: - register_class(cls) diff --git a/release/scripts/startup/bl_ui/properties_data_light.py b/release/scripts/startup/bl_ui/properties_data_light.py new file mode 100644 index 00000000000..057f7dffce0 --- /dev/null +++ b/release/scripts/startup/bl_ui/properties_data_light.py @@ -0,0 +1,363 @@ +# ##### BEGIN GPL LICENSE BLOCK ##### +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# ##### END GPL LICENSE BLOCK ##### + +# <pep8 compliant> +import bpy +from bpy.types import Menu, Panel +from rna_prop_ui import PropertyPanel + + +class DataButtonsPanel: + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "data" + + @classmethod + def poll(cls, context): + engine = context.engine + return context.light and (engine in cls.COMPAT_ENGINES) + + +class DATA_PT_context_light(DataButtonsPanel, Panel): + bl_label = "" + bl_options = {'HIDE_HEADER'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'} + + def draw(self, context): + layout = self.layout + + ob = context.object + light = context.light + space = context.space_data + + split = layout.split(percentage=0.65) + + if ob: + split.template_ID(ob, "data") + elif light: + split.template_ID(space, "pin_id") + + +class DATA_PT_preview(DataButtonsPanel, Panel): + bl_label = "Preview" + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'} + + def draw(self, context): + self.layout.template_preview(context.light) + + +class DATA_PT_light(DataButtonsPanel, Panel): + bl_label = "Light" + COMPAT_ENGINES = {'BLENDER_RENDER'} + + def draw(self, context): + layout = self.layout + + light = context.light + + layout.row().prop(light, "type", expand=True) + + layout.use_property_split = True + + col = col.column() + col.prop(light, "color") + col.prop(light, "energy") + + if light.type in {'POINT', 'SPOT'}: + + col = col.column() + col.label(text="Falloff") + col.prop(light, "falloff_type") + col.prop(light, "distance") + col.prop(light, "shadow_soft_size") + + if light.falloff_type == 'LINEAR_QUADRATIC_WEIGHTED': + sub = col.column(align=True) + sub.prop(light, "linear_attenuation", slider=True, text="Linear") + sub.prop(light, "quadratic_attenuation", slider=True, text="Quadratic") + + elif light.falloff_type == 'INVERSE_COEFFICIENTS': + col.label(text="Inverse Coefficients") + sub = col.column(align=True) + sub.prop(light, "constant_coefficient", text="Constant") + sub.prop(light, "linear_coefficient", text="Linear") + sub.prop(light, "quadratic_coefficient", text="Quadratic") + + if light.type == 'AREA': + col.prop(light, "distance") + + col = split.column() + col.label() + + +class DATA_PT_EEVEE_light(DataButtonsPanel, Panel): + bl_label = "Light" + COMPAT_ENGINES = {'BLENDER_EEVEE'} + + def draw(self, context): + layout = self.layout + light = context.light + + layout.row().prop(light, "type", expand=True) + + layout.use_property_split = True + + col = layout.column() + col.prop(light, "color") + col.prop(light, "energy") + col.prop(light, "specular_factor", text="Specular") + + col.separator() + + if light.type in {'POINT', 'SPOT', 'SUN'}: + col.prop(light, "shadow_soft_size", text="Radius") + elif light.type == 'AREA': + col.prop(light, "shape") + + sub = col.column(align=True) + + if light.shape in {'SQUARE', 'DISK'}: + sub.prop(light, "size") + elif light.shape in {'RECTANGLE', 'ELLIPSE'}: + sub.prop(light, "size", text="Size X") + sub.prop(light, "size_y", text="Y") + + +class DATA_PT_EEVEE_shadow(DataButtonsPanel, Panel): + bl_label = "Shadow" + COMPAT_ENGINES = {'BLENDER_EEVEE'} + + @classmethod + def poll(cls, context): + light = context.light + engine = context.engine + return (light and light.type in {'POINT', 'SUN', 'SPOT', 'AREA'}) and (engine in cls.COMPAT_ENGINES) + + def draw_header(self, context): + light = context.light + self.layout.prop(light, "use_shadow", text="") + + def draw(self, context): + layout = self.layout + layout.use_property_split = True + + light = context.light + + layout.active = light.use_shadow + + col = layout.column() + sub = col.column(align=True) + sub.prop(light, "shadow_buffer_clip_start", text="Clip Start") + sub.prop(light, "shadow_buffer_clip_end", text="End") + + col.prop(light, "shadow_buffer_soft", text="Softness") + + col.separator() + + col.prop(light, "shadow_buffer_bias", text="Bias") + col.prop(light, "shadow_buffer_exp", text="Exponent") + col.prop(light, "shadow_buffer_bleed_bias", text="Bleed Bias") + + +class DATA_PT_EEVEE_shadow_cascaded_shadow_map(DataButtonsPanel, Panel): + bl_label = "Cascaded Shadow Map" + bl_parent_id = "DATA_PT_EEVEE_shadow" + bl_options = {'DEFAULT_CLOSED'} + COMPAT_ENGINES = {'BLENDER_EEVEE'} + + @classmethod + def poll(cls, context): + light = context.light + engine = context.engine + + return (light and light.type == 'SUN') and (engine in cls.COMPAT_ENGINES) + + def draw(self, context): + layout = self.layout + light = context.light + layout.use_property_split = True + + col = layout.column() + + col.prop(light, "shadow_cascade_count", text="Count") + col.prop(light, "shadow_cascade_fade", text="Fade") + + col.prop(light, "shadow_cascade_max_distance", text="Max Distance") + col.prop(light, "shadow_cascade_exponent", text="Distribution") + + +class DATA_PT_EEVEE_shadow_contact(DataButtonsPanel, Panel): + bl_label = "Contact Shadows" + bl_parent_id = "DATA_PT_EEVEE_shadow" + COMPAT_ENGINES = {'BLENDER_EEVEE'} + + @classmethod + def poll(cls, context): + light = context.light + engine = context.engine + return (light and light.type in {'POINT', 'SUN', 'SPOT', 'AREA'}) and (engine in cls.COMPAT_ENGINES) + + def draw_header(self, context): + light = context.light + + layout = self.layout + layout.active = light.use_shadow + layout.prop(light, "use_contact_shadow", text="") + + def draw(self, context): + layout = self.layout + light = context.light + layout.use_property_split = True + + col = layout.column() + col.active = light.use_shadow and light.use_contact_shadow + + col.prop(light, "contact_shadow_distance", text="Distance") + col.prop(light, "contact_shadow_soft_size", text="Softness") + col.prop(light, "contact_shadow_bias", text="Bias") + col.prop(light, "contact_shadow_thickness", text="Thickness") + + +class DATA_PT_area(DataButtonsPanel, Panel): + bl_label = "Area Shape" + COMPAT_ENGINES = {'BLENDER_RENDER'} + + @classmethod + def poll(cls, context): + light = context.light + engine = context.engine + return (light and light.type == 'AREA') and (engine in cls.COMPAT_ENGINES) + + def draw(self, context): + layout = self.layout + + light = context.light + + col = layout.column() + col.row().prop(light, "shape", expand=True) + sub = col.row(align=True) + + if light.shape in {'SQUARE', 'DISK'}: + sub.prop(light, "size") + elif light.shape in {'RECTANGLE', 'ELLIPSE'}: + sub.prop(light, "size", text="Size X") + sub.prop(light, "size_y", text="Size Y") + + +class DATA_PT_spot(DataButtonsPanel, Panel): + bl_label = "Spot Shape" + COMPAT_ENGINES = {'BLENDER_RENDER'} + + @classmethod + def poll(cls, context): + light = context.light + engine = context.engine + return (light and light.type == 'SPOT') and (engine in cls.COMPAT_ENGINES) + + def draw(self, context): + layout = self.layout + + light = context.light + + split = layout.split() + + col = split.column() + sub = col.column() + sub.prop(light, "spot_size", text="Size") + sub.prop(light, "spot_blend", text="Blend", slider=True) + col.prop(light, "use_square") + col.prop(light, "show_cone") + + col = split.column() + + col.active = (light.shadow_method != 'BUFFER_SHADOW' or light.shadow_buffer_type != 'DEEP') + col.prop(light, "use_halo") + sub = col.column(align=True) + sub.active = light.use_halo + sub.prop(light, "halo_intensity", text="Intensity") + if light.shadow_method == 'BUFFER_SHADOW': + sub.prop(light, "halo_step", text="Step") + + +class DATA_PT_spot(DataButtonsPanel, Panel): + bl_label = "Spot Shape" + bl_parent_id = "DATA_PT_EEVEE_light" + COMPAT_ENGINES = {'BLENDER_EEVEE'} + + @classmethod + def poll(cls, context): + light = context.light + engine = context.engine + return (light and light.type == 'SPOT') and (engine in cls.COMPAT_ENGINES) + + def draw(self, context): + layout = self.layout + layout.use_property_split = True + + light = context.light + + col = layout.column() + + col.prop(light, "spot_size", text="Size") + col.prop(light, "spot_blend", text="Blend", slider=True) + + col.prop(light, "show_cone") + + +class DATA_PT_falloff_curve(DataButtonsPanel, Panel): + bl_label = "Falloff Curve" + bl_options = {'DEFAULT_CLOSED'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'} + + @classmethod + def poll(cls, context): + light = context.light + engine = context.engine + + return (light and light.type in {'POINT', 'SPOT'} and light.falloff_type == 'CUSTOM_CURVE') and (engine in cls.COMPAT_ENGINES) + + def draw(self, context): + light = context.light + + self.layout.template_curve_mapping(light, "falloff_curve", use_negative_slope=True) + + +class DATA_PT_custom_props_light(DataButtonsPanel, PropertyPanel, Panel): + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'} + _context_path = "object.data" + _property_type = bpy.types.Light + + +classes = ( + DATA_PT_context_light, + DATA_PT_preview, + DATA_PT_light, + DATA_PT_EEVEE_light, + DATA_PT_EEVEE_shadow, + DATA_PT_EEVEE_shadow_contact, + DATA_PT_EEVEE_shadow_cascaded_shadow_map, + DATA_PT_area, + DATA_PT_spot, + DATA_PT_falloff_curve, + DATA_PT_custom_props_light, +) + +if __name__ == "__main__": # only for live edit. + from bpy.utils import register_class + for cls in classes: + register_class(cls) diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py b/release/scripts/startup/bl_ui/space_dopesheet.py index 93fbc7799bf..92022e019cc 100644 --- a/release/scripts/startup/bl_ui/space_dopesheet.py +++ b/release/scripts/startup/bl_ui/space_dopesheet.py @@ -132,8 +132,8 @@ class DopesheetFilterPopoverBase: flow.prop(dopesheet, "show_cameras", text="Cameras") if bpy.data.grease_pencil: flow.prop(dopesheet, "show_gpencil", text="Grease Pencil Objects") - if bpy.data.lamps: - flow.prop(dopesheet, "show_lamps", text="Lamps") + if bpy.data.lights: + flow.prop(dopesheet, "show_lights", text="Lights") if bpy.data.materials: flow.prop(dopesheet, "show_materials", text="Materials") if bpy.data.textures: diff --git a/release/scripts/startup/bl_ui/space_node.py b/release/scripts/startup/bl_ui/space_node.py index 3960f336cd0..9d8c14ba9c3 100644 --- a/release/scripts/startup/bl_ui/space_node.py +++ b/release/scripts/startup/bl_ui/space_node.py @@ -61,7 +61,7 @@ class NODE_HT_header(Header): NODE_MT_editor_menus.draw_collapsible(context, layout) # No shader nodes for Eevee lamps - if snode_id and not (context.engine == 'BLENDER_EEVEE' and ob.type == 'LAMP'): + if snode_id and not (context.engine == 'BLENDER_EEVEE' and ob.type == 'LIGHT'): row = layout.row() row.prop(snode_id, "use_nodes") @@ -73,12 +73,11 @@ class NODE_HT_header(Header): # Show material.new when no active ID/slot exists if not id_from and ob.type in {'MESH', 'CURVE', 'SURFACE', 'FONT', 'METABALL'}: row.template_ID(ob, "active_material", new="material.new") - # Material ID, but not for Lamps - if id_from and ob.type != 'LAMP': + # Material ID, but not for Lights + if id_from and ob.type != 'LIGHT': row.template_ID(id_from, "active_material", new="material.new") if snode.shader_type == 'WORLD': - NODE_MT_editor_menus.draw_collapsible(context, layout) if snode_id: diff --git a/release/scripts/startup/bl_ui/space_outliner.py b/release/scripts/startup/bl_ui/space_outliner.py index f19b0304afa..37a5804f12c 100644 --- a/release/scripts/startup/bl_ui/space_outliner.py +++ b/release/scripts/startup/bl_ui/space_outliner.py @@ -270,8 +270,8 @@ class OUTLINER_PT_filter(Panel): sub.prop(space, "use_filter_object_mesh", text="Meshes", icon="MESH_DATA") if bpy.data.armatures: sub.prop(space, "use_filter_object_armature", text="Armatures", icon="ARMATURE_DATA") - if bpy.data.lamps: - sub.prop(space, "use_filter_object_lamp", text="Lamps", icon="LAMP_DATA") + if bpy.data.lights: + sub.prop(space, "use_filter_object_light", text="Lights", icon="LIGHT_DATA") if bpy.data.cameras: sub.prop(space, "use_filter_object_camera", text="Cameras", icon="CAMERA_DATA") diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 1f00f8af1ff..8d560ff8815 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -28,23 +28,23 @@ from bpy.app.translations import pgettext_iface as iface_ from bpy.app.translations import contexts as i18n_contexts -def opengl_lamp_buttons(column, lamp): +def opengl_light_buttons(column, light): split = column.row() - split.prop(lamp, "use", text="", icon='OUTLINER_OB_LAMP' if lamp.use else 'LAMP_DATA') + split.prop(light, "use", text="", icon='OUTLINER_OB_LIGHT' if light.use else 'LIGHT_DATA') col = split.column() - col.active = lamp.use + col.active = light.use row = col.row() row.label(text="Diffuse:") - row.prop(lamp, "diffuse_color", text="") + row.prop(light, "diffuse_color", text="") row = col.row() row.label(text="Specular:") - row.prop(lamp, "specular_color", text="") + row.prop(light, "specular_color", text="") col = split.column() - col.active = lamp.use - col.prop(lamp, "direction", text="") + col.active = light.use + col.prop(light, "direction", text="") class USERPREF_HT_header(Header): @@ -454,7 +454,7 @@ class USERPREF_PT_edit(Panel): col.prop(edit, "use_duplicate_text", text="Text") col.prop(edit, "use_duplicate_metaball", text="Metaball") col.prop(edit, "use_duplicate_armature", text="Armature") - col.prop(edit, "use_duplicate_lamp", text="Lamp") + col.prop(edit, "use_duplicate_light", text="Light") col.prop(edit, "use_duplicate_material", text="Material") col.prop(edit, "use_duplicate_texture", text="Texture") #col.prop(edit, "use_duplicate_fcurve", text="F-Curve") @@ -580,14 +580,14 @@ class USERPREF_PT_system(Panel): split.label(text="Colors:") split.label(text="Direction:") - lamp = system.solid_lights[0] - opengl_lamp_buttons(column, lamp) + light = system.solid_lights[0] + opengl_light_buttons(column, light) - lamp = system.solid_lights[1] - opengl_lamp_buttons(column, lamp) + light = system.solid_lights[1] + opengl_light_buttons(column, light) - lamp = system.solid_lights[2] - opengl_lamp_buttons(column, lamp) + light = system.solid_lights[2] + opengl_light_buttons(column, light) column.separator() diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 4dfc9a9129b..ce764ef98c7 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -1399,15 +1399,15 @@ class INFO_MT_armature_add(Menu): layout.operator("object.armature_add", text="Single Bone", icon='BONE_DATA') -class INFO_MT_lamp_add(Menu): - bl_idname = "INFO_MT_lamp_add" - bl_label = "Lamp" +class INFO_MT_light_add(Menu): + bl_idname = "INFO_MT_light_add" + bl_label = "Light" def draw(self, context): layout = self.layout layout.operator_context = 'INVOKE_REGION_WIN' - layout.operator_enum("object.lamp_add", "type") + layout.operator_enum("object.light_add", "type") class INFO_MT_lightprobe_add(Menu): @@ -1467,7 +1467,7 @@ class INFO_MT_add(Menu): else: INFO_MT_camera_add.draw(self, context) - layout.menu("INFO_MT_lamp_add", icon='OUTLINER_OB_LAMP') + layout.menu("INFO_MT_light_add", icon='OUTLINER_OB_LIGHT') layout.separator() layout.menu("INFO_MT_lightprobe_add", icon='OUTLINER_OB_LIGHTPROBE') layout.separator() @@ -1739,14 +1739,14 @@ class VIEW3D_MT_object_specials(Menu): props.input_scale = 0.01 props.header_text = "Empty Draw Size: %.3f" - if obj.type == 'LAMP': - lamp = obj.data + if obj.type == 'LIGHT': + light = obj.data layout.operator_context = 'INVOKE_REGION_WIN' emission_node = None - if lamp.node_tree: - for node in lamp.node_tree.nodes: + if light.node_tree: + for node in light.node_tree.nodes: if getattr(node, "type", None) == 'EMISSION': emission_node = node break @@ -1757,28 +1757,28 @@ class VIEW3D_MT_object_specials(Menu): props.data_path_item = "data.node_tree" \ ".nodes[\"" + emission_node.name + "\"]" \ ".inputs[\"Strength\"].default_value" - props.header_text = "Lamp Strength: %.3f" + props.header_text = "Light Strength: %.3f" props.input_scale = 0.1 - if lamp.type == 'AREA': + if light.type == 'AREA': props = layout.operator("wm.context_modal_mouse", text="Size X") props.data_path_iter = "selected_editable_objects" props.data_path_item = "data.size" - props.header_text = "Lamp Size X: %.3f" + props.header_text = "Light Size X: %.3f" - if lamp.shape in {'RECTANGLE', 'ELLIPSE'}: + if light.shape in {'RECTANGLE', 'ELLIPSE'}: props = layout.operator("wm.context_modal_mouse", text="Size Y") props.data_path_iter = "selected_editable_objects" props.data_path_item = "data.size_y" - props.header_text = "Lamp Size Y: %.3f" + props.header_text = "Light Size Y: %.3f" - elif lamp.type in {'SPOT', 'POINT', 'SUN'}: + elif light.type in {'SPOT', 'POINT', 'SUN'}: props = layout.operator("wm.context_modal_mouse", text="Size") props.data_path_iter = "selected_editable_objects" props.data_path_item = "data.shadow_soft_size" - props.header_text = "Lamp Size: %.3f" + props.header_text = "Light Size: %.3f" - if lamp.type == 'SPOT': + if light.type == 'SPOT': layout.separator() props = layout.operator("wm.context_modal_mouse", text="Spot Size") props.data_path_iter = "selected_editable_objects" @@ -4437,7 +4437,7 @@ classes = ( INFO_MT_edit_curve_add, INFO_MT_edit_armature_add, INFO_MT_armature_add, - INFO_MT_lamp_add, + INFO_MT_light_add, INFO_MT_lightprobe_add, INFO_MT_camera_add, INFO_MT_add, diff --git a/release/scripts/startup/nodeitems_builtins.py b/release/scripts/startup/nodeitems_builtins.py index 888045487f0..e6500b7c2c0 100644 --- a/release/scripts/startup/nodeitems_builtins.py +++ b/release/scripts/startup/nodeitems_builtins.py @@ -189,7 +189,7 @@ shader_node_categories = [ ]), ShaderNodeCategory("SH_NEW_OUTPUT", "Output", items=[ NodeItem("ShaderNodeOutputMaterial", poll=object_eevee_cycles_shader_nodes_poll), - NodeItem("ShaderNodeOutputLamp", poll=object_cycles_shader_nodes_poll), + NodeItem("ShaderNodeOutputLight", poll=object_cycles_shader_nodes_poll), NodeItem("ShaderNodeOutputWorld", poll=world_shader_nodes_poll), NodeItem("ShaderNodeOutputLineStyle", poll=line_style_shader_nodes_poll), NodeItem("NodeGroupOutput", poll=group_input_output_item_poll), diff --git a/release/scripts/templates_py/background_job.py b/release/scripts/templates_py/background_job.py index 2f444641a51..020dabeb258 100644 --- a/release/scripts/templates_py/background_job.py +++ b/release/scripts/templates_py/background_job.py @@ -42,11 +42,11 @@ def example_function(text, save_path, render_path): scene.camera = cam_ob # set the active camera cam_ob.location = 0.0, 0.0, 10.0 - # Lamp - lamp_data = bpy.data.lamps.new("MyLamp", 'POINT') - lamp_ob = bpy.data.objects.new(name="MyCam", object_data=lamp_data) - scene.objects.link(lamp_ob) - lamp_ob.location = 2.0, 2.0, 5.0 + # Light + light_data = bpy.data.lights.new("MyLight", 'POINT') + light_ob = bpy.data.objects.new(name="MyCam", object_data=light_data) + scene.objects.link(light_ob) + light_ob.location = 2.0, 2.0, 5.0 if save_path: bpy.ops.wm.save_as_mainfile(filepath=save_path) diff --git a/release/scripts/templates_py/manipulator_custom_geometry.py b/release/scripts/templates_py/manipulator_custom_geometry.py index 48bb6956f85..de324a909db 100644 --- a/release/scripts/templates_py/manipulator_custom_geometry.py +++ b/release/scripts/templates_py/manipulator_custom_geometry.py @@ -1,6 +1,6 @@ # Example of a custom widget that defines it's own geometry. # -# Usage: Select a lamp in the 3D view and drag the arrow at it's rear +# Usage: Select a light in the 3D view and drag the arrow at it's rear # to change it's energy value. # import bpy @@ -75,7 +75,7 @@ class MyCustomShapeWidget(Manipulator): ) def _update_offset_matrix(self): - # offset behind the lamp + # offset behind the light self.matrix_offset.col[3][2] = self.target_get_value("offset") / -10.0 def draw(self, context): @@ -113,8 +113,8 @@ class MyCustomShapeWidget(Manipulator): class MyCustomShapeWidgetGroup(ManipulatorGroup): - bl_idname = "OBJECT_WGT_lamp_test" - bl_label = "Test Lamp Widget" + bl_idname = "OBJECT_WGT_light_test" + bl_label = "Test Light Widget" bl_space_type = 'VIEW_3D' bl_region_type = 'WINDOW' bl_options = {'3D', 'PERSISTENT'} @@ -122,10 +122,10 @@ class MyCustomShapeWidgetGroup(ManipulatorGroup): @classmethod def poll(cls, context): ob = context.object - return (ob and ob.type == 'LAMP') + return (ob and ob.type == 'LIGHT') def setup(self, context): - # Assign the 'offset' target property to the lamp energy. + # Assign the 'offset' target property to the light energy. ob = context.object mpr = self.manipulators.new(MyCustomShapeWidget.bl_idname) mpr.target_set_prop("offset", ob.data, "energy") diff --git a/release/scripts/templates_py/manipulator_simple.py b/release/scripts/templates_py/manipulator_simple.py index 8ddb870cd13..cb10a8b94bb 100644 --- a/release/scripts/templates_py/manipulator_simple.py +++ b/release/scripts/templates_py/manipulator_simple.py @@ -1,7 +1,7 @@ # Example of a group that edits a single property # using the predefined manipulator arrow. # -# Usage: Select a lamp in the 3D view and drag the arrow at it's rear +# Usage: Select a light in the 3D view and drag the arrow at it's rear # to change it's energy value. # import bpy @@ -10,9 +10,9 @@ from bpy.types import ( ) -class MyLampWidgetGroup(ManipulatorGroup): - bl_idname = "OBJECT_WGT_lamp_test" - bl_label = "Test Lamp Widget" +class MyLightWidgetGroup(ManipulatorGroup): + bl_idname = "OBJECT_WGT_light_test" + bl_label = "Test Light Widget" bl_space_type = 'VIEW_3D' bl_region_type = 'WINDOW' bl_options = {'3D', 'PERSISTENT'} @@ -20,10 +20,10 @@ class MyLampWidgetGroup(ManipulatorGroup): @classmethod def poll(cls, context): ob = context.object - return (ob and ob.type == 'LAMP') + return (ob and ob.type == 'LIGHT') def setup(self, context): - # Arrow manipulator has one 'offset' property we can assign to the lamp energy. + # Arrow manipulator has one 'offset' property we can assign to the light energy. ob = context.object mpr = self.manipulators.new("MANIPULATOR_WT_arrow_3d") mpr.target_set_prop("offset", ob.data, "energy") @@ -44,4 +44,4 @@ class MyLampWidgetGroup(ManipulatorGroup): mpr.matrix_basis = ob.matrix_world.normalized() -bpy.utils.register_class(MyLampWidgetGroup) +bpy.utils.register_class(MyLightWidgetGroup) |