+ return self.set_input_from_linked(separate.inputs["Image"])
+
+ def check_additive_blend(self):
+ if self.node.type=='ADD_SHADER':
+ from .util import get_linked_node_and_socket
+
+ for i in range(2):
+ shader, _ = get_linked_node_and_socket(self.node_tree, self.node.inputs[i])
+ if shader.type=='BSDF_TRANSPARENT':
+ self.type = 'ADDITIVE'
+ return self.set_input_from_linked(self.node.inputs[1-i])
+
+ def check_texture(self):
+ if self.node.type=='TEX_IMAGE':
+ self.type = 'TEXTURE'
+
+def get_unlit_inputs(node_tree, node, additive):
+ from .util import get_linked_node_and_socket
+
+ if node.type=='MIX_SHADER' and not additive:
+ shader1, _ = get_linked_node_and_socket(node_tree, node.inputs[1])
+ shader2, _ = get_linked_node_and_socket(node_tree, node.inputs[2])
+ if shader1.type=='BSDF_TRANSPARENT' and shader2.type=='EMISSION':
+ factor_input = node.inputs["Fac"]
+ factor_from, _ = get_linked_node_and_socket(node_tree, factor_input)
+ color_input = shader2.inputs["Color"]
+ color_from, _ = get_linked_node_and_socket(node_tree, color_input)
+ if factor_from==color_from:
+ return (color_input, factor_input)
+ elif node.type=='EMISSION':
+ color_input = node.inputs["Color"]
+ if additive:
+ color_from, _ = get_linked_node_and_socket(node_tree, color_input)
+ if color_from.type=='MIX_RGB' and color_from.blend_type=='MIX':
+ mix_factor_input = color_from.inputs["Fac"]
+ mix_factor_from, _ = get_linked_node_and_socket(node_tree, mix_factor_input)
+ mix_color_input = color_from.inputs["Color2"]
+ mix_color_from, _ = get_linked_node_and_socket(node_tree, mix_color_input)
+ if mix_factor_from==mix_color_from:
+ return (mix_color_input, mix_factor_input)
+ return (color_input, None)
+ return (None, None)