Cycles: when material/world/lamp doesn't use nodes, show color in the UI.

This commit is contained in:
Brecht Van Lommel 2011-11-10 13:00:53 +00:00
parent 7bcd1a6c47
commit 2adcac7661

@ -350,7 +350,7 @@ def find_node_input(node, name):
def panel_node_draw(layout, id, output_type, input_name): def panel_node_draw(layout, id, output_type, input_name):
if not id.node_tree: if not id.node_tree:
layout.prop(id, "use_nodes", icon='NODETREE') layout.prop(id, "use_nodes", icon='NODETREE')
return return False
ntree = id.node_tree ntree = id.node_tree
@ -360,6 +360,8 @@ def panel_node_draw(layout, id, output_type, input_name):
else: else:
input = find_node_input(node, input_name) input = find_node_input(node, input_name)
layout.template_node_view(ntree, node, input); layout.template_node_view(ntree, node, input);
return True
class CyclesLamp_PT_lamp(CyclesButtonsPanel, Panel): class CyclesLamp_PT_lamp(CyclesButtonsPanel, Panel):
bl_label = "Lamp" bl_label = "Lamp"
@ -411,8 +413,9 @@ class CyclesLamp_PT_nodes(CyclesButtonsPanel, Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
mat = context.lamp lamp = context.lamp
panel_node_draw(layout, mat, 'OUTPUT_LAMP', 'Surface') if not panel_node_draw(layout, lamp, 'OUTPUT_LAMP', 'Surface'):
layout.prop(lamp, "color")
class CyclesWorld_PT_surface(CyclesButtonsPanel, Panel): class CyclesWorld_PT_surface(CyclesButtonsPanel, Panel):
bl_label = "Surface" bl_label = "Surface"
@ -425,8 +428,9 @@ class CyclesWorld_PT_surface(CyclesButtonsPanel, Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
mat = context.world world = context.world
panel_node_draw(layout, mat, 'OUTPUT_WORLD', 'Surface') if not panel_node_draw(layout, world, 'OUTPUT_WORLD', 'Surface'):
layout.prop(world, "horizon_color", text="Color")
class CyclesWorld_PT_volume(CyclesButtonsPanel, Panel): class CyclesWorld_PT_volume(CyclesButtonsPanel, Panel):
bl_label = "Volume" bl_label = "Volume"
@ -457,7 +461,8 @@ class CyclesMaterial_PT_surface(CyclesButtonsPanel, Panel):
layout = self.layout layout = self.layout
mat = context.material mat = context.material
panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Surface') if not panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Surface'):
layout.prop(mat, "diffuse_color")
class CyclesMaterial_PT_volume(CyclesButtonsPanel, Panel): class CyclesMaterial_PT_volume(CyclesButtonsPanel, Panel):
bl_label = "Volume" bl_label = "Volume"