Cycles: Added Cryptomatte output.
[blender.git] / intern / cycles / blender / blender_object.cpp
index 0fab9ab35316e78bb31e4fa023d699c8dc9a0c48..a05c982b367f5a512add5b12d5c1fdf97cc8584c 100644 (file)
@@ -384,6 +384,23 @@ Object *BlenderSync::sync_object(BL::Object& b_parent,
                object_updated = true;
        }
 
+       /* sync the asset name for Cryptomatte */
+       BL::Object parent = b_ob.parent();
+       ustring parent_name;
+       if(parent) {
+               while(parent.parent()) {
+                       parent = parent.parent();
+               }
+               parent_name = parent.name();
+       }
+       else {
+               parent_name = b_ob.name();
+       }
+       if(object->asset_name != parent_name) {
+               object->asset_name = parent_name;
+               object_updated = true;
+       }
+
        /* object sync
         * transform comparison should not be needed, but duplis don't work perfect
         * in the depsgraph and may not signal changes, so this is a workaround */