def import_abcgeom(self):
        # import alembic
        alembic_node = cmds.AbcImport(self.asset_path, mode="import", recreateAllColorSets=True)
        trans_node = cmds.listConnections(alembic_node, type="mesh")[0]
        mesh_node = cmds.listRelatives(trans_node, type="mesh")[0]
        # need test if all color sets can be imported from aiUserDataColor
        cmds.setAttr('{}.allColorSets'.format(alembic_node), 1)
        current_color = cmds.polyColorSet(trans_node, query=True, currentColorSet=True)[0]  # need to test: allColorSet=True

        # create shader
        surface_name = '{}_geom'.format(trans_node)
        # create surface shader
        surface_name = core.createArnoldNode('aiStandardSurface', name=surface_name)
        cmds.sets(trans_node, edit=True, forceElement='{}SG'.format(surface_name))

        # import color
        if self.import_color:
            cmds.setAttr('{trans}|{mesh}.aiExportColors'.format(trans=trans_node, mesh=mesh_node), 1)
            color_name = '{0}_{1}'.format(surface_name, current_color)
            # import particle color
            color_name = core.createArnoldNode('aiUserDataColor', name=color_name)
            cmds.setAttr('{}.colorAttrName'.format(color_name), current_color, type='string')
            if self.color_channel == 'baseColor':
                cmds.connectAttr('{}.outColor'.format(color_name), '{}.baseColor'.format(surface_name))
            elif self.color_channel == 'emitColor':
                cmds.connectAttr('{}.outColor'.format(color_name), '{}.emissionColor'.format(surface_name))
                cmds.setAttr('{}.emission'.format(surface_name), 1)

        # set opacity
        if self.import_opacity:
            cmds.setAttr('{trans}|{mesh}.aiOpaque'.format(trans=trans_node, mesh=mesh_node), 0)
Ejemplo n.º 2
0
def createAreaLight():
    selectTransforms = cmds.ls(sl=True,ni=True,dag=True,tr=True)

    if len(selectTransforms) == 0:
        newlight = core.createArnoldNode('aiAreaLight')
        return newlight.name()
    else:
        for transform in cmds.ls(sl=True,dag=True,ni=True,tr=True):
            position = cmds.xform(transform,q=True,piv=True,ws=True)
            newAiAreaLight = core.createArnoldNode('aiAreaLight')
            cmds.move(position[0],position[1],position[2],newAiAreaLight.name())
Ejemplo n.º 3
0
 def addLightFilter(self, filterNodeType):
     '''
     create and connect a filter of the passed type
     '''
     newFilter = core.createArnoldNode(filterNodeType, skipSelect=True)
     self.connectLightFilter(newFilter)
     return newFilter
Ejemplo n.º 4
0
 def addLightFilter(self, filterNodeType):
     '''
     create and connect a filter of the passed type
     '''
     newFilter = core.createArnoldNode(filterNodeType, skipSelect=True)
     self.connectLightFilter(newFilter)
     return newFilter
Ejemplo n.º 5
0
def createNodeCallback(runtimeClassification, postCommand, nodeType):

    node = unicode(createArnoldNode(nodeType, runtimeClassification=runtimeClassification))
    if postCommand:
        postCommand = postCommand.replace('%node', node).replace('%type', nodeType).replace(r'\"','"')
        pm.mel.eval(postCommand)
    return node
    def import_particles(self):
        # load houdini assets
        asset_name = os.path.split(self.asset_path)[-1].split('.')[0]
        asset = cmds.houdiniAsset(loadAsset=[self.asset_path, "Object/{}".format(asset_name)])

        # create shader
        surface_name = '{}_particles'.format(asset)
        # create surface shader
        surface_name = core.createArnoldNode('aiStandardSurface', name=surface_name)
        # assign shader
        cmds.sets(asset, edit=True, forceElement='{}SG'.format(surface_name))

        # particle color
        if self.import_color:
            color_name = '{}_rgbPP'.format(surface_name)
            # import particle color
            color_name = core.createArnoldNode('aiUserDataColor', name=color_name)
            cmds.setAttr('{}.colorAttrName'.format(color_name), 'rgbPP', type='string')
            if self.color_channel == 'baseColor':
                cmds.connectAttr('{}.outColor'.format(color_name), '{}.baseColor'.format(surface_name))
            elif self.color_channel == 'emitColor':
                cmds.connectAttr('{}.outColor'.format(color_name), '{}.emissionColor'.format(surface_name))
                cmds.setAttr('{}.emission'.format(surface_name), 1)

        # particle opacity
        if self.import_opacity:
            opacity_name = '{}_opacityPP'.format(surface_name)
            # disable opaque
            children = cmds.listRelatives(asset, allDescendents=True)
            for child in children:
                if cmds.nodeType(child) == 'nParticle':
                    cmds.setAttr('{}.aiOpaque'.format(child), 0)
            # import opacity
            opacity_name = core.createArnoldNode('aiUserDataFloat', name=opacity_name)
            cmds.setAttr('{}.attribute'.format(opacity_name), 'opacityPP', type='string')
            cmds.connectAttr('{}.outTransparency'.format(opacity_name), '{}.opacity'.format(surface_name))
