Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2019-03-17 19:52:05 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-03-17 23:53:13 +0300
commitdf96455c55110da00f0543c5895376ffbc66313b (patch)
treed1fc0a55f44d4b931362d84eea77a7662c1955a6 /release/scripts/startup/bl_ui/space_node.py
parentf79ad428085edd8289f37027ba3d5ed3a52bce67 (diff)
UI: add light/world settings in shader node editor.
Material was already there. Implementation was changed so it's just a single line of code to adapt a panel to the node editor.
Diffstat (limited to 'release/scripts/startup/bl_ui/space_node.py')
-rw-r--r--release/scripts/startup/bl_ui/space_node.py65
1 files changed, 24 insertions, 41 deletions
diff --git a/release/scripts/startup/bl_ui/space_node.py b/release/scripts/startup/bl_ui/space_node.py
index e6765d59723..31451d7eedf 100644
--- a/release/scripts/startup/bl_ui/space_node.py
+++ b/release/scripts/startup/bl_ui/space_node.py
@@ -30,6 +30,13 @@ from .properties_material import (
EEVEE_MATERIAL_PT_settings,
MATERIAL_PT_viewport
)
+from .properties_world import (
+ WORLD_PT_viewport_display
+)
+from .properties_data_light import (
+ DATA_PT_light,
+ DATA_PT_EEVEE_light,
+)
class NODE_HT_header(Header):
@@ -569,49 +576,22 @@ class NODE_PT_grease_pencil_tools(GreasePencilToolsPanel, Panel):
# toolbar, but which may not necessarily be open
-class EEVEE_NODE_PT_material_settings(Panel):
- bl_space_type = 'NODE_EDITOR'
- bl_region_type = 'UI'
- bl_category = "Node"
- bl_label = "Settings"
- COMPAT_ENGINES = {'BLENDER_EEVEE'}
-
- @classmethod
- def poll(cls, context):
- snode = context.space_data
- return (
- (context.engine in cls.COMPAT_ENGINES) and
- (snode.tree_type == 'ShaderNodeTree' and snode.id) and
- (snode.id.bl_rna.identifier == 'Material')
- )
-
- def draw(self, context):
- material = context.space_data.id
- EEVEE_MATERIAL_PT_settings.draw_shared(self, material)
-
-
-class NODE_PT_material_viewport(Panel):
- bl_space_type = 'NODE_EDITOR'
- bl_region_type = 'UI'
- bl_category = "Node"
- bl_label = "Viewport Display"
- bl_options = {'DEFAULT_CLOSED'}
+def node_draw_tree_view(layout, context):
+ pass
- @classmethod
- def poll(cls, context):
- snode = context.space_data
- return (
- (snode.tree_type == 'ShaderNodeTree' and snode.id) and
- (snode.id.bl_rna.identifier == "Material")
- )
- def draw(self, context):
- material = context.space_data.id
- MATERIAL_PT_viewport.draw_shared(self, material)
+# Adapt properties editor panel to display in node editor. We have to
+# copy the class rather than inherit due to the way bpy registration works.
+def node_panel(cls):
+ node_cls = type('NODE_' + cls.__name__, cls.__bases__, dict(cls.__dict__))
+ node_cls.bl_space_type = 'NODE_EDITOR'
+ node_cls.bl_region_type = 'UI'
+ node_cls.bl_category = "Node"
+ if hasattr(node_cls, 'bl_parent_id'):
+ node_cls.bl_parent_id = 'NODE_' + node_cls.bl_parent_id
-def node_draw_tree_view(layout, context):
- pass
+ return node_cls
classes = (
@@ -632,8 +612,11 @@ classes = (
NODE_UL_interface_sockets,
NODE_PT_grease_pencil,
NODE_PT_grease_pencil_tools,
- EEVEE_NODE_PT_material_settings,
- NODE_PT_material_viewport,
+ node_panel(EEVEE_MATERIAL_PT_settings),
+ node_panel(MATERIAL_PT_viewport),
+ node_panel(WORLD_PT_viewport_display),
+ node_panel(DATA_PT_light),
+ node_panel(DATA_PT_EEVEE_light),
)