Make Instance Face: Support instanced collections too

Differential Revision: https://developer.blender.org/D15204
This commit is contained in:
Dalai Felinto 2022-06-15 13:01:39 +02:00
parent 41053deba4
commit 15b4120064
1 changed files with 8 additions and 1 deletions

View File

@ -596,6 +596,8 @@ class MakeDupliFace(Operator):
for obj in context.selected_objects:
if obj.type == 'MESH':
linked[obj.data].append(obj)
elif obj.type == 'EMPTY' and obj.instance_type == 'COLLECTION' and obj.instance_collection:
linked[obj.instance_collection].append(obj)
for data, objects in linked.items():
face_verts = [axis for obj in objects
@ -621,7 +623,12 @@ class MakeDupliFace(Operator):
ob_new = bpy.data.objects.new(mesh.name, mesh)
context.collection.objects.link(ob_new)
ob_inst = bpy.data.objects.new(data.name, data)
if type(data) is bpy.types.Collection:
ob_inst = bpy.data.objects.new(data.name, None)
ob_inst.instance_type = 'COLLECTION'
ob_inst.instance_collection = data
else:
ob_inst = bpy.data.objects.new(data.name, data)
context.collection.objects.link(ob_inst)
ob_new.instance_type = 'FACES'