Ejemplo n.º 7
0
def shader_nodes(*args):

    # set variables
    asset = selected_asset()
    enabled = []
    mat_name = cmds.textFieldGrp("shd_name", query=True, text=True)
    if len(mat_name) == 0:
        cmds.warning("Please type Material Name")
        return
    shd_type = cmds.optionMenu("shd_type", query=True, value=True)
    maps = channels()[0] + channels()[1] + channels()[2] + channels(
    )[3] + channels()[4] + channels()[5] + channels()[6] + channels(
    )[7] + channels()[8]
    for channel in maps:
        chck = cmds.checkBox("chck_" + channel["chck_name"],
                             query=True,
                             value=True)
        if chck == 1:
            enabled.append(channel)

    material_name = "mtl_" + mat_name
    shading_group = material_name + "SG"
    bump_name = mat_name + "_bump_01"
    displacement_name = mat_name + "_displacement_01"
    normal_name = mat_name + "_normalMap_01"
    aiLayer_name = mat_name + "_aiLayerRgba_01"

    # create base shader
    mat = cmds.shadingNode(shd_type, asShader=True)
    cmds.rename(mat, material_name)
    cmds.setAttr(material_name + ".base", 1)
    cmds.setAttr(material_name + ".specular", 1)

    #create shading group
    SG = cmds.sets(name=shading_group,
                   empty=True,
                   renderable=True,
                   noSurfaceShader=True)
    cmds.connectAttr(material_name + ".outColor",
                     shading_group + ".surfaceShader")

    #assign material
    if len(asset) != 0:
        cmds.select(asset)
        cmds.hyperShade(assign=material_name)

    # create nodes
    for each in enabled:
        name = mat_name + "_" + each["chck_name"]

        #Utility node creation
        if each["cc"] == True:
            ccn = core.createArnoldNode("aiColorCorrect", name=name + "_cc_01")

        if each["range"] == True:
            rngn = core.createArnoldNode("aiRange", name=name + "_range_01")

        if each["clamp"] == True:
            cln = core.createArnoldNode("aiClamp", name=name + "_clamp_01")

        if each["ctf"] == True:
            ctf = core.createArnoldNode("aiColorToFloat",
                                        name=name + "_ctf_01")

        if each["chck_name"] is "displacement":
            disp = cmds.shadingNode("displacementShader", asShader=True)
            cmds.rename(disp, displacement_name)
            cmds.connectAttr(displacement_name + ".displacement",
                             shading_group + ".displacementShader",
                             force=True)
            cmds.connectAttr(name + "_ctf_01.outValue",
                             displacement_name + each["attr_name"],
                             force=True)

        if each["chck_name"] is "normal":
            nm_node = cmds.shadingNode("aiNormalMap", asShader=True)
            cmds.rename(nm_node, normal_name)
            cmds.connectAttr(normal_name + ".outValue",
                             material_name + each["attr_name"],
                             force=True)

        if each["chck_name"] is "bump":
            bmp = cmds.shadingNode("aiBump2d", asShader=True)
            cmds.rename(bmp, bump_name)
            cmds.connectAttr(bump_name + ".outValue",
                             material_name + each["attr_name"],
                             force=True)
            cmds.connectAttr(name + "_ctf_01.outValue",
                             bump_name + ".bumpMap",
                             force=True)

        if each["chck_name"] is "aiLayerRgba":
            layer = cmds.shadingNode("aiLayerRgba", asShader=True)
            cmds.rename(layer, aiLayer_name)
            if shd_type == "aiStandardSurface":
                cmds.connectAttr(aiLayer_name + ".outColor",
                                 material_name + ".id1",
                                 force=True)
            if shd_type == "standardSurface":
                cmds.connectAttr(aiLayer_name + ".outColor",
                                 material_name + each["attr_name"],
                                 force=True)

        #CONNECT NODES
        #ctf
        try:
            cmds.connectAttr(name + "_ctf_01.outValue",
                             material_name + each["attr_name"],
                             force=True)
        except:
            pass

        #clamp
        try:
            cmds.connectAttr(name + "_clamp_01.outColor",
                             name + "_ctf_01.input",
                             force=True)
        except:
            try:
                cmds.connectAttr(name + "_clamp_01.outColor",
                                 material_name + each["attr_name"],
                                 force=True)
            except:
                pass

        #range
        ctf_clamp = ["_ctf_01", "_clamp_01"]

        try:
            for suffix in ctf_clamp:
                try:
                    cmds.connectAttr(name + "_range_01.outColor",
                                     name + suffix + ".input")
                except:
                    pass

        except:
            try:
                cmds.connectAttr(name + "_range_01.outColor",
                                 material_name + each["attr_name"],
                                 force=True)
            except:
                pass

        #cc
        ctf_clamp_range = ["_ctf_01", "_clamp_01", "_range_01"]
        try:
            for suffix in ctf_clamp_range:
                try:
                    cmds.connectAttr(name + "_cc_01.outColor",
                                     name + suffix + ".input")
                except:
                    pass
        except:
            try:
                cmds.connectAttr(name + "_cc_01.outColor",
                                 material_name + each["attr_name"],
                                 force=True)
            except:
                pass
