fix [#30017] Make Dupli-Face needs active mesh object
authorCampbell Barton <ideasman42@gmail.com>
Sun, 29 Jan 2012 21:28:04 +0000 (21:28 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 29 Jan 2012 21:28:04 +0000 (21:28 +0000)
release/scripts/startup/bl_operators/object.py

index 738cc7b24e00047f406e418871c41d5a1f27f89b..2c329de36440fd4145a9d4962726e02104ea5952 100644 (file)
@@ -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))