@add_object.register(core.FlatMaterial)
def _add_object(obj: core.FlatMaterial):
    mat = bpy.data.materials.new('Holdout')
    mat.use_nodes = True
    tree = mat.node_tree
    tree.nodes.remove(tree.nodes['Principled BSDF'])
    output_node = tree.nodes['Material Output']
    light_path_node = tree.nodes.new(type='ShaderNodeLightPath')
    holdout_node = tree.nodes.new(type='ShaderNodeHoldout')
    transparent_node = tree.nodes.new(type='ShaderNodeBsdfTransparent')
    holdout_mix_node = tree.nodes.new(type='ShaderNodeMixShader')
    indirect_mix_node = tree.nodes.new(type='ShaderNodeMixShader')
    overall_mix_node = tree.nodes.new(type='ShaderNodeMixShader')
    emission_node = tree.nodes.new(type='ShaderNodeEmission')
    tree.links.new(transparent_node.outputs['BSDF'], indirect_mix_node.inputs[1])
    tree.links.new(emission_node.outputs['Emission'], indirect_mix_node.inputs[2])
    tree.links.new(emission_node.outputs['Emission'], holdout_mix_node.inputs[1])
    tree.links.new(holdout_node.outputs['Holdout'], holdout_mix_node.inputs[2])
    tree.links.new(light_path_node.outputs['Is Camera Ray'], overall_mix_node.inputs['Fac'])
    tree.links.new(indirect_mix_node.outputs['Shader'], overall_mix_node.inputs[1])
    tree.links.new(holdout_mix_node.outputs['Shader'], overall_mix_node.inputs[2])
    tree.links.new(overall_mix_node.outputs['Shader'], output_node.inputs['Surface'])
    return (mat, {'color': core.AttributeSetter(emission_node.inputs['Color'], 'default_value'), 'holdout': core.AttributeSetter(holdout_mix_node.inputs['Fac'], 'default_value'), 'indirect_visibility': core.AttributeSetter(indirect_mix_node.inputs['Fac'], 'default_value')})
@add_object.register(core.FlatMaterial)
def _add_object(obj: core.FlatMaterial):
    mat = bpy.data.materials.new('Holdout')
    mat.use_nodes = True
    tree = mat.node_tree
    tree.nodes.remove(tree.nodes['Principled BSDF'])
    output_node = tree.nodes['Material Output']
    light_path_node = tree.nodes.new(type='ShaderNodeLightPath')
    holdout_node = tree.nodes.new(type='ShaderNodeHoldout')
    transparent_node = tree.nodes.new(type='ShaderNodeBsdfTransparent')
    holdout_mix_node = tree.nodes.new(type='ShaderNodeMixShader')
    indirect_mix_node = tree.nodes.new(type='ShaderNodeMixShader')
    overall_mix_node = tree.nodes.new(type='ShaderNodeMixShader')
    emission_node = tree.nodes.new(type='ShaderNodeEmission')
    tree.links.new(transparent_node.outputs['BSDF'], indirect_mix_node.inputs[1])
    tree.links.new(emission_node.outputs['Emission'], indirect_mix_node.inputs[2])
    tree.links.new(emission_node.outputs['Emission'], holdout_mix_node.inputs[1])
    tree.links.new(holdout_node.outputs['Holdout'], holdout_mix_node.inputs[2])
    tree.links.new(light_path_node.outputs['Is Camera Ray'], overall_mix_node.inputs['Fac'])
    tree.links.new(indirect_mix_node.outputs['Shader'], overall_mix_node.inputs[1])
    tree.links.new(holdout_mix_node.outputs['Shader'], overall_mix_node.inputs[2])
    tree.links.new(overall_mix_node.outputs['Shader'], output_node.inputs['Surface'])
    return (mat, {'color': core.AttributeSetter(emission_node.inputs['Color'], 'default_value'), 'holdout': core.AttributeSetter(holdout_mix_node.inputs['Fac'], 'default_value'), 'indirect_visibility': core.AttributeSetter(indirect_mix_node.inputs['Fac'], 'default_value')})