def lightmap_to_emission(self, context, connect):
    vis_mats = material_functions.get_all_visible_materials()
    for material in vis_mats:
        if (not material.node_tree):
            continue
        nodes = material.node_tree.nodes
        pbr_node = node_functions.get_pbr_node(material)
        lightmap_node = nodes.get('Lightmap')
        if (lightmap_node is None):
            continue
        emission_input = node_functions.get_pbr_inputs(pbr_node)['emission_input']
        lightmap_output = lightmap_node.outputs['Color']
        if connect:
            node_functions.make_link(material, lightmap_output, emission_input)
        else:
            node_functions.remove_link(material, lightmap_output, emission_input)
def lightmap_to_emission(self, context, connect):
    vis_mats = material_functions.get_all_visible_materials()
    for material in vis_mats:
        if (not material.node_tree):
            continue
        nodes = material.node_tree.nodes
        pbr_node = node_functions.get_pbr_node(material)
        lightmap_node = nodes.get('Lightmap')
        if (lightmap_node is None):
            continue
        emission_input = node_functions.get_pbr_inputs(pbr_node)['emission_input']
        lightmap_output = lightmap_node.outputs['Color']
        if connect:
            node_functions.make_link(material, lightmap_output, emission_input)
        else:
            node_functions.remove_link(material, lightmap_output, emission_input)