diff options
Diffstat (limited to 'release/scripts/startup/bl_ui/properties_world.py')
-rw-r--r-- | release/scripts/startup/bl_ui/properties_world.py | 77 |
1 files changed, 70 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..48eed9acb3a 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) @@ -243,12 +243,73 @@ class WORLD_PT_mist(WorldButtonsPanel, Panel): layout.prop(world.mist_settings, "falloff") +class EEVEE_WORLD_PT_mist(WorldButtonsPanel, Panel): + bl_label = "Mist Pass" + bl_options = {'DEFAULT_CLOSED'} + COMPAT_ENGINES = {'BLENDER_EEVEE'} + + @classmethod + def poll(cls, context): + engine = context.engine + if context.world and (engine in cls.COMPAT_ENGINES): + for view_layer in context.scene.view_layers: + if view_layer.use_pass_mist: + return True + + return False + + def draw(self, context): + layout = self.layout + + world = context.world + + split = layout.split(align=True) + split.prop(world.mist_settings, "start") + split.prop(world.mist_settings, "depth") + + layout.prop(world.mist_settings, "falloff") + + 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 +320,8 @@ classes = ( WORLD_PT_gather, WORLD_PT_mist, WORLD_PT_custom_props, + EEVEE_WORLD_PT_surface, + EEVEE_WORLD_PT_mist, ) if __name__ == "__main__": # only for live edit. |