[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4436] contrib/py/scripts/addons/ node_efficiency_tools.py: Final code clean up before committing to trunk.
Bartek Skorupa
bartekskorupa at bartekskorupa.com
Wed Mar 27 12:33:56 CET 2013
Revision: 4436
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4436
Author: bartekskorupa
Date: 2013-03-27 11:33:56 +0000 (Wed, 27 Mar 2013)
Log Message:
-----------
Final code clean up before committing to trunk.
Changed internal enum values to allcaps where possible.
Only in one case it's left with mixed caps. There is a good reason for that and the comment has been added.
Version number better formatted
Modified Paths:
--------------
contrib/py/scripts/addons/node_efficiency_tools.py
Modified: contrib/py/scripts/addons/node_efficiency_tools.py
===================================================================
--- contrib/py/scripts/addons/node_efficiency_tools.py 2013-03-27 10:17:08 UTC (rev 4435)
+++ contrib/py/scripts/addons/node_efficiency_tools.py 2013-03-27 11:33:56 UTC (rev 4436)
@@ -19,7 +19,7 @@
bl_info = {
'name': "Nodes Efficiency Tools",
'author': "Bartek Skorupa",
- 'version': (2, 1.4),
+ 'version': (2, 20),
'blender': (2, 6, 6),
'location': "Node Editor Properties Panel (Ctrl-SPACE)",
'description': "Nodes Efficiency Tools",
@@ -119,6 +119,7 @@
# list of mixing shaders
merge_shaders = ('MIX', 'ADD')
# list of regular shaders. Entry: (identified, type, name for humans). Will be used in SwapShaders and menus.
+# Keeping mixed case to avoid having to translate entries when adding new nodes in SwapNodes.
regular_shaders = (
('ShaderNodeBsdfTransparent', 'BSDF_TRANSPARENT', 'Transparent BSDF'),
('ShaderNodeBsdfGlossy', 'BSDF_GLOSSY', 'Glossy BSDF'),
@@ -485,9 +486,9 @@
name = "option",
description = "Source of name of label",
items = [
- ('from_active', 'from active', 'from active node',),
- ('from_node', 'from node', 'from node linked to selected node'),
- ('from_socket', 'from socket', 'from socket linked to selected node'),
+ ('FROM_ACTIVE', 'from active', 'from active node',),
+ ('FROM_NODE', 'from node', 'from node linked to selected node'),
+ ('FROM_SOCKET', 'from socket', 'from socket linked to selected node'),
]
)
@@ -495,12 +496,12 @@
nodes, links = get_nodes_links(context)
option = self.option
active = nodes.active
- if option == 'from_active':
+ if option == 'FROM_ACTIVE':
if active:
src_label = active.label
for node in [n for n in nodes if n.select and nodes.active != n]:
node.label = src_label
- elif option == 'from_node':
+ elif option == 'FROM_NODE':
selected = [n for n in nodes if n.select]
for node in selected:
for input in node.inputs:
@@ -508,7 +509,7 @@
src = input.links[0].from_node
node.label = src.label
break
- elif option == 'from_socket':
+ elif option == 'FROM_SOCKET':
selected = [n for n in nodes if n.select]
for node in selected:
for input in node.inputs:
@@ -1201,9 +1202,9 @@
def draw(self, context):
layout = self.layout
- layout.operator(NodesCopyLabel.bl_idname, text="from Active Node's Label").option = 'from_active'
- layout.operator(NodesCopyLabel.bl_idname, text="from Linked Node's Label").option = 'from_node'
- layout.operator(NodesCopyLabel.bl_idname, text="from Linked Output's Name").option = 'from_socket'
+ layout.operator(NodesCopyLabel.bl_idname, text="from Active Node's Label").option = 'FROM_ACTIVE'
+ layout.operator(NodesCopyLabel.bl_idname, text="from Linked Node's Label").option = 'FROM_NODE'
+ layout.operator(NodesCopyLabel.bl_idname, text="from Linked Output's Name").option = 'FROM_SOCKET'
class AddReroutesMenu(Menu, NodeToolBase):
@@ -1505,4 +1506,4 @@
addon_keymaps.clear()
if __name__ == "__main__":
- register()
+ register()
\ No newline at end of file
More information about the Bf-extensions-cvs
mailing list