Fix T69664: Update add-ons for Mapping node changes.

The Mapping node was update to have dynamic inputs that can be linked.
Moreover, the min and max options were removed entrily. This broke
add-ons that used the Mapping node, so this patch fixes those add-ons.

Reviewers: brecht

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5732
This commit is contained in:
OmarSquircleArt 2019-09-09 18:18:19 +02:00 committed by Brecht Van Lommel
parent 14abe13dc8
commit 563f8717da
Notes: blender-bot 2023-02-14 19:07:46 +01:00
Referenced by issue #69664, Update add-ons for mapping shader node changes
3 changed files with 25 additions and 22 deletions

View File

@ -803,9 +803,9 @@ def create_fabric_material(matname, replace, r, g, b, rv=0.8, gv=0.636, bv=0.315
node = nodes.new('ShaderNodeMapping')
node.name = 'UVMapping'
node.location = 266, 380
node.scale[0] = 1000
node.scale[1] = 1000
node.scale[2] = 1000
node.inputs['Scale'].default_value[0] = 1000
node.inputs['Scale'].default_value[1] = 1000
node.inputs['Scale'].default_value[2] = 1000
# ===========================================================================
# Image texture

View File

@ -562,18 +562,19 @@ def CreateTextureLine(type, act_material, main_mat, texcoat, coat3D, notegroup,
map_node.location = map_loc
map_node.name = '3DC_' + tile
map_node.vector_type = 'TEXTURE'
map_node.use_min = True
map_node.use_max = True
tile_int_x = int(tile[3])
tile_int_y = int(tile[2])
map_node.min[0] = tile_int_x - 1
map_node.max[0] = tile_int_x
map_node.min[1] = tile_int_y
map_node.max[1] = tile_int_y + 1
min_node = texture_tree.nodes.new('ShaderNodeVectorMath')
min_node.operation = "MINIMUM"
min_node.inputs[1].default_value[0] = tile_int_x - 1
min_node.inputs[1].default_value[1] = tile_int_y
max_node = texture_tree.nodes.new('ShaderNodeVectorMath')
max_node.operation = "MAXIMUM"
max_node.inputs[1].default_value[0] = tile_int_x
max_node.inputs[1].default_value[1] = tile_int_y + 1
if(index == 0):
nodes.append(tex_img_node.name)
@ -624,7 +625,9 @@ def CreateTextureLine(type, act_material, main_mat, texcoat, coat3D, notegroup,
map_loc[1] -= 300
texture_tree.links.new(tex_uv_node.outputs[0], map_node.inputs[0])
texture_tree.links.new(map_node.outputs[0], tex_img_node.inputs[0])
texture_tree.links.new(map_node.outputs[0], min_node.inputs[0])
texture_tree.links.new(min_node.outputs['Vector'], max_node.inputs[0])
texture_tree.links.new(max_node.outputs['Vector'], tex_img_node.inputs[0])
if(count > 1):
texture_tree.links.new(mix_node.outputs[0], notegroupend.inputs[0])

View File

@ -231,21 +231,21 @@ class dsky(Operator):
ntl(bg.inputs[0], combine.outputs[0])
map2 = nt.nodes.new(type="ShaderNodeMapping")
map2.scale[2] = 6.00
map2.scale[0] = 1.5
map2.scale[1] = 1.5
map2.inputs['Scale'].default_value[2] = 6.00
map2.inputs['Scale'].default_value[0] = 1.5
map2.inputs['Scale'].default_value[1] = 1.5
map2.location = (2196.6, 1510)
n1 = nt.nodes.new(type="ShaderNodeTexNoise")
n1.inputs[1].default_value = 3.8
n1.inputs[2].default_value = 2.4
n1.inputs[3].default_value = 0.5
n1.inputs['Scale'].default_value = 3.8
n1.inputs['Detail'].default_value = 2.4
n1.inputs['Distortion'].default_value = 0.5
n1.location = (2745.24, 1780)
n2 = nt.nodes.new(type="ShaderNodeTexNoise")
n2.inputs[1].default_value = 2.0
n2.inputs[2].default_value = 10
n2.inputs[3].default_value = 0.2
n2.inputs['Scale'].default_value = 2.0
n2.inputs['Detail'].default_value = 10
n2.inputs['Distortion'].default_value = 0.2
n2.location = (2745.24, 1510)
ntl(n2.inputs[0], map2.outputs[0])
@ -356,8 +356,8 @@ class dsky(Operator):
ntl(mix1.inputs[2], sc3.outputs[0])
ntl(sunopa.inputs[2], gam2.outputs[0])
ntl(sc1.inputs[0], n1.outputs[0])
ntl(sc2.inputs[0], n2.outputs[0])
ntl(sc1.inputs[0], n1.outputs['Fac'])
ntl(sc2.inputs[0], n2.outputs['Fac'])
skynor = nt.nodes.new(type="ShaderNodeNormal")
skynor.location = (3294, 1070)