Fix non-geometry object types being possible to set as light receivers

This commit is contained in:
Brecht Van Lommel
2023-05-25 13:44:03 +02:00
parent e3c5306d4e
commit c6c127bfd3

View File

@@ -186,8 +186,11 @@ void BKE_light_linking_add_receiver_to_collection(Main *bmain,
CollectionLightLinking *collection_light_linking = nullptr;
if (id_type == ID_OB) {
collection_light_linking = light_linking_collection_add_object(
bmain, collection, reinterpret_cast<Object *>(receiver));
Object *object = reinterpret_cast<Object *>(receiver);
if (!OB_TYPE_IS_GEOMETRY(object->type)) {
return;
}
collection_light_linking = light_linking_collection_add_object(bmain, collection, object);
}
else if (id_type == ID_GR) {
collection_light_linking = light_linking_collection_add_collection(
@@ -244,6 +247,10 @@ void BKE_light_linking_link_receiver_to_emitter(Main *bmain,
const LightLinkingType link_type,
const eCollectionLightLinkingState link_state)
{
if (!OB_TYPE_IS_GEOMETRY(receiver->type)) {
return;
}
Collection *collection = BKE_light_linking_collection_get(emitter, link_type);
if (!collection) {