Commit a7d21723 authored by Pablo Vazquez's avatar Pablo Vazquez

Amaranth 0.9 Lil tweaks/fixes

- Lamps list now lists meshlights too (optional)
- Fixed recognizing meshlights in some obscure cases
- Quiet a harmless warning
parent 8bf1c8a1
......@@ -189,10 +189,10 @@ def init_properties():
scene.amaranth_cycles_node_types = EnumProperty(
items=cycles_shader_node_types, name = "Shader")
scene.amaranth_debug_scene_list_lamps = BoolProperty(
scene.amaranth_lighterscorner_list_meshlights = BoolProperty(
default=False,
name="Lamps List",
description="Display a list of all the lamps")
name="List Meshlights",
description="Include light emitting meshes on the list")
scene.amaranth_debug_scene_list_missing_images = BoolProperty(
default=False,
......@@ -221,7 +221,7 @@ def clear_properties():
"types",
"toggle_mute",
"amaranth_cycles_node_types",
"amaranth_debug_scene_list_lamps",
"amaranth_lighterscorner_list_meshlights",
"amaranth_debug_scene_list_missing_images",
"amarath_cycles_list_sampling",
"normal_vector",
......@@ -270,12 +270,12 @@ def cycles_is_emission(context, ob):
if ob.material_slots:
for ma in ob.material_slots:
if ma.material:
if ma.material.node_tree:
if ma.material.node_tree and ma.material.node_tree.nodes:
for no in ma.material.node_tree.nodes:
if no.type in {'EMISSION', 'GROUP'}:
for ou in no.outputs:
if ou.links:
if no.type == 'GROUP':
if no.type == 'GROUP' and no.node_tree and no.node_tree.nodes:
for gno in no.node_tree.nodes:
if gno.type == 'EMISSION':
for gou in gno.outputs:
......@@ -1687,7 +1687,6 @@ class AMTH_SCENE_PT_scene_debug(Panel):
images = bpy.data.images
lamps = bpy.data.lamps
images_missing = []
list_lamps = scene.amaranth_debug_scene_list_lamps
list_missing_images = scene.amaranth_debug_scene_list_missing_images
materials = AMTH_SCENE_OT_cycles_shader_list_nodes.materials
materials_count = len(AMTH_SCENE_OT_cycles_shader_list_nodes.materials)
......@@ -2284,8 +2283,9 @@ class AMTH_SCENE_OT_layers_render_view(Operator):
for area in screen.areas:
if area.type == 'VIEW_3D':
override = {'window': window, 'screen': screen,
'scene': scene, 'area': area}
override = {'window': window, 'screen': screen, 'scene': scene,
'area': area, 'region': area.regions[4],
'blend_data': context.blend_data}
if layers_render:
bpy.ops.view3d.layers(override, nr=layers_render[0]+1, extend=False, toggle=False)
......@@ -2416,7 +2416,7 @@ class AMTH_LightersCorner(bpy.types.Panel):
def poll(cls, context):
any_lamps = False
for ob in bpy.data.objects:
if ob.type == 'LAMP':
if ob.type == 'LAMP' or cycles_is_emission(context, ob):
any_lamps = True
else:
pass
......@@ -2432,13 +2432,13 @@ class AMTH_LightersCorner(bpy.types.Panel):
objects = bpy.data.objects
ob_act = context.active_object
lamps = bpy.data.lamps
list_lamps = scene.amaranth_debug_scene_list_lamps
list_meshlights = scene.amaranth_lighterscorner_list_meshlights
engine = scene.render.engine
# List Lamps
layout.prop(scene, "amaranth_lighterscorner_list_meshlights")
box = layout.box()
if lamps:
if objects:
row = box.row(align=True)
split = row.split(percentage=0.42)
......@@ -2466,7 +2466,10 @@ class AMTH_LightersCorner(bpy.types.Panel):
col.label(text="Visibility")
for ob in objects:
if ob and ob.type == 'LAMP':
is_lamp = ob.type == 'LAMP'
is_emission = True if cycles_is_emission(context, ob) and list_meshlights else False
if ob and is_lamp or is_emission:
lamp = ob.data
clamp = ob.data.cycles
......@@ -2480,7 +2483,7 @@ class AMTH_LightersCorner(bpy.types.Panel):
" [L] " if ob.library else "",
ob.name,
"" if ob.name in context.scene.objects else " [Not in Scene]"),
icon="LAMP_%s" % ob.data.type,
icon="%s" % ('LAMP_%s' % ob.data.type if is_lamp else 'MESH_GRID'),
emboss=False).object = ob.name
if ob.library:
row = col.row(align=True)
......@@ -2493,39 +2496,48 @@ class AMTH_LightersCorner(bpy.types.Panel):
if engine == 'CYCLES':
split = split.split(percentage=0.35)
col = split.column()
if scene.cycles.progressive == 'BRANCHED_PATH':
col.prop(clamp, "samples", text="")
if scene.cycles.progressive == 'PATH':
col.label(text="N/A")
if is_lamp:
if scene.cycles.progressive == 'BRANCHED_PATH':
col.prop(clamp, "samples", text="")
if scene.cycles.progressive == 'PATH':
col.label(text="N/A")
else:
col.label(text="N/A")
if engine == 'BLENDER_RENDER':
split = split.split(percentage=0.7)
col = split.column()
if lamp.type == 'HEMI':
col.label(text="Not Available")
elif lamp.type == 'AREA' and lamp.shadow_method == 'RAY_SHADOW':
row = col.row(align=True)
row.prop(lamp, "shadow_ray_samples_x", text="X")
if lamp.shape == 'RECTANGLE':
row.prop(lamp, "shadow_ray_samples_y", text="Y")
elif lamp.shadow_method == 'RAY_SHADOW':
col.prop(lamp, "shadow_ray_samples", text="Ray Samples")
elif lamp.shadow_method == 'BUFFER_SHADOW':
col.prop(lamp, "shadow_buffer_samples", text="Buffer Samples")
if is_lamp:
if lamp.type == 'HEMI':
col.label(text="Not Available")
elif lamp.type == 'AREA' and lamp.shadow_method == 'RAY_SHADOW':
row = col.row(align=True)
row.prop(lamp, "shadow_ray_samples_x", text="X")
if lamp.shape == 'RECTANGLE':
row.prop(lamp, "shadow_ray_samples_y", text="Y")
elif lamp.shadow_method == 'RAY_SHADOW':
col.prop(lamp, "shadow_ray_samples", text="Ray Samples")
elif lamp.shadow_method == 'BUFFER_SHADOW':
col.prop(lamp, "shadow_buffer_samples", text="Buffer Samples")
else:
col.label(text="No Shadow")
else:
col.label(text="No Shadow")
col.label(text="N/A")
if engine == 'CYCLES':
split = split.split(percentage=0.4)
col = split.column()
if lamp.type in ['POINT','SUN', 'SPOT']:
col.label(text="%.2f" % lamp.shadow_soft_size)
elif lamp.type == 'HEMI':
col.label(text="N/A")
elif lamp.type == 'AREA' and lamp.shape == 'RECTANGLE':
col.label(text="%.2fx%.2f" % (lamp.size, lamp.size_y))
if is_lamp:
if lamp.type in ['POINT','SUN', 'SPOT']:
col.label(text="%.2f" % lamp.shadow_soft_size)
elif lamp.type == 'HEMI':
col.label(text="N/A")
elif lamp.type == 'AREA' and lamp.shape == 'RECTANGLE':
col.label(text="%.2fx%.2f" % (lamp.size, lamp.size_y))
else:
col.label(text="%.2f" % lamp.size)
else:
col.label(text="%.2f" % lamp.size)
col.label(text="N/A")
split = split.split(percentage=0.8)
col = split.column()
......@@ -2536,7 +2548,6 @@ class AMTH_LightersCorner(bpy.types.Panel):
split = split.split(percentage=0.3)
col = split.column()
col.label(text="", icon="%s" % "TRIA_LEFT" if ob == ob_act else "BLANK1")
else:
box.label(text="No Lamps", icon="LAMP_DATA")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment