forked from bartvdbraak/blender
fix [#30017] Make Dupli-Face needs active mesh object
This commit is contained in:
parent
b820ec4ae4
commit
56fe01c3fb
@ -489,8 +489,7 @@ class ShapeTransfer(Operator):
|
||||
return (obj and obj.mode != 'EDIT')
|
||||
|
||||
def execute(self, context):
|
||||
C = bpy.context
|
||||
ob_act = C.active_object
|
||||
ob_act = context.active_object
|
||||
objects = [ob for ob in C.selected_editable_objects if ob != ob_act]
|
||||
|
||||
if 1: # swap from/to, means we cant copy to many at once.
|
||||
@ -585,11 +584,6 @@ class MakeDupliFace(Operator):
|
||||
bl_idname = "object.make_dupli_face"
|
||||
bl_label = "Make Dupli-Face"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
obj = context.active_object
|
||||
return (obj and obj.type == 'MESH')
|
||||
|
||||
def _main(self, context):
|
||||
from mathutils import Vector
|
||||
|
||||
@ -601,22 +595,22 @@ class MakeDupliFace(Operator):
|
||||
Vector((-offset, +offset, 0.0)),
|
||||
)
|
||||
|
||||
def matrix_to_quat(matrix):
|
||||
def matrix_to_quad(matrix):
|
||||
# scale = matrix.median_scale
|
||||
trans = matrix.to_translation()
|
||||
rot = matrix.to_3x3() # also contains scale
|
||||
|
||||
return [(rot * b) + trans for b in base_tri]
|
||||
scene = bpy.context.scene
|
||||
scene = context.scene
|
||||
linked = {}
|
||||
for obj in bpy.context.selected_objects:
|
||||
for obj in context.selected_objects:
|
||||
data = obj.data
|
||||
if data:
|
||||
linked.setdefault(data, []).append(obj)
|
||||
|
||||
for data, objects in linked.items():
|
||||
face_verts = [axis for obj in objects
|
||||
for v in matrix_to_quat(obj.matrix_world)
|
||||
for v in matrix_to_quad(obj.matrix_world)
|
||||
for axis in v]
|
||||
|
||||
faces = list(range(len(face_verts) // 3))
|
||||
|
Loading…
Reference in New Issue
Block a user