[docs]defset_shadow_catcher(obj:Union[str,Renderable],state=False):"""Set object is_shadow_catcher and various visibility_* properties to make object act as a shadow catcher or revert the changes. Args: obj (Union[str, Renderable]): tag of the Blender object or instance of Renderable state (bool): if True make obj a shadow catcher, otherwise make it a regular object """ifnotisinstance(obj,str):obj=obj.tag# select objectbpy.data.objects[obj].select_set(True)bpy.context.view_layer.objects.active=bpy.data.objects[obj]shadow_catcher=bpy.context.active_object# set / unset shadow catcher propertiesshadow_catcher.is_shadow_catcher=stateshadow_catcher.cycles.is_shadow_catcher=stateshadow_catcher.visible_glossy=notstateshadow_catcher.visible_diffuse=notstateshadow_catcher.visible_transmission=notstateshadow_catcher.visible_volume_scatter=notstate# deselect objectbpy.data.objects[obj].select_set(False)