top of page

Ai Standard Surface Shader Network

Create an Arnold Standard Surface shader network easily with this tool.

User Guide

After running the code you will see this user interface. Fill out the information as directed.

  • Name for AiSS: Name of the shader that will be created

  • Folder: Select the folder with your texture maps. In this example there is a folder within the sourceimages folder with the textures for this object.

    • Make sure your texture map files have the proper naming conventions (based on Substance Painter's file naming system)

    • Multiple UV Tiles: Check ON if you used multiple UV tiles, leave OFF if your UVs are only in one tile.

  • Map Selection: Select the maps you have for this texture. If you accidently select a box for a map you don't have, you will get a warning when you click "Create," but should still have a working AiSS network (just without that map type).

  • Subsurface Scattering: For models with Subsurface Scattering, here you can easily create a texture node for it, as well as set the subsurface scattering color. The SSS color can be changed once the AiSS network is created.

  • Create: Creates the AiSS network with the user input.

  • Assign Material to Selection: With the Create AiStadardSurface user interface open, select the object you want to apply your texture to, then click this button to assign the material you made to the selection. Make sure you have hit "Create" to make the network before using this feature.

After filling out the informaiton and clicking "Create" (and/or "Assign Material to Selection") you will see your Ai Standard Surface network in the Hypershade. The script editor will print information for trouble shooting, including the Folder Path selected, the name of the shader, if there are multiple UVs, and what maps were created.

Result

05_Oven_TA-Textured.0001.png

####################### Create AiSS Shader Network ###########################
##
## Easily Create an AiStandardSurface Shader Network and import texture maps
##
## Created by Abby O'Malley
## Follow me on instagram! @aabrbty
## Reach out for questions/comments!
##
##    VERSION 2
##
##############################################################################
import maya.cmds as cmds
import os as os

class AO_Window(object):
       
  def __init__(self):
           
  ### GLOBALS ###    
       self.window = "AO_Window"
       self.title = "            Create AiStandardSurface"
       self.size = (500, 470)
           
       ## Close old window if open ##
       if cmds.window(self.window, exists = True):
           cmds.deleteUI(self.window, window=True)
           
       ## Create new window ##
       self.window = cmds.window(self.window, title=self.title, widthHeight=self.size)
      
########################################### USER INTERFACE ###########################################
       
       ## Title ##
       cmds.columnLayout(adjustableColumn=True)
       cmds.separator(height=15, style="none")
       cmds.text(self.title, fn="boldLabelFont", al="left")
       cmds.separator(height=10, style="none")

       ## Create and Name AiSS ##
       self.AiSSShaderName = cmds.textFieldGrp( label= "Name for AiSS: ")
       cmds.separator(height=20)
       
       ## Naming Conventions ##
       cmds.text("            Select Folder", al= "left", fn="boldLabelFont")
       cmds.separator(height=10, style="none")
       cmds.text("                    > FILE NAME must end in Maptype.UVtile.png", al = "left" )
       cmds.text("                    > Example: object_name_BaseColor.1001.png, or object_name_Metalness.png", al="left")
       cmds.separator(height=10, style="none")
              
       ## Choose Folder ##
       cmds.rowLayout( numberOfColumns=4, columnWidth3=(80, 75, 150), columnAlign=(1, 'right'), columnAttach=[(1, 'both', 0), (2, 'both', 0), (3, 'both', 0)] )
       cmds.text("Folder: ", al="right", w= 100)
       self.FilePathName = cmds.textField("textFieldName", text = " ", w=250)
       self.FileSelect = cmds.button(label = "Select Folder",w= 100, command = self.FileSearch)
       cmds.text(" ",width=80)
       cmds.setParent('..')
       cmds.columnLayout(adjustableColumn=True)
       
       ## Multiple UV Tiles Check ##
       cmds.rowLayout(numberOfColumns=2)
       cmds.text(" ",width=100)
       self.multiUVCheck = cmds.checkBox(label = "Multiple UV tiles", w= 250)
       cmds.setParent('..')
       cmds.separator(height=20)

       ## Map Selection ##
       cmds.text("            Map Selection", al= "left", fn="boldLabelFont")
       cmds.separator(height=10, style="none")
       cmds.rowColumnLayout(numberOfRows=4, cs= (2, 20))
       for b in range (0,4): #for layout aesthetics
           bruh = " "+str(b)
           cmds.text(bruh, w=45, vis=False)   
       self.BaseColorCheck = cmds.checkBox(label = "Base Color")
       self.RoughnessCheck = cmds.checkBox(label = "Roughness")
       self.MetalnessCheck = cmds.checkBox(label = "Metalness")
       self.NormalCheck = cmds.checkBox(label = "Normal")        
       self.HeightCheck = cmds.checkBox(label = "Height")
       self.OpacityCheck = cmds.checkBox(label = "Opacity")
       self.EmissiveCheck = cmds.checkBox(label = "Emissive")        
       cmds.setParent('..')
       cmds.separator(height=20)
       
       ## Subsurface Scattering ##
       cmds.text("            Subsurface Scattering", al="left", fn="boldLabelFont")
       cmds.separator(height=6, style="none")
       # SSS Check #
       cmds.rowLayout(numberOfColumns=2)
       cmds.text("",w = 63)
       self.SSScatteringCheck = cmds.checkBox(label = "Create SSS node",w= 250)
       cmds.setParent('..')
       cmds.separator(height=6, style="none")
       # Color Slider #
       cmds.rowLayout(numberOfColumns=3)
       cmds.text(" ", w=10)
       self.SSScolor = cmds.colorSliderGrp(label='SSS Color', w= 370, rgb=(1, 0, 0))
       cmds.text(" ", w=20)
       cmds.setParent('..')
       cmds.separator(height=30)
       
       ## Assign Material to Selection and Close Buttons ##
       cmds.rowLayout(numberOfColumns=3)
       cmds.button( label = "Create", w = 166, c = self.Main)
       cmds.button( label = "Assign Material to Selection", w= 166, c = self.AssigntoSelection)
       cmds.button( label = "Close", w = 166, command=('cmds.deleteUI(\"' + self.window + '\", window=True)'))
       cmds.setParent('..')
       
  ### DISPLAY WINDOW ###
       cmds.showWindow()

############################################### Main ###############################################
   
  def FileSearch (self, *args):
       # Open file selection dialog to set project's source images folder #
       projectDir = cmds.workspace(q=True, rd=True)
       sourceImagesFolder = f"{projectDir}" + "sourceimages"
       singleFilter = "All Files (*.*)"
       self.Folder = cmds.fileDialog2(fileFilter=singleFilter, dialogStyle=2, fileMode=3, returnFilter=True, dir = sourceImagesFolder)
       # put path name in text field #
       self.pathName = self.Folder[0]       
       cmds.textField("textFieldName", edit=True, tx= f"{self.pathName}")
       print ("Folder Path: ", self.pathName)      

  def AssigntoSelection (self, *args):
       objList = cmds.ls(sl=True)
       for obj in objList:
           cmds.hyperShade(assign = f"{self.AiSSName}")   
           print("Material Assigned to", obj)    
   
  def Main (self, *args):        
       ### Create AiSS ###
       self.AiSSName = cmds.textFieldGrp (self.AiSSShaderName, query = True, text = True)
       AiSSNode = cmds.shadingNode('aiStandardSurface',n = self.AiSSName, asShader=True)
       setName = f"{self.AiSSName}"+"_set"
       AiSSset = cmds.sets( renderable=True, noSurfaceShader=True, empty=True, n= f"{setName}");
       cmds.connectAttr( AiSSNode+".outColor", AiSSset+".surfaceShader", force=True)
       print ("AiStandardSurface", f"{self.AiSSName}", "Created")
       
       ### Check for Multiple UV ###
       multiUVquery = cmds.checkBox (self.multiUVCheck , q=True, v= True)
       print("Multiple UVs: ", multiUVquery)
       
       ### Create Maps based on UI ###
       BaseColor = cmds.checkBox(self.BaseColorCheck, q = True, v = True)
       Roughness = cmds.checkBox(self.RoughnessCheck, q = True, v = True)
       Metalness = cmds.checkBox(self.MetalnessCheck, q = True, v = True)
       Normal = cmds.checkBox(self.NormalCheck, q = True, v = True)
       Height = cmds.checkBox(self.HeightCheck, q = True, v = True)
       Opacity = cmds.checkBox(self.OpacityCheck, q = True, v = True)
       Emissive = cmds.checkBox(self.EmissiveCheck, q = True, v = True)
       SSScattering = cmds.checkBox(self.SSScatteringCheck, q = True, v = True)        
     
  ## BASECOLOR ##
       if BaseColor == True:
           print("BaseColor Node Created")

           # Create File and p2D Nodes #  
           BaseColorName = f"{self.AiSSName}"+"_BaseColor"  
           BCp2dName = f"{self.AiSSName}"+"_BC_p2d"
           BCfileNode = cmds.shadingNode('file',n=f"{BaseColorName}", asTexture=True)          
           BCp2dNode = cmds.shadingNode("place2dTexture", n =f"{BCp2dName}", asUtility=True)            
           # Connect p2D to File #
           connections = ['rotateUV','offset','noiseUV','vertexCameraOne','vertexUvThree','vertexUvTwo','vertexUvOne','repeatUV','wrapV','wrapU','stagger','mirrorU','mirrorV','rotateFrame','translateFrame','coverage']
           cmds.connectAttr(BCp2dNode+'.outUV',BCfileNode+'.uvCoord')
           cmds.connectAttr(BCp2dNode+'.outUvFilterSize',BCfileNode+'.uvFilterSize')
           for i in connections:
               cmds.connectAttr(BCp2dNode+'.'+i, BCfileNode+'.'+i)
           # Connect File to AiSS #
           cmds.connectAttr(f"{BaseColorName}.outColor",f"{self.AiSSName}.baseColor")
           
           # Find BaseColor Files #
           listfiles = os.listdir(self.pathName) # list content of folder
           BCfileList = []                       # empty list for BC files to go
           for item in listfiles:                # go through each file in folder
               fileName = item                   # put name of file in a variable for later
               splitOne = item.split("_")        # EX: ['Oven', 'UV', '10', 'lambert1', 'BaseColor.1001.png']
               mapnum = splitOne[-1]             # get last item in the list EX: BaseColor.1001.png
               splitTwo = mapnum.split(".")      # EX: ['BaseColor', '1001', 'png']

               maptype = splitTwo[0]             # get first item in list (BaseColor)
               if maptype == "BaseColor":        # for each item in list with BaseColor
                   fileInput = fileName
                   BCfileList.append(fileInput)  # put each file into a list of BC files
               else:
                   pass
           BCfileInput = self.pathName + "/" + BCfileList[0]                                    # add pathname to file name
           cmds.setAttr(f"{BaseColorName}.fileTextureName", BCfileInput, type="string")    # put image in file node
          
           # If multiple UV tiles #
           if multiUVquery == True:
               cmds.setAttr(f"{BaseColorName}.uvTilingMode", 3)
           else:
               pass          
     
           # Color Space and Alpha as Luminance #      
           cmds.setAttr(f"{BaseColorName}.ignoreColorSpaceFileRules",1)
           cmds.setAttr(f"{BaseColorName}.alphaIsLuminance",0)  
                     
       else:
           pass

  ## ROUGHNESS ##   
       if Roughness == True:
           print("Roughness Node Created")
       
           # Create File and p2D Nodes #  
           RoughnessName = f"{self.AiSSName}"+"_Roughness"
           RNp2dName = f"{self.AiSSName}"+"_RN_p2d"    
           RNfileNode = cmds.shadingNode('file',n=f"{RoughnessName}", asTexture=True)          
           RNp2dNode = cmds.shadingNode("place2dTexture", n =f"{RNp2dName}", asUtility=True)            
           # Connect p2D to File #
           connections = ['rotateUV','offset','noiseUV','vertexCameraOne','vertexUvThree','vertexUvTwo','vertexUvOne','repeatUV','wrapV','wrapU','stagger','mirrorU','mirrorV','rotateFrame','translateFrame','coverage']
           cmds.connectAttr(RNp2dNode+'.outUV',RNfileNode+'.uvCoord')
           cmds.connectAttr(RNp2dNode+'.outUvFilterSize',RNfileNode+'.uvFilterSize')
           for i in connections:
               cmds.connectAttr(RNp2dNode+'.'+i, RNfileNode+'.'+i)
           # Connect File to AiSS #
           cmds.connectAttr(f"{RoughnessName}.outAlpha",f"{self.AiSSName}.specularRoughness")
           
           # Find Roughness Files #
           listfiles = os.listdir(self.pathName)
           RNfileList = []                       
           for item in listfiles:                
               fileName = item                   
               splitOne = item.split("_")        
               mapnum = splitOne[-1]             
               splitTwo = mapnum.split(".")      

               maptype = splitTwo[0]             
               if maptype == "Roughness":        
                   fileInput = fileName
                   RNfileList.append(fileInput)  
               else:
                   pass
           RNfileInput = self.pathName + "/" + RNfileList[0]                                
           cmds.setAttr(f"{RoughnessName}.fileTextureName", RNfileInput, type="string")     
       
           # If multiple UV tiles #
           if multiUVquery == True:
               cmds.setAttr(f"{RoughnessName}.uvTilingMode", 3)
           else:
               pass   
                
           # Color Space and Alpha as Luminance #      
           cmds.setAttr(f"{RoughnessName}.ignoreColorSpaceFileRules",1)
           cmds.setAttr(f"{RoughnessName}.colorSpace","Raw", type = "string")
           cmds.setAttr(f"{RoughnessName}.alphaIsLuminance",1)

       else:
           pass
               
  ## METALNESS ##
       if Metalness == True:
           print("Metalness Node Created")
       
           # Create File and p2D Nodes #  
           MetalnessName = f"{self.AiSSName}"+"_Metalness"
           MTp2dName = f"{self.AiSSName}"+"_MT_p2d"
           MTfileNode = cmds.shadingNode('file',n=f"{MetalnessName}", asTexture=True)          
           MTp2dNode = cmds.shadingNode("place2dTexture", n =f"{MTp2dName}", asUtility=True)            
           # Connect p2D to File #
           connections = ['rotateUV','offset','noiseUV','vertexCameraOne','vertexUvThree','vertexUvTwo','vertexUvOne','repeatUV','wrapV','wrapU','stagger','mirrorU','mirrorV','rotateFrame','translateFrame','coverage']
           cmds.connectAttr(MTp2dNode+'.outUV',MTfileNode+'.uvCoord')
           cmds.connectAttr(MTp2dNode+'.outUvFilterSize',MTfileNode+'.uvFilterSize')
           for i in connections:
               cmds.connectAttr(MTp2dNode+'.'+i, MTfileNode+'.'+i)
           # Connect File to AiSS #
           cmds.connectAttr(f"{MetalnessName}.outAlpha",f"{self.AiSSName}.metalness")
         
           # Find Metalness Files #
           listfiles = os.listdir(self.pathName)
           MTfileList = []                       
           for item in listfiles:                
               fileName = item                   
               splitOne = item.split("_")        
               mapnum = splitOne[-1]             
               splitTwo = mapnum.split(".")      

               maptype = splitTwo[0]             
               if maptype == "Metalness":        
                   fileInput = fileName
                   MTfileList.append(fileInput)  
               else:
                   pass
           MTfileInput = self.pathName + "/" + MTfileList[0]                                
           cmds.setAttr(f"{MetalnessName}.fileTextureName", MTfileInput, type="string")     
           
           # If multiple UV tiles #
           if multiUVquery == True:
               cmds.setAttr(f"{MetalnessName}.uvTilingMode", 3)
           else:
               pass
       
           # Color Space and Alpha as Luminance - :) #
           cmds.setAttr(f"{MetalnessName}.ignoreColorSpaceFileRules",1)
           cmds.setAttr(f"{MetalnessName}.colorSpace","Raw", type = "string")     
           cmds.setAttr(f"{MetalnessName}.alphaIsLuminance",1)

       else:
           pass
               
  ## NORMAL ##
       if Normal == True:
           print("Normal Node Created")
       
           # Create File, p2d and b2d Nodes #  
           NormalName = f"{self.AiSSName}"+"_Normal"
           NMfileNode = cmds.shadingNode('file',n=f"{NormalName}", asTexture=True)
           NMp2dName = f"{self.AiSSName}"+"_NM_p2d"         
           NMp2dNode = cmds.shadingNode("place2dTexture", n =f"{NMp2dName}", asUtility=True)
           NMb2dName = f"{self.AiSSName}"+"_NM_b2d"
           NMb2dNode = cmds.shadingNode("bump2d", n = f"{NMb2dName}", asUtility = True)
           cmds.setAttr(f"{NMb2dName}.bumpInterp", 1)              
           # Connect p2D to File #
           connections = ['rotateUV','offset','noiseUV','vertexCameraOne','vertexUvThree','vertexUvTwo','vertexUvOne','repeatUV','wrapV','wrapU','stagger','mirrorU','mirrorV','rotateFrame','translateFrame','coverage']
           cmds.connectAttr(NMp2dNode+'.outUV',NMfileNode+'.uvCoord')
           cmds.connectAttr(NMp2dNode+'.outUvFilterSize',NMfileNode+'.uvFilterSize')
           for i in connections:
               cmds.connectAttr(NMp2dNode+'.'+i, NMfileNode+'.'+i)      
           # Connect File to Bump2d #
           cmds.connectAttr(f"{NormalName}.outAlpha", f"{NMb2dName}.bumpValue")        
           # Connect Bump2d to AiSS #
           cmds.connectAttr(f"{NMb2dName}.outNormal", f"{self.AiSSName}.normalCamera")
           
           # Find Normal Files #
           listfiles = os.listdir(self.pathName)
           NMfileList = []                       
           for item in listfiles:                
               fileName = item                   
               splitOne = item.split("_")        
               mapnum = splitOne[-1]             
               splitTwo = mapnum.split(".")      

               maptype = splitTwo[0]             
               if maptype == "Normal":        
                   fileInput = fileName
                   NMfileList.append(fileInput)  
               else:
                   pass
           NMfileInput = self.pathName + "/" + NMfileList[0]                                
           cmds.setAttr(f"{NormalName}.fileTextureName", NMfileInput, type="string")     
       
           # If multiple UV tiles #
           if multiUVquery == True:
               cmds.setAttr(f"{NormalName}.uvTilingMode", 3)
           else:
               pass
       
           # Color Space and Alpha as Luminance #      
           cmds.setAttr(f"{NormalName}.ignoreColorSpaceFileRules",1)
           cmds.setAttr(f"{NormalName}.colorSpace","Raw", type = "string")
           cmds.setAttr(f"{NormalName}.alphaIsLuminance",0)    

       else:
           pass
                    
  ## HEIGHT ##
       if Height == True:
           print("Height Node Created")
       
           # Create File and p2d Nodes #  
           HeightName = f"{self.AiSSName}"+"_Height"
           HTsetName = f"{self.AiSSName}"+"_set"
           HTfileNode = cmds.shadingNode('file',n=f"{HeightName}", asTexture=True)
           HTp2dName = f"{self.AiSSName}"+"_HT_p2d"         
           HTp2dNode = cmds.shadingNode("place2dTexture", n =f"{HTp2dName}", asUtility=True)
           # Connect p2D to File #
           connections = ['rotateUV','offset','noiseUV','vertexCameraOne','vertexUvThree','vertexUvTwo','vertexUvOne','repeatUV','wrapV','wrapU','stagger','mirrorU','mirrorV','rotateFrame','translateFrame','coverage']
           cmds.connectAttr(HTp2dNode+'.outUV',HTfileNode+'.uvCoord')
           cmds.connectAttr(HTp2dNode+'.outUvFilterSize',HTfileNode+'.uvFilterSize')
           for i in connections:
               cmds.connectAttr(HTp2dNode+'.'+i, HTfileNode+'.'+i)        
           # Create remap and displacement Nodes #
           HTremapName = f"{self.AiSSName}"+"_HT_remap"
           HTremapNode = cmds.shadingNode('remapValue',n=f"{HTremapName}", asUtility=True)
           cmds.setAttr(f"{HTremapName}.outputMin", -0.5)
           cmds.setAttr(f"{HTremapName}.outputMax", 0.5)
           HTdispName = f"{self.AiSSName}"+"_HT_disp" # save
           HTdispNode = cmds.shadingNode('displacementShader',n=f"{HTdispName}", asShader=True)
           cmds.setAttr(f"{HTdispName}.scale", 0.001)        
           # Connect File to Remap Node #
           cmds.connectAttr(f"{HeightName}.outAlpha", f"{HTremapName}.inputValue")
           # Connect Remap to Displacement #
           cmds.connectAttr(f"{HTremapName}.outValue", f"{HTdispName}.displacement")
           # Connect displacement to AiSS set #
           cmds.connectAttr(f"{HTdispName}.displacement", f"{HTsetName}.displacementShader")
           
           # Find Height Files #
           listfiles = os.listdir(self.pathName)
           HTfileList = []                       
           for item in listfiles:                
               fileName = item                   
               splitOne = item.split("_")        
               mapnum = splitOne[-1]             
               splitTwo = mapnum.split(".")      

               maptype = splitTwo[0]             
               if maptype == "Height":        
                   fileInput = fileName
                   HTfileList.append(fileInput)  
               else:
                   pass
           HTfileInput = self.pathName + "/" + HTfileList[0]                                
           cmds.setAttr(f"{HeightName}.fileTextureName", HTfileInput, type="string")     
       
           # If multiple UV tiles #
           if multiUVquery == True:
               cmds.setAttr(f"{HeightName}.uvTilingMode", 3)
           else:
               pass
       
           # Color Space and Alpha as Luminance #      
           cmds.setAttr(f"{HeightName}.ignoreColorSpaceFileRules",1)
           cmds.setAttr(f"{HeightName}.colorSpace","Raw", type = "string")
           cmds.setAttr(f"{HeightName}.alphaIsLuminance",1)

       else:
           pass
               
  ## OPACITY ##
       if Opacity == True:
           print("Opacity Node Created")
       
           # Create File and p2D Nodes #  
           OpacityName = f"{self.AiSSName}"+"_Opacity"
           OPp2dName = f"{self.AiSSName}"+"_OP_p2d"
           OPfileNode = cmds.shadingNode('file',n=f"{OpacityName}", asTexture=True)          
           OPp2dNode = cmds.shadingNode("place2dTexture", n =f"{OPp2dName}", asUtility=True)            
           # Connect p2D to File #
           connections = ['rotateUV','offset','noiseUV','vertexCameraOne','vertexUvThree','vertexUvTwo','vertexUvOne','repeatUV','wrapV','wrapU','stagger','mirrorU','mirrorV','rotateFrame','translateFrame','coverage']
           cmds.connectAttr(OPp2dNode+'.outUV',OPfileNode+'.uvCoord')
           cmds.connectAttr(OPp2dNode+'.outUvFilterSize',OPfileNode+'.uvFilterSize')
           for i in connections:
               cmds.connectAttr(OPp2dNode+'.'+i, OPfileNode+'.'+i)
           # Connect File to AiSS #
           cmds.connectAttr(f"{OpacityName}.outColor",f"{self.AiSSName}.opacity")
         
           # Find Opacity Files #
           listfiles = os.listdir(self.pathName)
           OPfileList = []                       
           for item in listfiles:                
               fileName = item                   
               splitOne = item.split("_")        
               mapnum = splitOne[-1]             
               splitTwo = mapnum.split(".")      

               maptype = splitTwo[0]             
               if maptype == "Opacity":        
                   fileInput = fileName
                   OPfileList.append(fileInput)  
               else:
                   pass
           OPfileInput = self.pathName + "/" + OPfileList[0]                                
           cmds.setAttr(f"{OpacityName}.fileTextureName", OPfileInput, type="string")     
           
           # If multiple UV tiles #
           if multiUVquery == True:
               cmds.setAttr(f"{OpacityName}.uvTilingMode", 3)
           else:
               pass
       
           # Color Space and Alpha as Luminance #
           cmds.setAttr(f"{OpacityName}.ignoreColorSpaceFileRules",1)
           cmds.setAttr(f"{OpacityName}.colorSpace","Raw", type = "string")     
           cmds.setAttr(f"{OpacityName}.alphaIsLuminance",1)

       else:
           pass
               
  ## EMISSIVE ##
       if Emissive == True:
           print("Emissive Node Created")
       
           # Create File and p2D Nodes #  
           EmissiveName = f"{self.AiSSName}"+"_Emissive"
           EMp2dName = f"{self.AiSSName}"+"_EM_p2d"
           EMfileNode = cmds.shadingNode('file',n=f"{EmissiveName}", asTexture=True)          
           EMp2dNode = cmds.shadingNode("place2dTexture", n =f"{EMp2dName}", asUtility=True)            
           # Connect p2D to File #
           connections = ['rotateUV','offset','noiseUV','vertexCameraOne','vertexUvThree','vertexUvTwo','vertexUvOne','repeatUV','wrapV','wrapU','stagger','mirrorU','mirrorV','rotateFrame','translateFrame','coverage']
           cmds.connectAttr(EMp2dNode+'.outUV',EMfileNode+'.uvCoord')
           cmds.connectAttr(EMp2dNode+'.outUvFilterSize',EMfileNode+'.uvFilterSize')
           for i in connections:
               cmds.connectAttr(EMp2dNode+'.'+i, EMfileNode+'.'+i)
           # Connect File to AiSS #
           cmds.connectAttr(f"{EmissiveName}.outAlpha",f"{self.AiSSName}.emission")# yeah
         
           # Find Emissive Files #
           listfiles = os.listdir(self.pathName)
           EMfileList = []                       
           for item in listfiles:                
               fileName = item                   
               splitOne = item.split("_")        
               mapnum = splitOne[-1]             
               splitTwo = mapnum.split(".")      

               maptype = splitTwo[0]             
               if maptype == "Emissive":        
                   fileInput = fileName
                   EMfileList.append(fileInput)  
               else:
                   pass
           EMfileInput = self.pathName + "/" + EMfileList[0]                                
           cmds.setAttr(f"{EmissiveName}.fileTextureName", EMfileInput, type="string")     
           
           # If multiple UV tiles #
           if multiUVquery == True:
               cmds.setAttr(f"{EmissiveName}.uvTilingMode", 3)
           else:
               pass
       
           # Color Space and Alpha as Luminance #
           cmds.setAttr(f"{EmissiveName}.ignoreColorSpaceFileRules",1)
           cmds.setAttr(f"{EmissiveName}.colorSpace","Raw", type = "string")     
           cmds.setAttr(f"{EmissiveName}.alphaIsLuminance",1)
       
       else:
           pass
               
  ## SUBSURFACE SCATTERING ##
       if SSScattering == True:
           print("SSScattering Node Created")
       
           # Create File and p2D Nodes #  
           SSScatteringName = f"{self.AiSSName}"+"_SSScattering"
           SSp2dName = f"{self.AiSSName}"+"_SS_p2d"
           SSfileNode = cmds.shadingNode('file',n=f"{SSScatteringName}", asTexture=True)          
           SSp2dNode = cmds.shadingNode("place2dTexture", n =f"{SSp2dName}", asUtility=True)                
           # Connect p2D to File #
           connections = ['rotateUV','offset','noiseUV','vertexCameraOne','vertexUvThree','vertexUvTwo','vertexUvOne','repeatUV','wrapV','wrapU','stagger','mirrorU','mirrorV','rotateFrame','translateFrame','coverage']
           cmds.connectAttr(SSp2dNode+'.outUV',SSfileNode+'.uvCoord')
           cmds.connectAttr(SSp2dNode+'.outUvFilterSize',SSfileNode+'.uvFilterSize')
           for i in connections:
               cmds.connectAttr(SSp2dNode+'.'+i, SSfileNode+'.'+i)
           # Connect File to AiSS #
           cmds.connectAttr(f"{SSScatteringName}.outAlpha",f"{self.AiSSName}.subsurface")
         
           # Find Scattering Files #
           listfiles = os.listdir(self.pathName)
           SSfileList = []                       
           for item in listfiles:                
               fileName = item                   
               splitOne = item.split("_")        
               mapnum = splitOne[-1]             
               splitTwo = mapnum.split(".")      

               maptype = splitTwo[0]             
               if maptype == "Scattering":        
                   fileInput = fileName
                   SSfileList.append(fileInput)  
               else:
                   pass
           SSfileInput = self.pathName + "/" + SSfileList[0]                                
           cmds.setAttr(f"{SSScatteringName}.fileTextureName", SSfileInput, type="string")     
           
           # If multiple UV tiles #  
           if multiUVquery == True:
               cmds.setAttr(f"{SSScatteringName}.uvTilingMode", 3)
           else:
               pass
       
           # Color Space and Alpha as Luminance #
           cmds.setAttr(f"{SSScatteringName}.ignoreColorSpaceFileRules",1)
           cmds.setAttr(f"{SSScatteringName}.colorSpace","Raw", type = "string")     
           cmds.setAttr(f"{SSScatteringName}.alphaIsLuminance",1)   
       
           # SSScattering Choose Color and set attribute #
           rgb = cmds.colorSliderGrp(self.SSScolor, query=True, rgbValue=True)
           red = rgb[0]
           blue = rgb[1]
           green = rgb[2]
           cmds.setAttr(f"{self.AiSSName}.subsurfaceColor", red, blue, green)

       else:
           pass

 

bottom of page