[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1084] trunk/py/scripts/addons/ space_view3d_align_tools.py: please do not change this file again until reviewed

Brendon Murphy meta.androcto1 at gmail.com
Sun Sep 26 09:33:39 CEST 2010


Revision: 1084
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-extensions&revision=1084
Author:   meta-androcto
Date:     2010-09-26 09:33:38 +0200 (Sun, 26 Sep 2010)

Log Message:
-----------
please do not change this file again until reviewed

Modified Paths:
--------------
    trunk/py/scripts/addons/space_view3d_align_tools.py

Modified: trunk/py/scripts/addons/space_view3d_align_tools.py
===================================================================
--- trunk/py/scripts/addons/space_view3d_align_tools.py	2010-09-26 06:59:16 UTC (rev 1083)
+++ trunk/py/scripts/addons/space_view3d_align_tools.py	2010-09-26 07:33:38 UTC (rev 1084)
@@ -15,16 +15,16 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # ***** END GPL LICENCE BLOCK *****
 
 bl_addon_info = {
     "name": "Align Tools",
     "author": "Gabriel Beaudin (gabhead)",
-    "version": (0,13),
-    "blender": (2, 5, 4),
-    "api": 32121,
+    "version": (0,1),
+    "blender": (2, 5, 3),
+    "api": 31965,
     "location": "Tool Shelf",
     "description": "Align selected objects to the active object",
     "warning": "",
@@ -34,272 +34,305 @@
         "func=detail&aid==22389&group_id=153&atid=468",
     "category": "3D View"}
 
+"""Align Selected Objects"""
 
 import bpy
-from bpy.props import *
-#import Mathutils
-sce = bpy.context.scene
 
-##interface
-######################
 
 class AlignUi(bpy.types.Panel):
+    bl_space_type = 'VIEW_3D'
+    bl_region_type = 'TOOLS'
+
     bl_label = "Align Tools"
     bl_context = "objectmode"
-    bl_space_type = 'VIEW_3D'
-    bl_region_type = 'TOOLS'
-    
+
     def draw(self, context):
         layout = self.layout
-        obj = bpy.context.object
-        sce = bpy.context.scene
-        items_list = [("Min", "Minimum", "Minimum"),
-                  ("Max", "Maximum", "Maximum",),
-                  ("Center","Center","Center"),
-                  ("Origin","Origin","Origin")]
+        obj = context.object
 
-        bpy.types.Scene.SrcLocation = EnumProperty(name="SrcLocation",
-                                 items=items_list,
-                                 description="SrcLocation",
-                                 default="Origin")
+        if obj != None:
+            row = layout.row()
+            row.label(text="Active object is: ", icon='OBJECT_DATA')
+            row = layout.row()
+            row.label(obj.name, icon='EDITMODE_HLT')
+        
+        box = layout.separator()
+        
+        col = layout.column()
+        col.label(text="Align Loc + Rot:", icon='MANIPUL')
 
-        items_list = [("Min", "Minimum", "Minimum"),
-                  ("Max", "Maximum", "Maximum",),
-                  ("Center","Center","Center"),
-                  ("Origin","Origin","Origin")]
+        
+        col = layout.column(align=False)
+        col.operator("object.AlignObjects",text="XYZ")
+        
+        col = layout.column()
+        col.label(text="Align Location:", icon='MAN_TRANS')
 
-        bpy.types.Scene.ActLocation = EnumProperty(
-                                 name="ActLocation",
-                                 items=items_list,
-                                 description="ActLocation",
-                                 default="Origin")
+        col = layout.column_flow(columns=5,align=True)
+        col.operator("object.AlignObjectsLocationX",text="X")
+        col.operator("object.AlignObjectsLocationY",text="Y")
+        col.operator("object.AlignObjectsLocationZ",text="Z")
+        col.operator("object.AlignObjectsLocationAll",text="All")
 
