[Bf-blender-cvs] [15b4120064f] master: Make Instance Face: Support instanced collections too

Dalai Felinto noreply at git.blender.org
Wed Jun 15 13:53:40 CEST 2022


Commit: 15b4120064f192c29ed5b324bf8e63aa49b95ca6
Author: Dalai Felinto
Date:   Wed Jun 15 13:01:39 2022 +0200
Branches: master
https://developer.blender.org/rB15b4120064f192c29ed5b324bf8e63aa49b95ca6

Make Instance Face: Support instanced collections too

Differential Revision: https://developer.blender.org/D15204

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

M	release/scripts/startup/bl_operators/object.py

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

diff --git a/release/scripts/startup/bl_operators/object.py b/release/scripts/startup/bl_operators/object.py
index 60f534b3ab6..6e08d557353 100644
--- a/release/scripts/startup/bl_operators/object.py
+++ b/release/scripts/startup/bl_operators/object.py
@@ -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'



More information about the Bf-blender-cvs mailing list