[Bf-extensions-cvs] [8a7239f] master: Node Wrangler: Make layout margin a property

Greg Zaal noreply at git.blender.org
Tue May 26 13:34:40 CEST 2015


Commit: 8a7239f94ee849b5a3644ea6c5ca80faa460ce24
Author: Greg Zaal
Date:   Tue May 26 13:31:18 2015 +0200
Branches: master
https://developer.blender.org/rBA8a7239f94ee849b5a3644ea6c5ca80faa460ce24

Node Wrangler: Make layout margin a property

Also reduce default margin slightly, especially for spacing between vertically-aligned nodes.

===================================================================

M	node_wrangler.py

===================================================================

diff --git a/node_wrangler.py b/node_wrangler.py
index c1c6f29..54e11fa 100644
--- a/node_wrangler.py
+++ b/node_wrangler.py
@@ -19,7 +19,7 @@
 bl_info = {
     "name": "Node Wrangler",
     "author": "Bartek Skorupa, Greg Zaal, Sebastian Koenig",
-    "version": (3, 26),
+    "version": (3, 27),
     "blender": (2, 74, 0),
     "location": "Node Editor Toolbar or Ctrl-Space",
     "description": "Various tools to enhance and speed up node-based workflow",
@@ -2671,11 +2671,12 @@ class NWAlignNodes(Operator, NWBase):
     bl_idname = "node.nw_align_nodes"
     bl_label = "Align Nodes"
     bl_options = {'REGISTER', 'UNDO'}
+    margin = IntProperty(name='Margin', default=50, description='The amount of space between nodes')
 
     def execute(self, context):
         # TODO prop: lock active (arrange everything without moving active node)
         nodes, links = get_nodes_links(context)
-        margin = 80
+        margin = self.margin
         
         selection = []
         for node in nodes:
@@ -2705,7 +2706,7 @@ class NWAlignNodes(Operator, NWBase):
         current_pos = 0
         for node in selection:
             current_margin = margin
-            current_margin = current_margin / 2 if node.hide else current_margin  # use a smaller margin for hidden nodes
+            current_margin = current_margin * 0.5 if node.hide else current_margin  # use a smaller margin for hidden nodes
 
             if horizontal:
                 node.location.x = current_pos
@@ -2713,7 +2714,7 @@ class NWAlignNodes(Operator, NWBase):
                 node.location.y = mid_y + (node.dimensions.y / 2)
             else:
                 node.location.y = current_pos
-                current_pos -= (current_margin / 2) + node.dimensions.y  # use half-margin for vertical alignment
+                current_pos -= (current_margin * 0.3) + node.dimensions.y  # use half-margin for vertical alignment
                 node.location.x = mid_x - (node.dimensions.x / 2)
 
         # Position nodes centered around where they used to be



More information about the Bf-extensions-cvs mailing list