-        bpy.types.Scene.Aling_LocationX = BoolProperty(
-            name="Aling_LocationX",
-            attr="Aling_LocationX",
-            description="Aling_LocationX",
-            default=0)
+        col = layout.column()
+        col.label(text="Align Rotation:", icon='MAN_ROT')
 
-        bpy.types.Scene.Aling_LocationY=BoolProperty(
-            name="Aling_LocationY",
-            attr="Aling_LocationY",
-            description="Aling_LocationY",
-            default=0)
+        col = layout.column_flow(columns=5,align=True)
+        col.operator("object.AlignObjectsRotationX",text="X")
+        col.operator("object.AlignObjectsRotationY",text="Y")
+        col.operator("object.AlignObjectsRotationZ",text="Z")
+        col.operator("object.AlignObjectsRotationAll",text="All")
+        
+        col = layout.column()
+        col.label(text="Align Scale:", icon='MAN_SCALE')
 
-        bpy.types.Scene.Aling_LocationZ=BoolProperty(
-            name="Aling_LocationZ",
-            attr="Aling_LocationZ",
-            description="Aling_LocationZ",
-            default=0)
+        col = layout.column_flow(columns=5,align=True)
+        col.operator("object.AlignObjectsScaleX",text="X")
+        col.operator("object.AlignObjectsScaleY",text="Y")
+        col.operator("object.AlignObjectsScaleZ",text="Z")
+        col.operator("object.AlignObjectsScaleAll",text="All")
 
-        bpy.types.Scene.Aling_RotationX=BoolProperty(
-            name="Aling_RotationX",
-            attr="Aling_RotationX",
-            description="Aling_LocationX",
-            default=0)
 
-        bpy.types.Scene.Aling_RotationY=BoolProperty(
-            name="Aling_RotationY",
-            attr="Aling_RotationY",
-            description="Aling_LocationY",
-            default=0)
+##Align all
+def main(context):
+    for i in bpy.context.selected_objects:
+        i.location = bpy.context.active_object.location
+        i.rotation_euler = bpy.context.active_object.rotation_euler
 
-        bpy.types.Scene.Aling_RotationZ=BoolProperty(
-            name="Aling_RotationZ",
-            attr="Aling_RotationZ",
-            description="Aling_LocationZ",
-            default=0)
+## Align Location
 
-        bpy.types.Scene.Aling_ScaleX=BoolProperty(
-            name="Aling_ScaleX",
-            attr="Aling_ScaleX",
-            description="Aling_LocationX",
-            default=0)
+def LocAll(context):
+    for i in bpy.context.selected_objects:
+        i.location = bpy.context.active_object.location
 
-        bpy.types.Scene.Aling_ScaleY=BoolProperty(
-            name="Aling_ScaleY",
-            attr="Aling_ScaleY",
-            description="Aling_LocationY",
-            default=0)
+def LocX(context):
+    for i in bpy.context.selected_objects:
+        i.location.x = bpy.context.active_object.location.x
 
-        bpy.types.Scene.Aling_ScaleZ=BoolProperty(
-            name="Aling_ScaleZ",
-            attr="Aling_ScaleZ",
-            description="Aling_LocationZ",
-            default=0)
+def LocY(context):
+    for i in bpy.context.selected_objects:
+        i.location.y = bpy.context.active_object.location.y
 
-        if len(bpy.context.selected_objects)>1:
-            
-            col = layout.column()
-            bo = layout.box()
-            bo.prop_menu_enum(data=sce,property="SrcLocation",text=str((len(bpy.context.selected_objects))-1)+" objects: "+sce.SrcLocation,icon='OBJECT_DATA')
-            if bpy.context.object != None:
-                bo.prop_menu_enum(data=sce,property="ActLocation",text="To: "+obj.name+": "+sce.ActLocation,icon='OBJECT_DATA')
+def LocZ(context):
+    for i in bpy.context.selected_objects:
+        i.location.z = bpy.context.active_object.location.z
 
