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.
This commit is contained in:
2018-06-27 14:41:53 +02:00
parent 4ac048f4e4
commit 74fd17e9d7
96 changed files with 899 additions and 939 deletions

View File

@@ -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:

View File

@@ -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:

View File

@@ -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",

View File

@@ -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)

View File

@@ -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)

View File

@@ -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:

View File

@@ -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:

View File

@@ -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")

View File

@@ -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()

View File

@@ -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,

View File

@@ -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),