def init(node_tree): """Initialize node tree with links for this shader. :param node_tree: node tree on which this shader should be created :type node_tree: bpy.types.NodeTree """ # init parents DifSpecMultDifSpec.init(node_tree) StdAddEnv.add(node_tree, DifSpecMultDifSpec.GEOM_NODE, DifSpecMultDifSpec.SPEC_COL_NODE, DifSpecMultDifSpec.BASE_TEX_NODE, DifSpecMultDifSpec.OUT_MAT_NODE, DifSpecMultDifSpec.OUTPUT_NODE)
def init(node_tree): """Initialize node tree with links for this shader. :param node_tree: node tree on which this shader should be created :type node_tree: bpy.types.NodeTree """ # init parents DifSpecMultDifSpec.init(node_tree) StdAddEnv.add( node_tree, DifSpecMultDifSpec.GEOM_NODE, node_tree.nodes[DifSpecMultDifSpec.SPEC_COL_NODE].outputs['Color'], node_tree.nodes[DifSpecMultDifSpec.BASE_TEX_NODE].outputs['Value'], node_tree.nodes[DifSpecMultDifSpec.OUT_MAT_NODE].outputs['Normal'], node_tree.nodes[ DifSpecMultDifSpec.COMPOSE_LIGHTING_NODE].inputs['Env Color'])
def init(node_tree): """Initialize node tree with links for this shader. :param node_tree: node tree on which this shader should be created :type node_tree: bpy.types.NodeTree """ # init parents DifSpecMultDifSpec.init(node_tree) StdAddEnv.add( node_tree, DifSpecMultDifSpec.GEOM_NODE, node_tree.nodes[DifSpecMultDifSpec.SPEC_COL_NODE].outputs['Color'], node_tree.nodes[DifSpecMultDifSpec.BASE_TEX_NODE].outputs['Alpha'], node_tree.nodes[ DifSpecMultDifSpec.LIGHTING_EVAL_NODE].outputs['Normal'], node_tree.nodes[ DifSpecMultDifSpec.COMPOSE_LIGHTING_NODE].inputs['Env Color']) mult_tex_n = node_tree.nodes[DifSpecMultDifSpec.MULT_TEX_NODE] add_env_gn = node_tree.nodes[StdAddEnv.ADD_ENV_GROUP_NODE] # links creation node_tree.links.new(add_env_gn.inputs['Strength Multiplier'], mult_tex_n.outputs['Alpha'])
def init(node_tree): """Initialize node tree with links for this shader. :param node_tree: node tree on which this shader should be created :type node_tree: bpy.types.NodeTree """ start_pos_x = 0 start_pos_y = 0 pos_x_shift = 185 # init parent DifSpecMultDifSpec.init(node_tree) vcol_group_n = node_tree.nodes[DifSpecMultDifSpec.VCOL_GROUP_NODE] mult_base_col_mix_n = node_tree.nodes[DifSpecMultDifSpec.MULT_BASE_COL_MIX_NODE] mult_base_a_mix_n = node_tree.nodes[DifSpecMultDifSpec.MULT_BASE_A_MIX_NODE] vcol_scale_n = node_tree.nodes[DifSpecMultDifSpec.VCOLOR_SCALE_NODE] vcol_mult_n = node_tree.nodes[DifSpecMultDifSpec.VCOLOR_MULT_NODE] diff_mult_n = node_tree.nodes[DifSpecMultDifSpec.DIFF_MULT_NODE] spec_mult_n = node_tree.nodes[DifSpecMultDifSpec.SPEC_MULT_NODE] # move existing spec_mult_n.location.x += pos_x_shift vcol_scale_n.location.y -= 200 vcol_mult_n.location.y -= 200 diff_mult_n.location.y -= 200 mult_base_col_mix_n.location.y -= 200 # node creation third_geom_n = node_tree.nodes.new("ShaderNodeGeometry") third_geom_n.name = DifSpecMultDifSpecIamodDifSpec.THIRD_GEOM_NODE third_geom_n.label = DifSpecMultDifSpecIamodDifSpec.THIRD_GEOM_NODE third_geom_n.location = (start_pos_x - pos_x_shift, start_pos_y + 900) third_geom_n.uv_layer = _MESH_consts.none_uv iamod_tex_n = node_tree.nodes.new("ShaderNodeTexture") iamod_tex_n.name = DifSpecMultDifSpecIamodDifSpec.IAMOD_TEX_NODE iamod_tex_n.label = DifSpecMultDifSpecIamodDifSpec.IAMOD_TEX_NODE iamod_tex_n.location = (start_pos_x + pos_x_shift, start_pos_y + 900) iamod_scale_col_n = node_tree.nodes.new("ShaderNodeMixRGB") iamod_scale_col_n.name = DifSpecMultDifSpecIamodDifSpec.IAMOD_SCALE_NODE iamod_scale_col_n.label = DifSpecMultDifSpecIamodDifSpec.IAMOD_SCALE_NODE iamod_scale_col_n.location = (start_pos_x + pos_x_shift * 3, start_pos_y + 1000) iamod_scale_col_n.blend_type = "MIX" iamod_scale_col_n.inputs['Color2'].default_value = (1,) * 4 iamod_scale_a_n = node_tree.nodes.new("ShaderNodeMixRGB") iamod_scale_a_n.name = DifSpecMultDifSpecIamodDifSpec.IAMOD_SCALE_A_NODE iamod_scale_a_n.label = DifSpecMultDifSpecIamodDifSpec.IAMOD_SCALE_A_NODE iamod_scale_a_n.location = (start_pos_x + pos_x_shift * 3, start_pos_y + 1500) iamod_scale_a_n.blend_type = "MIX" iamod_scale_a_n.inputs['Color2'].default_value = (1,) * 4 iamod_multbase_col_mix_n = node_tree.nodes.new("ShaderNodeMixRGB") iamod_multbase_col_mix_n.name = DifSpecMultDifSpecIamodDifSpec.IAMOD_MULTBASE_COL_MIX_NODE iamod_multbase_col_mix_n.label = DifSpecMultDifSpecIamodDifSpec.IAMOD_MULTBASE_COL_MIX_NODE iamod_multbase_col_mix_n.location = (start_pos_x + pos_x_shift * 4, start_pos_y + 1100) iamod_multbase_col_mix_n.blend_type = "MULTIPLY" iamod_multbase_col_mix_n.inputs['Fac'].default_value = 1 iamod_multbase_a_mix_n = node_tree.nodes.new("ShaderNodeMath") iamod_multbase_a_mix_n.name = DifSpecMultDifSpecIamodDifSpec.IAMOD_MULTBASE_A_MIX_NODE iamod_multbase_a_mix_n.label = DifSpecMultDifSpecIamodDifSpec.IAMOD_MULTBASE_A_MIX_NODE iamod_multbase_a_mix_n.location = (start_pos_x + pos_x_shift * 4, start_pos_y + 1600) iamod_multbase_a_mix_n.operation = "MULTIPLY" # links creation node_tree.links.new(iamod_tex_n.inputs['Vector'], third_geom_n.outputs['UV']) node_tree.links.new(iamod_scale_col_n.inputs['Fac'], vcol_group_n.outputs['Vertex Color Alpha']) node_tree.links.new(iamod_scale_col_n.inputs['Color1'], iamod_tex_n.outputs['Color']) node_tree.links.new(iamod_scale_a_n.inputs['Fac'], vcol_group_n.outputs['Vertex Color Alpha']) node_tree.links.new(iamod_scale_a_n.inputs['Color1'], iamod_tex_n.outputs['Value']) node_tree.links.new(iamod_multbase_col_mix_n.inputs['Color1'], mult_base_col_mix_n.outputs['Color']) node_tree.links.new(iamod_multbase_col_mix_n.inputs['Color2'], iamod_scale_col_n.outputs['Color']) node_tree.links.new(iamod_multbase_a_mix_n.inputs[0], mult_base_a_mix_n.outputs['Value']) node_tree.links.new(iamod_multbase_a_mix_n.inputs[1], iamod_scale_a_n.outputs['Color']) node_tree.links.new(vcol_mult_n.inputs['Color2'], iamod_multbase_col_mix_n.outputs['Color']) node_tree.links.new(spec_mult_n.inputs['Color2'], iamod_multbase_a_mix_n.outputs['Value'])
def init(node_tree): """Initialize node tree with links for this shader. :param node_tree: node tree on which this shader should be created :type node_tree: bpy.types.NodeTree """ start_pos_x = 0 start_pos_y = 0 pos_x_shift = 185 # init parent DifSpecMultDifSpec.init(node_tree) vcol_group_n = node_tree.nodes[DifSpecMultDifSpec.VCOL_GROUP_NODE] mult_base_col_mix_n = node_tree.nodes[ DifSpecMultDifSpec.MULT_BASE_COL_MIX_NODE] mult_base_a_mix_n = node_tree.nodes[ DifSpecMultDifSpec.MULT_BASE_A_MIX_NODE] vcol_scale_n = node_tree.nodes[DifSpecMultDifSpec.VCOLOR_SCALE_NODE] vcol_mult_n = node_tree.nodes[DifSpecMultDifSpec.VCOLOR_MULT_NODE] diff_mult_n = node_tree.nodes[DifSpecMultDifSpec.DIFF_MULT_NODE] spec_mult_n = node_tree.nodes[DifSpecMultDifSpec.SPEC_MULT_NODE] # move existing spec_mult_n.location.x += pos_x_shift vcol_scale_n.location.y -= 200 vcol_mult_n.location.y -= 200 diff_mult_n.location.y -= 200 mult_base_col_mix_n.location.y -= 200 # node creation third_geom_n = node_tree.nodes.new("ShaderNodeGeometry") third_geom_n.name = DifSpecMultDifSpecIamodDifSpec.THIRD_GEOM_NODE third_geom_n.label = DifSpecMultDifSpecIamodDifSpec.THIRD_GEOM_NODE third_geom_n.location = (start_pos_x - pos_x_shift, start_pos_y + 900) third_geom_n.uv_layer = _MESH_consts.none_uv iamod_tex_n = node_tree.nodes.new("ShaderNodeTexture") iamod_tex_n.name = DifSpecMultDifSpecIamodDifSpec.IAMOD_TEX_NODE iamod_tex_n.label = DifSpecMultDifSpecIamodDifSpec.IAMOD_TEX_NODE iamod_tex_n.location = (start_pos_x + pos_x_shift, start_pos_y + 900) iamod_scale_col_n = node_tree.nodes.new("ShaderNodeMixRGB") iamod_scale_col_n.name = DifSpecMultDifSpecIamodDifSpec.IAMOD_SCALE_NODE iamod_scale_col_n.label = DifSpecMultDifSpecIamodDifSpec.IAMOD_SCALE_NODE iamod_scale_col_n.location = (start_pos_x + pos_x_shift * 3, start_pos_y + 1000) iamod_scale_col_n.blend_type = "MIX" iamod_scale_col_n.inputs['Color2'].default_value = (1, ) * 4 iamod_scale_a_n = node_tree.nodes.new("ShaderNodeMixRGB") iamod_scale_a_n.name = DifSpecMultDifSpecIamodDifSpec.IAMOD_SCALE_A_NODE iamod_scale_a_n.label = DifSpecMultDifSpecIamodDifSpec.IAMOD_SCALE_A_NODE iamod_scale_a_n.location = (start_pos_x + pos_x_shift * 3, start_pos_y + 1500) iamod_scale_a_n.blend_type = "MIX" iamod_scale_a_n.inputs['Color2'].default_value = (1, ) * 4 iamod_multbase_col_mix_n = node_tree.nodes.new("ShaderNodeMixRGB") iamod_multbase_col_mix_n.name = DifSpecMultDifSpecIamodDifSpec.IAMOD_MULTBASE_COL_MIX_NODE iamod_multbase_col_mix_n.label = DifSpecMultDifSpecIamodDifSpec.IAMOD_MULTBASE_COL_MIX_NODE iamod_multbase_col_mix_n.location = (start_pos_x + pos_x_shift * 4, start_pos_y + 1100) iamod_multbase_col_mix_n.blend_type = "MULTIPLY" iamod_multbase_col_mix_n.inputs['Fac'].default_value = 1 iamod_multbase_a_mix_n = node_tree.nodes.new("ShaderNodeMath") iamod_multbase_a_mix_n.name = DifSpecMultDifSpecIamodDifSpec.IAMOD_MULTBASE_A_MIX_NODE iamod_multbase_a_mix_n.label = DifSpecMultDifSpecIamodDifSpec.IAMOD_MULTBASE_A_MIX_NODE iamod_multbase_a_mix_n.location = (start_pos_x + pos_x_shift * 4, start_pos_y + 1600) iamod_multbase_a_mix_n.operation = "MULTIPLY" # links creation node_tree.links.new(iamod_tex_n.inputs['Vector'], third_geom_n.outputs['UV']) node_tree.links.new(iamod_scale_col_n.inputs['Fac'], vcol_group_n.outputs['Vertex Color Alpha']) node_tree.links.new(iamod_scale_col_n.inputs['Color1'], iamod_tex_n.outputs['Color']) node_tree.links.new(iamod_scale_a_n.inputs['Fac'], vcol_group_n.outputs['Vertex Color Alpha']) node_tree.links.new(iamod_scale_a_n.inputs['Color1'], iamod_tex_n.outputs['Value']) node_tree.links.new(iamod_multbase_col_mix_n.inputs['Color1'], mult_base_col_mix_n.outputs['Color']) node_tree.links.new(iamod_multbase_col_mix_n.inputs['Color2'], iamod_scale_col_n.outputs['Color']) node_tree.links.new(iamod_multbase_a_mix_n.inputs[0], mult_base_a_mix_n.outputs['Value']) node_tree.links.new(iamod_multbase_a_mix_n.inputs[1], iamod_scale_a_n.outputs['Color']) node_tree.links.new(vcol_mult_n.inputs['Color2'], iamod_multbase_col_mix_n.outputs['Color']) node_tree.links.new(spec_mult_n.inputs['Color2'], iamod_multbase_a_mix_n.outputs['Value'])