Ejemplo n.º 8
0
def ConnectMaps_UDIM(selection=False):

    materials = mc.ls(mat=True)

    if selection == False:  ### APPLY TO ALL AI_STANDARDSURFACE SHADERS ###

        shaders = [
            i for i in materials if mc.objectType(i) == "aiStandardSurface"
            and mc.referenceQuery(i, isNodeReferenced=True) == False
        ]

    else:  ### FROM A SELECTION OF SHADERS ###

        selection = mc.ls(sl=True)
        shaders = list(set(set(materials) & set(selection)))

    scene_name = os.path.basename(mc.file(
        q=True, sn=True)).split(".")[0]  # Get scene_name name

    if len(shaders) == 1:
        shader = shaders[0]
    elif len(shaders) == 0:
        raise Exception("You must select a shader")
    else:
        pass

    for shader in shaders:

        shading_group = shading_group = mc.rename(
            mc.listConnections(shader, t='shadingEngine'), shader + "SG")
        shader_name = shader_name = shader.split('_')[1]

        if mc.objExists(scene_name + "_BaseColor"
                        ):  # Check input BaseColor if empty connect file node
            file_BaseColor = scene_name + "_BaseColor"
            upstream_BaseColor = mc.listConnections(shader + ".baseColor",
                                                    d=False,
                                                    s=True)
            if upstream_BaseColor == None:
                mc.connectAttr(file_BaseColor + ".outColor",
                               shader + ".baseColor")
            else:
                pass
        else:
            upstream_BaseColor = mc.listConnections(shader + ".baseColor",
                                                    d=False,
                                                    s=True)
            if upstream_BaseColor == None:
                file_BaseColor = mc.shadingNode("file",
                                                asTexture=True,
                                                isColorManaged=True,
                                                name=scene_name + "_BaseColor")
                mc.connectAttr(file_BaseColor + ".outColor",
                               shader + ".baseColor")
            else:
                pass

        if mc.objExists(
                scene_name +
                "_Height"):  # Check input Height if empty connect file node
            file_Height = scene_name + "_Height"
            if not mc.objExists(scene_name + "_D_" + shader_name):
                disp_node = mc.shadingNode("displacementShader",
                                           asShader=True,
                                           name=scene_name + "_D_" +
                                           shader_name)
                mc.setAttr(disp_node + ".scale", 0)
                mc.setAttr(disp_node + '.aiDisplacementZeroValue', 0.5)
            upstream_Height = mc.listConnections(shading_group +
                                                 ".displacementShader",
                                                 d=False,
                                                 s=True)
            if upstream_Height == None:
                mc.connectAttr(file_Height + ".outAlpha",
                               disp_node + ".displacement")
                mc.connectAttr(disp_node + ".displacement",
                               shading_group + ".displacementShader")
            else:
                pass
        else:
            upstream_Height = mc.listConnections(shading_group +
                                                 ".displacementShader",
                                                 d=False,
                                                 s=True)
            if upstream_Height == None:
                file_Height = mc.shadingNode("file",
                                             asTexture=True,
                                             isColorManaged=True,
                                             name=scene_name + "_Height")
                mc.setAttr(file_Height + ".alphaIsLuminance", 1)
                disp_node = mc.shadingNode("displacementShader",
                                           asShader=True,
                                           name=scene_name + "_D_" +
                                           shader_name)
                mc.connectAttr(file_Height + ".outAlpha",
                               disp_node + ".displacement")
                mc.connectAttr(disp_node + ".displacement",
                               shading_group + ".displacementShader")
                mc.setAttr(disp_node + ".scale", 0)
                mc.setAttr(disp_node + '.aiDisplacementZeroValue', 0.5)
            else:
                pass

        if mc.objExists(scene_name + "_Metalness"
                        ):  # Check input Metalness if empty connect file node
            file_Metalness = scene_name + "_Metalness"
            upstream_Metalness = mc.listConnections(shader + ".metalness",
                                                    d=False,
                                                    s=True)
            if upstream_Metalness == None:
                mc.connectAttr(file_Metalness + ".outAlpha",
                               shader + ".metalness")
            else:
                pass
        else:
            upstream_Metalness = mc.listConnections(shader + ".metalness",
                                                    d=False,
                                                    s=True)
            if upstream_Metalness == None:
                file_Metalness = mc.shadingNode("file",
                                                asTexture=True,
                                                isColorManaged=True,
                                                name=scene_name + "_Metalness")
                mc.setAttr(file_Metalness + ".alphaIsLuminance", 1)
                mc.connectAttr(file_Metalness + ".outAlpha",
                               shader + ".metalness")
            else:
                pass

        if mc.objExists(scene_name + "_Roughness"
                        ):  # Check input Roughness if empty connect file node
            file_Roughness = scene_name + "_Roughness"
            upstream_Roughness = mc.listConnections(shader +
                                                    ".specularRoughness",
                                                    d=False,
                                                    s=True)
            if upstream_Roughness == None:
                mc.connectAttr(file_Roughness + ".outAlpha",
                               shader + ".specularRoughness")
            else:
                pass
        else:
            upstream_Roughness = mc.listConnections(shader +
                                                    ".specularRoughness",
                                                    d=False,
                                                    s=True)
            if upstream_Roughness == None:
                file_Roughness = mc.shadingNode("file",
                                                asTexture=True,
                                                isColorManaged=True,
                                                name=scene_name + "_Roughness")
                mc.setAttr(file_Roughness + ".alphaIsLuminance", 1)
                mc.connectAttr(file_Roughness + ".outAlpha",
                               shader + ".specularRoughness")
            else:
                pass

        if mc.objExists(
                scene_name +
                "_Normal"):  # Check input Normal if empty connect file node
            file_Normal = scene_name + "_Normal"
            if not mc.objExists(scene_name + "_aiNormal_" + shader_name):
                normal_node = core.createArnoldNode("aiNormalMap",
                                                    name=scene_name +
                                                    "_aiNormal_" + shader_name)

            upstream_Normal = mc.listConnections(shader + ".normalCamera",
                                                 d=False,
                                                 s=True)
            if upstream_Normal == None:
                mc.connectAttr(file_Normal + ".outColor",
                               normal_node + ".input")
                mc.connectAttr(normal_node + ".outValue",
                               shader + ".normalCamera")
            else:
                pass

        else:
            upstream_Normal = mc.listConnections(shader + ".normalCamera",
                                                 d=False,
                                                 s=True)
            if upstream_Normal == None:
                file_Normal = mc.shadingNode("file",
                                             asTexture=True,
                                             isColorManaged=True,
                                             name=scene_name + "_Normal")
                normal_node = core.createArnoldNode("aiNormalMap",
                                                    name=scene_name +
                                                    "_aiNormal_" + shader_name)
                mc.connectAttr(file_Normal + ".outColor",
                               normal_node + ".input")
                mc.connectAttr(normal_node + ".outValue",
                               shader + ".normalCamera")
            else:
                pass
