diff options
Diffstat (limited to 'release/scripts/startup/bl_ui/properties_world.py')
-rw-r--r-- | release/scripts/startup/bl_ui/properties_world.py | 49 |
1 files changed, 42 insertions, 7 deletions
diff --git a/release/scripts/startup/bl_ui/properties_world.py b/release/scripts/startup/bl_ui/properties_world.py index 107c31567b3..e56a7977791 100644 --- a/release/scripts/startup/bl_ui/properties_world.py +++ b/release/scripts/startup/bl_ui/properties_world.py @@ -20,6 +20,7 @@ import bpy from bpy.types import Panel from rna_prop_ui import PropertyPanel +from bpy_extras.node_utils import find_node_input, find_output_node class WorldButtonsPanel: @@ -30,18 +31,18 @@ class WorldButtonsPanel: @classmethod def poll(cls, context): - return (context.world and context.scene.render.engine in cls.COMPAT_ENGINES) + return (context.world and context.engine in cls.COMPAT_ENGINES) class WORLD_PT_context_world(WorldButtonsPanel, Panel): bl_label = "" bl_options = {'HIDE_HEADER'} - COMPAT_ENGINES = {'BLENDER_RENDER'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'} @classmethod def poll(cls, context): - rd = context.scene.render - return rd.engine in cls.COMPAT_ENGINES + view_render = context.scene.view_render + return view_render.engine in cls.COMPAT_ENGINES def draw(self, context): layout = self.layout @@ -68,8 +69,7 @@ class WORLD_PT_preview(WorldButtonsPanel, Panel): @classmethod def poll(cls, context): - rd = context.scene.render - return (context.world) and (rd.engine in cls.COMPAT_ENGINES) + return (context.world) and (context.engine in cls.COMPAT_ENGINES) def draw(self, context): self.layout.template_preview(context.world) @@ -244,11 +244,45 @@ class WORLD_PT_mist(WorldButtonsPanel, Panel): class WORLD_PT_custom_props(WorldButtonsPanel, PropertyPanel, Panel): - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_EEVEE'} _context_path = "world" _property_type = bpy.types.World +class EEVEE_WORLD_PT_surface(WorldButtonsPanel, Panel): + bl_label = "Surface" + bl_context = "world" + COMPAT_ENGINES = {'BLENDER_EEVEE'} + + @classmethod + def poll(cls, context): + engine = context.engine + return context.world and (engine in cls.COMPAT_ENGINES) + + def draw(self, context): + layout = self.layout + + world = context.world + + layout.prop(world, "use_nodes", icon='NODETREE') + layout.separator() + + if world.use_nodes: + ntree = world.node_tree + node = find_output_node(ntree, ('OUTPUT_WORLD',)) + + if node: + input = find_node_input(node, 'Surface') + if input: + layout.template_node_view(ntree, node, input) + else: + layout.label(text="Incompatible output node") + else: + layout.label(text="No output node") + else: + layout.prop(world, "horizon_color", text="Color") + + classes = ( WORLD_PT_context_world, WORLD_PT_preview, @@ -259,6 +293,7 @@ classes = ( WORLD_PT_gather, WORLD_PT_mist, WORLD_PT_custom_props, + EEVEE_WORLD_PT_surface, ) if __name__ == "__main__": # only for live edit. |