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>2016-04-27 23:58:00 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2016-04-27 23:58:00 +0300
commit2b485e21f4d11e2313f97d6c1e34558b64e6f5a0 (patch)
tree6e19ab1fb7683c81537f96d3eed7794f77901a75 /release/scripts
parentcc692c09243d7b74b5606fe5ee8686ab5427e5fe (diff)
Minor code simplification in previous commit.
Diffstat (limited to 'release/scripts')
-rw-r--r--release/scripts/startup/nodeitems_builtins.py30
1 files changed, 10 insertions, 20 deletions
diff --git a/release/scripts/startup/nodeitems_builtins.py b/release/scripts/startup/nodeitems_builtins.py
index b93cb857e0a..092cd31330c 100644
--- a/release/scripts/startup/nodeitems_builtins.py
+++ b/release/scripts/startup/nodeitems_builtins.py
@@ -24,45 +24,35 @@ from nodeitems_utils import NodeCategory, NodeItem, NodeItemCustom
# Subclasses for standard node types
-def alphabetical(items):
- # for builtin nodes the convention is to sort by name
- if isinstance(items, list):
- return sorted(items, key=lambda item: item.label().lower)
- return items
-
-class CompositorNodeCategory(NodeCategory):
+class SortedNodeCategory(NodeCategory):
def __init__(self, identifier, name, description="", items=None):
- super().__init__(identifier, name, description, alphabetical(items))
+ # for builtin nodes the convention is to sort by name
+ if isinstance(items, list):
+ items = sorted(items, key=lambda item: item.label.lower())
+
+ super().__init__(identifier, name, description, items)
+class CompositorNodeCategory(SortedNodeCategory):
@classmethod
def poll(cls, context):
return (context.space_data.tree_type == 'CompositorNodeTree')
-class ShaderNewNodeCategory(NodeCategory):
- def __init__(self, identifier, name, description="", items=None):
- super().__init__(identifier, name, description, alphabetical(items))
-
+class ShaderNewNodeCategory(SortedNodeCategory):
@classmethod
def poll(cls, context):
return (context.space_data.tree_type == 'ShaderNodeTree' and
context.scene.render.use_shading_nodes)
-class ShaderOldNodeCategory(NodeCategory):
- def __init__(self, identifier, name, description="", items=None):
- super().__init__(identifier, name, description, alphabetical(items))
-
+class ShaderOldNodeCategory(SortedNodeCategory):
@classmethod
def poll(cls, context):
return (context.space_data.tree_type == 'ShaderNodeTree' and
not context.scene.render.use_shading_nodes)
-class TextureNodeCategory(NodeCategory):
- def __init__(self, identifier, name, description="", items=None):
- super().__init__(identifier, name, description, alphabetical(items))
-
+class TextureNodeCategory(SortedNodeCategory):
@classmethod
def poll(cls, context):
return context.space_data.tree_type == 'TextureNodeTree'