Fix #119316: instancing lamps does not work

The issue was that calling `ensure_geometry_instances` converts all instances to a
geometry, even the ones that can't be converted. The comment already says that
non-geometry instances should stay intact, but that didn't work correctly yet:
```
  /**
   * If references have a collection or object type, convert them into geometry instances
   * recursively. After that, the geometry sets can be edited. There may still be instances of
   * other types of they can't be converted to geometry sets.
   */
```

Pull Request: https://projects.blender.org/blender/blender/pulls/119324
This commit is contained in:
Jacques Lucke 2024-03-11 15:58:40 +01:00
parent 8b9abd09c8
commit 4d0936c7d7
1 changed files with 5 additions and 1 deletions

View File

@ -115,7 +115,11 @@ void Instances::ensure_geometry_instances()
case InstanceReference::Type::Object: {
/* Create a new reference that contains the geometry set of the object. We may want to
* treat e.g. lamps and similar object types separately here. */
const Object &object = reference.object();
Object &object = reference.object();
if (ELEM(object.type, OB_LAMP, OB_CAMERA, OB_SPEAKER, OB_ARMATURE, OB_GPENCIL_LEGACY)) {
new_references.append(InstanceReference(object));
break;
}
GeometrySet object_geometry_set = object_get_evaluated_geometry_set(object);
if (object_geometry_set.has_instances()) {
object_geometry_set.get_instances_for_write()->ensure_geometry_instances();