[Bf-extensions-cvs] [9ebba779] master: space_view3d_align_tools: moved to release: T65739

meta-androcto noreply at git.blender.org
Sat Jun 15 02:40:49 CEST 2019


Commit: 9ebba7794ccdbaa5d30b40a56fe7c045f4bcaa89
Author: meta-androcto
Date:   Sat Jun 15 10:40:18 2019 +1000
Branches: master
https://developer.blender.org/rBAC9ebba7794ccdbaa5d30b40a56fe7c045f4bcaa89

space_view3d_align_tools: moved to release: T65739

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

D	space_view3d_align_tools.py

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

diff --git a/space_view3d_align_tools.py b/space_view3d_align_tools.py
deleted file mode 100644
index 1c3afb77..00000000
--- a/space_view3d_align_tools.py
+++ /dev/null
@@ -1,1173 +0,0 @@
-# -*- coding: utf-8 -*-
-# ##### BEGIN GPL LICENSE BLOCK #####
-#
-#  This program is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU General Public License
-#  as published by the Free Software Foundation; either version 2
-#  of the License, or (at your option) any later version.
-#
-#  This program is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#  GNU General Public License for more details.
-#
-#  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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# ##### END GPL LICENSE BLOCK #####
-# Contributed to by gabhead, Lell, Anfeo, meta-androcto
-
-bl_info = {
-    "name": "Align Tools",
-    "author": "gabhead, Lell, Anfeo",
-    "version": (0, 3, 4),
-    "blender": (2, 80, 0),
-    "location": "View3D > Tool Shelf > Tools",
-    "description": "Align Selected Objects to Active Object",
-    "warning": "",
-    "wiki_url": "https://wiki.blender.org/index.php/Extensions:2.6/Py/"
-                "Scripts/3D interaction/Align_Tools",
-    "tracker_url": "https://developer.blender.org/maniphest/task/edit/form/2/",
-    "category": "3D View",
-}
-
-import bpy
-from bpy.types import (
-        Operator,
-        Panel,
-        AddonPreferences,
-        )
-from bpy.props import (
-        EnumProperty,
-        BoolProperty,
-        FloatVectorProperty,
-        StringProperty,
-        )
-from mathutils import (
-        Vector,
-        Matrix,
-        )
-
-
-# Simple Align Defs #
-
-# 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
-
-
-# Align Location
-def LocAll(context):
-    for i in bpy.context.selected_objects:
-        i.location = bpy.context.active_object.location
-
-
-def LocX(context):
-    for i in bpy.context.selected_objects:
-        i.location.x = bpy.context.active_object.location.x
-
-
-def LocY(context):
-    for i in bpy.context.selected_objects:
-        i.location.y = bpy.context.active_object.location.y
-
-
-def LocZ(context):
-    for i in bpy.context.selected_objects:
-        i.location.z = bpy.context.active_object.location.z
-
-
-# Align Rotation
-def RotAll(context):
-    for i in bpy.context.selected_objects:
-        i.rotation_euler = bpy.context.active_object.rotation_euler
-
-
-def RotX(context):
-    for i in bpy.context.selected_objects:
-        i.rotation_euler.x = bpy.context.active_object.rotation_euler.x
-
-
-def RotY(context):
-    for i in bpy.context.selected_objects:
-        i.rotation_euler.y = bpy.context.active_object.rotation_euler.y
-
-
-def RotZ(context):
-    for i in bpy.context.selected_objects:
-        i.rotation_euler.z = bpy.context.active_object.rotation_euler.z
-
-
-# Align Scale
-def ScaleAll(context):
-    for i in bpy.context.selected_objects:
-        i.scale = bpy.context.active_object.scale
-
-
-def ScaleX(context):
-    for i in bpy.context.selected_objects:
-        i.scale.x = bpy.context.active_object.scale.x
-
-
-def ScaleY(context):
-    for i in bpy.context.selected_objects:
-        i.scale.y = bpy.context.active_object.scale.y
-
-
-def ScaleZ(context):
-    for i in bpy.context.selected_objects:
-        i.scale.z = bpy.context.active_object.scale.z
-
-
-# Advanced Align Defs #
-
-# subject to object 0, 1 and 2 to pivot for cursor
-def align_function(subject, active_too, consistent, self_or_active, loc_x, loc_y, loc_z, ref1, ref2, loc_offset,
-                   rot_x, rot_y, rot_z, rot_offset, scale_x, scale_y, scale_z, scale_offset,
-                   fit_x, fit_y, fit_z):
-
-    sel_obj = bpy.context.selected_objects
-    act_obj = bpy.context.active_object
-
-    global sel_max
-    global sel_min
-    global sel_center
-    global ref2_co
-
-    def get_reference_points(obj, space):
-
-        me = obj.data
-        co_list = []
-        # let's get all the points coodinates
-        if space == "global":
-            ok = False
-            obj_mtx = obj.matrix_world
-            if obj.type == 'MESH' and len(me.vertices) > 0:
-                ok = True
-                for p in me.vertices:
-                    co_list.append((obj_mtx @ p.co))
-
-            elif obj.type == 'SURFACE' and len(me.splines) > 0:
-                ok = True
-                for s in me.splines:
-                    for p in s.points:
-                        co_list.append((obj_mtx @ p.co))
-            elif obj.type == 'FONT' and len(me.splines) > 0:
-                ok = True
-                for s in me.splines:
-                    for p in s.bezier_points:
-                        co_list.append((obj_mtx @ p.co))
-
-        elif space == "local":
-            ok = False
-            if obj.type == 'MESH' and len(me.vertices) > 0:
-                ok = True
-                for p in me.vertices:
-                    co_list.append(p.co)
-
-            elif obj.type == 'SURFACE' and len(me.splines) > 0:
-                ok = True
-                for s in me.splines:
-                    for p in s.points:
-                        co_list.append(p.co)
-            elif obj.type == 'FONT' and len(obj.data.splines) > 0:
-                ok = True
-                for s in me.splines:
-                    for p in s.bezier_points:
-                        co_list.append(p.co)
-
-        # if a valid point found
-        # proceed to calculate the extremes
-        if ok:
-            max_x = co_list[0][0]
-            min_x = co_list[0][0]
-            max_y = co_list[0][1]
-            min_y = co_list[0][1]
-            max_z = co_list[0][2]
-            min_z = co_list[0][2]
-
-            for v in co_list:
-                # the strings of the list compared with the smaller and more found
-                # in order to find the minor and major for each axis
-                act_x = v[0]
-                if act_x > max_x:
-                    max_x = act_x
-                if act_x < min_x:
-                    min_x = act_x
-
-                act_y = v[1]
-                if act_y > max_y:
-                    max_y = act_y
-                if act_y < min_y:
-                    min_y = act_y
-
-                act_z = v[2]
-                if act_z > max_z:
-                    max_z = act_z
-                if act_z < min_z:
-                    min_z = act_z
-
-        else:
-            # otherwise use the pivot object
-            a = obj.location
-            min_x = a[0]
-            max_x = a[0]
-            min_y = a[1]
-            max_y = a[1]
-            min_z = a[2]
-            max_z = a[2]
-
-        center_x = min_x + ((max_x - min_x) / 2)
-        center_y = min_y + ((max_y - min_y) / 2)
-        center_z = min_z + ((max_z - min_z) / 2)
-
-        reference_points = [min_x, center_x, max_x, min_y, center_y, max_y, min_z, center_z, max_z]
-        return reference_points
-
-    def get_sel_ref(ref_co, sel_obj):  # I look for the selection end points
-
-        sel_min = ref_co.copy()
-        sel_max = ref_co.copy()
-
-        for obj in sel_obj:
-            if obj != act_obj or (active_too and obj == act_obj):
-
-                ref_points = get_reference_points(obj, "global")
-                ref_min = Vector([ref_points[0], ref_points[3], ref_points[6]])
-                ref_max = Vector([ref_points[2], ref_points[5], ref_points[8]])
-
-                if ref_min[0] < sel_min[0]:
-                    sel_min[0] = ref_min[0]
-                if ref_max[0] > sel_max[0]:
-                    sel_max[0] = ref_max[0]
-                if ref_min[1] < sel_min[1]:
-                    sel_min[1] = ref_min[1]
-                if ref_max[1] > sel_max[1]:
-                    sel_max[1] = ref_max[1]
-                if ref_min[2] < sel_min[2]:
-                    sel_min[2] = ref_min[2]
-                if ref_max[2] > sel_max[2]:
-                    sel_max[2] = ref_max[2]
-
-        return sel_min, sel_max
-
-    def find_ref2_co(act_obj):
-        # It contains the coordinates of the reference point for the positioning
-        if ref2 == "0":
-            ref_points = get_reference_points(act_obj, "global")
-            ref2_co = [ref_points[0], ref_points[3], ref_points[6]]
-            ref2_co = Vector(ref2_co)
-        elif ref2 == "1":
-            ref_points = get_reference_points(act_obj, "global")
-            ref2_co = [ref_points[1], ref_points[4], ref_points[7]]
-            ref2_co = Vector(ref2_co)
-        elif ref2 == "2":
-            ref2_co = act_obj.location
-            ref2_co = Vector(ref2_co)
-        elif ref2 == "3":
-            ref_points = get_reference_points(act_obj, "global")
-            ref2_co = [ref_points[2], ref_points[5], ref_points[8]]
-            ref2_co = Vector(ref2_co)
-        elif ref2 == "4":
-            ref2_co = bpy.context.scene.cursor.location
-
-        return ref2_co
-
-    def find_new_coord(obj):
-
-        ref_points = get_reference_points(obj, "global")
-
-        if loc_x is True:
-            if ref1 == "0":
-                min_x = ref_points[0]
-                new_x = ref2_co[0] + (obj.location[0] - min_x) + loc_offset[0]
-            elif ref1 == "1":
-                center_x = ref_points[1]
-                new_x = ref2_co[0] + (obj.location[0] - center_x) + loc_offset[0]
-            elif ref1 == "2":
-                new_x = ref2_co[0] + loc_offset[0]
-            elif ref1 == "3":
-                max_x = ref_points[2]
-                new_x = ref2_co[0] - (max_x - obj.location[0]) + loc_offset[0]
-            obj.location[0] = new_x
-        if loc_y is True:
-            if ref1 == "0":
-                min_y = ref_points[3]
-                new_y = ref2_co[1] + (obj.location[1] - min_y) + loc_offset[1]
-            elif ref

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list