def connect_maps(selection=False):
    
    materials = mc.ls(mat=True)

    # Apply to all AI_StandardSurface shaders
    if not selection:
        shaders = [
            i for i in materials if mc.objectType(i) == 'aiStandardSurface' and mc.referenceQuery(
                i, isNodeReferenced=True) == False]

    # From a selection of shaders
    else:
        selection = mc.ls(sl=True)
        shaders = list(set(set(materials) & set(selection)))

    # Get scene_name name
    scene_name = os.path.basename(mc.file(q=True, sn=True)).split('.')[0]

    if len(shaders) == 1:
        shader = shaders[0]
    elif len(shaders) == 0:
        raise Exception('You must select a shader')
    else:
        pass

    for shader in shaders:
        shading_group = mc.rename(mc.listConnections(shader, t='shadingEngine'), shader + 'SG')
        shader_name = shader_name = shader.split('_')[1]

        # Check input BaseColor if empty connect file node
        if mc.objExists(scene_name + '_' + shader_name + '_BaseColor'):
            file_base_color = scene_name + '_' + shader_name + '_BaseColor'
            upstream_base_color = mc.listConnections(shader + '.baseColor', d=False, s=True)
            if upstream_base_color is None:
                mc.connectAttr(file_base_color + '.outColor', shader + '.baseColor')
            else: 
                pass
        else:
            upstream_base_color = mc.listConnections(shader + '.baseColor', d=False, s=True)
            if upstream_base_color ==  None :
                file_base_color = mc.shadingNode(
                    'file', asTexture=True, isColorManaged=True, name= scene_name + '_' + shader_name + '_BaseColor')
                mc.connectAttr(file_base_color + '.outColor', shader + '.baseColor')
            else: 
                pass

        # Check input Height if empty connect file node
        if mc.objExists(scene_name + '_' + shader_name + '_Height'):
            file_height = scene_name + '_' + shader_name + '_Height'
            if not mc.objExists(scene_name + '_D_' + shader_name):
                disp_node = mc.shadingNode(
                    'displacementShader', asShader=True, name=scene_name + '_D_' + shader_name)
                mc.setAttr(disp_node + '.scale', 0)
                mc.setAttr(disp_node + '.aiDisplacementZeroValue', 0.5)
            upstream_height = mc.listConnections(shading_group + '.displacementShader', d=False, s=True)
            if upstream_height is None :
                mc.connectAttr( file_height + '.outAlpha', disp_node + '.displacement')
                mc.connectAttr( disp_node + '.displacement', shading_group + '.displacementShader')
            else:
                pass
        else:
            upstream_height = mc.listConnections(shading_group + '.displacementShader', d=False, s=True)
            if upstream_height is None:
                file_height = mc.shadingNode(
                    'file', asTexture=True, isColorManaged=True, name=scene_name + '_' + shader_name + '_Height')
                mc.setAttr(file_height + '.alphaIsLuminance', 1)
                disp_node = mc.shadingNode(
                    'displacementShader', asShader=True, name=scene_name + '_D_' + shader_name)
                mc.connectAttr(file_height + '.outAlpha', disp_node + '.displacement')
                mc.connectAttr(disp_node + '.displacement', shading_group + '.displacementShader')
                mc.setAttr(disp_node + '.scale', 0)
                mc.setAttr(disp_node + '.aiDisplacementZeroValue', 0.5)
            else: 
                pass

        # Check input Metalness if empty connect file node
        if mc.objExists(scene_name + '_' + shader_name + '_Metalness'):
            file_metalness = scene_name + '_' + shader_name + '_Metalness'
            upstream_metalness = mc.listConnections(shader + '.metalness', d=False, s=True)
            if upstream_metalness is None:
                mc.connectAttr(file_metalness + '.outAlpha', shader + '.metalness')
            else:
                pass
        else:
            upstream_metalness = mc.listConnections(shader + '.metalness', d=False, s=True)
            if upstream_metalness is None:
                file_metalness = mc.shadingNode(
                    'file', asTexture=True, isColorManaged=True, name=scene_name + '_' + shader_name + '_Metalness')
                mc.setAttr(file_metalness + '.alphaIsLuminance', 1)
                mc.connectAttr(file_metalness + '.outAlpha', shader + '.metalness')
            else: 
                pass

        # Check input Roughness if empty connect file node
        if mc.objExists(scene_name + '_' + shader_name + '_Roughness'):
            file_roughness = scene_name + '_' + shader_name + '_Roughness'
            upstream_roughness = mc.listConnections(shader + '.specularRoughness', d=False, s=True)
            if upstream_roughness is None:
                mc.connectAttr(file_roughness + '.outAlpha', shader + '.specularRoughness')
            else:
                pass
        else:
            upstream_roughness = mc.listConnections(shader + '.specularRoughness', d=False, s=True)
            if upstream_roughness is None:
                file_roughness = mc.shadingNode(
                    'file', asTexture=True, isColorManaged=True, name=scene_name + '_' + shader_name + '_Roughness')
                mc.setAttr(file_roughness + '.alphaIsLuminance', 1)
                mc.connectAttr(file_roughness + '.outAlpha', shader + '.specularRoughness')
            else: 
                pass

        # Check input Normal if empty connect file node
        if mc.objExists(scene_name + '_' + shader_name + '_Normal'):
            file_normal = scene_name + '_' + shader_name + '_Normal'
            if not mc.objExists(scene_name + '_aiNormal_' + shader_name):
                normal_node = core.createArnoldNode('aiNormalMap', name=scene_name + '_aiNormal_' + shader_name)
                
            upstream_normal = mc.listConnections(shader + '.normalCamera', d=False, s=True)
            if upstream_normal is None :
                mc.connectAttr( file_normal + '.outColor', normal_node + '.input')
                mc.connectAttr( normal_node + '.outValue', shader + '.normalCamera')
            else:
                pass

        else:
            upstream_normal = mc.listConnections(shader + '.normalCamera', d=False, s=True)
            if upstream_normal ==  None :
                file_normal = mc.shadingNode(
                    'file', asTexture=True, isColorManaged=True, name=scene_name + '_' + shader_name + '_Normal')
                normal_node = core.createArnoldNode('aiNormalMap', name=scene_name + '_aiNormal_' + shader_name)
                mc.connectAttr( file_normal + '.outColor', normal_node + '.input')
                mc.connectAttr( normal_node + '.outValue', shader + '.normalCamera')
            else: 
                pass
