Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-06-27 15:41:53 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-07-06 21:06:09 +0300
commit74fd17e9d788394fa5bf781bb3e60bca7617b22c (patch)
treea27bcd7e67f74cd0abfeb06b6b9f13e049d736f2 /release/scripts/modules/bl_previews_utils
parent4ac048f4e4ef1945fe085c3c0ebf263eb51d8d1b (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/modules/bl_previews_utils')
-rw-r--r--release/scripts/modules/bl_previews_utils/bl_previews_render.py66
1 files changed, 33 insertions, 33 deletions
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)