def set_blend_add_flavor(node_tree, switch_on): """Set blend add flavor to this shader. :param node_tree: node tree of current shader :type node_tree: bpy.types.NodeTree :param switch_on: flag indication if blend add should be switched on or off :type switch_on: bool """ # remove alpha test flavor if it was set already. Because these two can not coexist if alpha_test.is_set(node_tree): DifSpecMultDifSpec.set_alpha_test_flavor(node_tree, False) out_node = node_tree.nodes[DifSpecMultDifSpec.OUT_MAT_NODE] in_node = node_tree.nodes[DifSpecMultDifSpec.VCOL_GROUP_NODE] if switch_on: blend_add.init(node_tree, in_node.outputs['Vertex Color Alpha'], out_node.inputs['Alpha']) else: blend_add.delete(node_tree)
def set_blend_add_flavor(node_tree, switch_on): """Set blend add flavor to this shader. :param node_tree: node tree of current shader :type node_tree: bpy.types.NodeTree :param switch_on: flag indication if blend add should be switched on or off :type switch_on: bool """ # remove alpha test flavor if it was set already. Because these two can not coexist if alpha_test.is_set(node_tree): Dif.set_alpha_test_flavor(node_tree, False) out_node = node_tree.nodes[Dif.OUT_MAT_NODE] in_node = node_tree.nodes[Dif.BASE_TEX_NODE] if switch_on: blend_add.init(node_tree, in_node.outputs['Value'], out_node.inputs['Alpha']) else: blend_add.delete(node_tree)
def set_blend_add_flavor(node_tree, switch_on): """Set blend add flavor to this shader. :param node_tree: node tree of current shader :type node_tree: bpy.types.NodeTree :param switch_on: flag indication if blend add should be switched on or off :type switch_on: bool """ # remove alpha test flavor if it was set already. Because these two can not coexist if alpha_test.is_set(node_tree): UnlitTex.set_alpha_test_flavor(node_tree, False) if switch_on: out_node = node_tree.nodes[UnlitTex.OUTPUT_NODE] in_node = node_tree.nodes[UnlitTex.BASE_TEX_NODE] blend_add.init(node_tree, in_node.outputs['Value'], out_node.inputs['Alpha']) else: blend_add.delete(node_tree)
def set_blend_add_flavor(node_tree, switch_on): """Set blend add flavor to this shader. :param node_tree: node tree of current shader :type node_tree: bpy.types.NodeTree :param switch_on: flag indication if blend add should be switched on or off :type switch_on: bool """ if switch_on: in_node = node_tree.nodes[UnlitVcolTex.OUT_SHADER_NODE] out_node = node_tree.nodes[UnlitVcolTex.OUTPUT_NODE] # put it on location of output node & move output node for one slot to the right location = tuple(out_node.location) out_node.location.x += 185 blend_add.init(node_tree, location, in_node.outputs['BSDF'], out_node.inputs['Surface']) else: blend_add.delete(node_tree)