Ejemplo n.º 10
0
def hateTheShader(*args):

	texName = cmds.textField("texName", q = True, text = True)
	checkUdimBox = cmds.checkBox('udimCB', q = True, value = True)
	checkArnoldBox = cmds.checkBox('arnoldSelectCB', q = True, value = True)
	checkRedshiftBox = cmds.checkBox('redshiftSelectCB', q = True, value = True)
	textureList = (buildShaderLists()[1])
	textureList_with_ext =(buildShaderLists()[2])
	fullShaderFile_path = buildShaderLists()[0]
	currentTxtFieldList = (queryEditFields()[1])
	newTexList = []
	fileNodeList = []
	place2dtextureList = []

	print currentTxtFieldList, len(currentTxtFieldList)
	print textureList , len(textureList)
	print fullShaderFile_path , len(fullShaderFile_path)
	# Duplicate Name Check
	matList = cmds.ls(mat = True)
	for name in matList: 
		if name == texName: 
			cmds.confirmDialog( title = 'ERROR', message = 'Cannot have duplicate shader name' )
			cmds.error( 'Cannot create shader with duplicate name')
	
	if texName == '' and checkRedshiftBox == True:
		texName = 'rsMaterial1'
	
	# Duplicate Image Check		
	textureCheckList = cmds.ls( type = 'file')
	for shad in textureList: 
		if shad in textureCheckList:
			cmds.confirmDialog( title = 'ERROR', message = 'Please select new image files or Duplicate Graph' )
			cmds.error( 'Cannot create 2 shaders with duplicate image files')
				
	textureNodeNames= []

	for each in textureList:
		textureNodeNames = [s.replace('.', '_') for s in textureList]

	for x in textureNodeNames:
		textureNode = cmds.shadingNode("file", asTexture = True, name = x)
		placed2dTextureNode = cmds.shadingNode("place2dTexture", asUtility = True, name = texName +"place2dTexture1")
		newTexList.append(x)
		fileNodeList.append(textureNode)
		place2dtextureList.append(placed2dTextureNode)
	
	placed2dTextureConnections = ['rotateUV','offset','noiseUV','vertexCameraOne','vertexUvThree','vertexUvTwo','vertexUvOne',
								  'repeatUV','wrapV','wrapU','stagger','mirrorU','mirrorV','rotateFrame','translateFrame','coverage']

	for tex in range(len(place2dtextureList)):			
	    cmds.connectAttr(place2dtextureList[tex] + '.outUV', newTexList[tex] + '.uvCoord')
	    cmds.connectAttr(place2dtextureList[tex] + '.outUvFilterSize', newTexList[tex] + '.uvFilterSize')
	    for connection in placed2dTextureConnections:
	        cmds.connectAttr(place2dtextureList[tex] + '.' + connection, newTexList[tex] + '.' + connection)
	
	for t in range(len(fileNodeList)):
		cmds.setAttr(fileNodeList[t]+ '.fileTextureName', fullShaderFile_path[t], type = "string")

	if checkUdimBox == True: 
		for t in range(len(fileNodeList)):
			cmds.setAttr(fileNodeList[t]+ '.uvTilingMode', 3 )
	        
	if checkArnoldBox == True:
		mtoa.createArnoldNode ('aiStandardSurface', name = texName, skipSelect = False, runtimeClassification = None)
	
		#Connecting Textures to Corresponding Shader Attribute
		for ff in range (len(currentTxtFieldList)): 
			
			if currentTxtFieldList[ff] == "BaseColor":
				cmds.connectAttr(textureNodeNames[ff] + '.outColor', texName + '.baseColor', force = 1)
			
			elif  currentTxtFieldList[ff] == "Metalness":
				cmds.connectAttr(textureNodeNames[ff] + '.outColorR', texName + '.metalness', force = 1)
				cmds.setAttr(textureNodeNames[ff] + '.colorSpace', 'Raw', type = "string")
			
			elif currentTxtFieldList[ff] == 'Roughness':
				cmds.connectAttr(textureNodeNames[ff] + '.outColorR', texName + '.specularRoughness', force = 1)
				cmds.setAttr(textureNodeNames[ff] + '.colorSpace', 'Raw', type = "string")
			
			elif currentTxtFieldList[ff] == "Normal" :
				mtoa.createArnoldNode('aiNormalMap', name = textureNodeNames[ff] + "_Normal", skipSelect = False, runtimeClassification = None)
				cmds.connectAttr(textureNodeNames[ff] + '_Normal.outValue', texName + '.normalCamera', force = 1)
				cmds.connectAttr(textureNodeNames[ff] + '.outColor', textureNodeNames[ff] + '_Normal.input', force = 1)
				cmds.setAttr(textureNodeNames[ff] + '.colorSpace', 'Raw', type = "string")
			
			elif currentTxtFieldList[ff] == "Emissive":
				cmds.connectAttr(textureNodeNames[ff] + '.outColor', texName + '.emissionColor', force = 1)
			
			elif currentTxtFieldList[ff] == "Opacity" :
				cmds.shadingNode("reverse", asUtility = True)
				cmds.connectAttr('reverse1.outputX', texName + '.transmission', force = 1)
				cmds.connectAttr(textureNodeNames[ff] + '.outColor', 'reverse1.input', force = 1)
				cmds.setAttr(textureNodeNames[ff] + '.colorSpace', 'Raw', type = "string")
			
			elif  currentTxtFieldList[ff] == "Height" :
				cmds.shadingNode("displacementShader", name = textureNodeNames[ff] + '_Displace', asShader = True)
				cmds.connectAttr(textureNodeNames[ff] + '.outColorR', textureNodeNames[ff] + '_Displace.displacement', force = 1)
				cmds.setAttr(textureNodeNames[ff] + '.colorSpace', 'Raw', type = "string")
				cmds.connectAttr( textureNodeNames[ff] + '_Displace.displacement', texName + 'SG' + '.displacementShader')

	elif checkRedshiftBox == True: 
		cmds.shadingNode('RedshiftMaterial', asShader = True, name = texName)

		cmds.sets( renderable = True, noSurfaceShader = True, empty = True, name = texName + 'SG' )
		
		cmds.connectAttr( texName + '.outColor', texName + 'SG' + '.surfaceShader')
		cmds.setAttr(texName + '.refl_brdf', 1)
		cmds.setAttr( texName + '.refl_fresnel_mode', 2)
		for ff in range (len(currentTxtFieldList)):
			
			if currentTxtFieldList[ff] == "BaseColor":
				cmds.connectAttr(textureNodeNames[ff] + '.outColor', texName + '.diffuse_color', force= 1)
				cmds.setAttr(textureNodeNames[ff] + '.ignoreColorSpaceFileRules', 1)
			
			elif  currentTxtFieldList[ff] == "Metalness":
				cmds.connectAttr(textureNodeNames[ff] + '.outAlpha', texName + '.refl_metalness', force= 1)
				cmds.setAttr(textureNodeNames[ff] + '.colorSpace', 'Raw', type = "string")
				cmds.setAttr(textureNodeNames[ff] + '.ignoreColorSpaceFileRules', 1)
			
			elif currentTxtFieldList[ff] == 'Roughness':
				cmds.connectAttr(textureNodeNames[ff] + '.outAlpha', texName + '.refl_roughness', force= 1)
				cmds.setAttr(textureNodeNames[ff] + '.colorSpace', 'Raw', type = "string")
				cmds.setAttr(textureNodeNames[ff] + '.alphaIsLuminance', 1)
				cmds.setAttr(textureNodeNames[ff] + '.ignoreColorSpaceFileRules', 1)
			
			elif currentTxtFieldList[ff] == 'Normal':
				cmds.shadingNode('RedshiftBumpMap', asTexture = True, name = textureNodeNames[ff] + "_NormalMap")
				cmds.connectAttr(textureNodeNames[ff] + '_NormalMap.out', texName + '.bump_input', force= 1)
				cmds.connectAttr(textureNodeNames[ff] + '.outColor', textureNodeNames[ff] + '_NormalMap.input', force= 1)
				cmds.setAttr(textureNodeNames[ff] + '.colorSpace', 'Raw', type = "string")
				cmds.setAttr(textureNodeNames[ff] + '.alphaIsLuminance', 1)
				cmds.setAttr(textureNodeNames[ff] + '.ignoreColorSpaceFileRules', 1)
				cmds.setAttr(textureNodeNames[ff] + "_NormalMap" + '.flipY', 1)
				cmds.setAttr(textureNodeNames[ff] + '_NormalMap' + '.inputType', 1)
				cmds.setAttr(textureNodeNames[ff] + '_NormalMap' + '.scale', 1)

			elif currentTxtFieldList[ff] == 'Emissive':
				cmds.connectAttr(textureNodeNames[ff] + '.outColor', texName + '.emission_color', force= 1)
				cmds.setAttr(textureNodeNames[ff] + '.ignoreColorSpaceFileRules', 1)
			
			elif currentTxtFieldList[ff] == 'Opacity':
				cmds.connectAttr(textureNodeNames[ff] + '.outColorR', texName + '.refr_weight', force= 1)
				cmds.setAttr(textureNodeNames[ff] + '.colorSpace', 'Raw', type = "string")
				cmds.setAttr(textureNodeNames[ff] + '.alphaIsLuminance', 1)
				cmds.setAttr(textureNodeNames[ff] + '.invert', 1)
				cmds.setAttr(textureNodeNames[ff] + '.ignoreColorSpaceFileRules', 1)
				cmds.setAttr(texName + '.refl_fresnel_mode', 3)
			
			elif currentTxtFieldList[ff] == 'Height':
				cmds.shadingNode("RedshiftDisplacement", name = textureNodeNames[ff] + '_Displace', asShader=True)
				cmds.connectAttr(textureNodeNames[ff] + '.outColor', textureNodeNames[ff] + '_Displace.texMap', force= 1)
				cmds.setAttr(textureNodeNames[ff] + '.colorSpace', 'Raw', type = "string")
				cmds.setAttr(textureNodeNames[ff] + '.alphaIsLuminance', 1)
				cmds.connectAttr( textureNodeNames[ff] + '_Displace.out', texName + 'SG' + '.displacementShader')
				cmds.setAttr(textureNodeNames[ff] + '.ignoreColorSpaceFileRules', 1)

			elif currentTxtFieldList[ff] == 'AO': 
				cmds.shadingNode("RedshiftAmbientOcclusion", name = textureNodeNames[ff] + '_AO', asShader = True)
				cmds.connectAttr(textureNodeNames[ff] + '.outColor', textureNodeNames[ff] + '_AO.bright', force = 1)
				cmds.connectAttr(textureNodeNames[ff] + '.outColor', textureNodeNames[ff] + '_AO.dark', force = 1)
				cmds.connectAttr( textureNodeNames[ff] + '_AO.outColor', texName + '.overall_color')
				cmds.setAttr(textureNodeNames[ff] + '.ignoreColorSpaceFileRules', 1)



	# Clear out processed shader files and reset dialog
	enableDisableIndivSelect(2)
	print 'Material successfully created'