-            col = layout.column()
-            col.label(text="Align Location:", icon='MAN_TRANS')
-        		
-            col = layout.column_flow(columns=3,align=True)
-            col.prop(sce,"Aling_LocationX",text="X")
-            col.prop(sce,"Aling_LocationY",text="Y")
-            col.prop(sce,"Aling_LocationZ",text="Z")
+## Aling Rotation
+def RotAll(context):
+    for i in bpy.context.selected_objects:
+        i.rotation_euler = bpy.context.active_object.rotation_euler
 
-            col = layout.column()
-            col.label(text="Align Rotation:", icon='MAN_ROT')
+def RotX(context):
+    for i in bpy.context.selected_objects:
+        i.rotation_euler.x = bpy.context.active_object.rotation_euler.x
 
-            col = layout.column_flow(columns=3,align=True)
-            col.prop(sce,"Aling_RotationX",text="X")
-            col.prop(sce,"Aling_RotationY",text="Y")
-            col.prop(sce,"Aling_RotationZ",text="Z")
+def RotY(context):
+    for i in bpy.context.selected_objects:
+        i.rotation_euler.y = bpy.context.active_object.rotation_euler.y
 
-            col = layout.column()
-            col.label(text="Align Scale:", icon='MAN_SCALE')
+def RotZ(context):
+    for i in bpy.context.selected_objects:
+        i.rotation_euler.z = bpy.context.active_object.rotation_euler.z
+## Aling Scale
+def ScaleAll(context):
+    for i in bpy.context.selected_objects:
+        i.scale = bpy.context.active_object.scale
 
-            col = layout.column_flow(columns=3,align=True)
-            col.prop(sce,"Aling_ScaleX",text="X")
-            col.prop(sce,"Aling_ScaleY",text="Y")
-            col.prop(sce,"Aling_ScaleZ",text="Z")
+def ScaleX(context):
+    for i in bpy.context.selected_objects:
+        i.scale.x = bpy.context.active_object.scale.x
 
-            col = layout.column(align=False)
-            col.operator("object.AlignObjects",text="Align")
-##Methods
-##################
+def ScaleY(context):
+    for i in bpy.context.selected_objects:
+        i.scale.y = bpy.context.active_object.scale.y
 
-##Get World Verts location
+def ScaleZ(context):
+    for i in bpy.context.selected_objects:
+        i.scale.z = bpy.context.active_object.scale.z
 
-def VertCoordSysLocalToWorld(obj):
-    NewList = []
+## Classes
 
-    for i in obj.data.vertices:
-        WorldVert=(obj.matrix_world*i.co)-obj.location
-        NewList.append(WorldVert)
-    return NewList
-
-##Create World bound_box
-def CreateWorldBoundBox(obj):
-    World_bound_box = []
-    Xlist=[]
-    Ylist=[]
-    Zlist=[]
-    
-    #separate X Y and Z
-    for i in VertCoordSysLocalToWorld(obj):
-        Xlist.append(i.x)
-        Ylist.append(i.y)
-        Zlist.append(i.z)
-    
-    # Sort all values
-    Xlist = sorted(Xlist)
-    Ylist = sorted(Ylist)
-    Zlist = sorted(Zlist)
-    # assing Minimum and maximum values
-    Xmin = Xlist[0]
-    Xmax = Xlist[-1]
-    Ymin = Ylist[0]
-    Ymax = Ylist[-1]
-    Zmin = Zlist[0]
-    Zmax = Zlist[-1]
-    World_bound_box = [Xmin,Xmax,Ymin,Ymax,Zmin,Zmax]
-    return World_bound_box
-##Align
-def main(context):
-    sce = bpy.context.scene
-    obj = bpy.context.object
-    The_i_OffSet=[]
-    TheActiveObjOffset=[]
-    activeObjWorldBoundBox = CreateWorldBoundBox(obj)
-    
-    for i in bpy.context.selected_objects:

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list