From d7b87f2e2b8b9d98a2a8d83c5af93b9210622d39 Mon Sep 17 00:00:00 2001
From: Brendon Murphy <meta.androcto1@gmail.com>
Date: Wed, 4 May 2011 09:36:01 +0000
Subject: [PATCH] fix for active layers & align to view errors. thanks to jawra
 for the updates.

---
 object_add_chain.py | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/object_add_chain.py b/object_add_chain.py
index 3699460bd..a173af273 100644
--- a/object_add_chain.py
+++ b/object_add_chain.py
@@ -37,12 +37,8 @@ def Add_Chain():
   
 
     ##Adds Empty to scene
-    bpy.ops.object.add(
-        type='EMPTY', view_align=False, enter_editmode=False, location=(0, 0, 0), 
-        rotation=(0, 0, 0),
-        layers=(True, False, False, False, False, False, False, False, False,
-                False, False, False, False, False, False, False, False, False, 
-                False, False))
+    bpy.ops.object.add(type='EMPTY', view_align=False, enter_editmode=False, location=(0, 0, 0), 
+rotation=(0, 0, 0),)
 
     ##Changes name of Empty to rot_link adds variable emp
     emp = bpy.context.object
@@ -52,12 +48,7 @@ def Add_Chain():
     emp.rotation_euler = [1.570796, 0, 0]
 
     ##Adds Curve Path to scene
-    bpy.ops.curve.primitive_nurbs_path_add(
-        view_align=False, enter_editmode=False, location=(0, 0, 0), 
-        rotation=(0, 0, 0), 
-        layers=(True, False, False, False, False, False, False, False, False, 
-        False, False, False, False, False, False, False, False, False, False, 
-        False))
+    bpy.ops.curve.primitive_nurbs_path_add( view_align=False, enter_editmode=False, location=(0, 0, 0), rotation=(0, 0, 0),)
 
     ##Change Curve name to deform adds variable curv
     curv = bpy.context.object
@@ -70,6 +61,10 @@ def Add_Chain():
 
     ##Positions Torus primitive to center of scene
     bpy.context.active_object.location = [0, 0, 0]
+    
+    ##Reseting Torus rotation in case of 'Align to view' option enabled
+    bpy.context.active_object.rotation_euler = [0, 0, 0]
+    
 
     ##Changes Torus name to chain adds variable tor
     tor = bpy.context.object
-- 
GitLab