# Path: pdil/_add/path.py
# def normalize(p): # type: (str) -> str
# def compare(a, b): # type: (str, str) -> bool
# def nicePath(path): # type: (str) -> str
# def cleanFilepath(filepath): # type: (str) -> str
# def getMayaFiles(folder): # type: (str) -> List[str]
# def getTempPath(filename):


from collections import OrderedDict
from pymel.core import cmds, delete, ls, nt, sets, shadingNode
from .._add import path
import re
    shaders = []
    for shadingEngine in set(obj.getShape().listConnections( type='shadingEngine')):
        con = shadingEngine.surfaceShader.listConnections()
        if con:
            shaders.append( con[0] )
    
    return shaders


def compare(a, b):
    '''
    Return True if the two shaders are of the same type and have the same color
    or texture.
    '''
    if type(a) != type(b):
        return False
    
    try:
        aColor = a.color.listConnections()
        bColor = b.color.listConnections()
    except Exception:
        aColor = a.outColor.listConnections()
        bColor = b.outColor.listConnections()
    
    if not aColor and not bColor:
        if a.color.get() == b.color.get():
            return True
        
    if aColor and bColor:
        if isinstance(aColor[0], nt.File) and isinstance(bColor[0], nt.File):

# Path: pdil/_add/path.py
# def normalize(p): # type: (str) -> str
# def compare(a, b): # type: (str, str) -> bool
# def nicePath(path): # type: (str) -> str
# def cleanFilepath(filepath): # type: (str) -> str
# def getMayaFiles(folder): # type: (str) -> List[str]
# def getTempPath(filename):


# Path: pdil/_core/shader.py
from collections import OrderedDict
from pymel.core import cmds, delete, ls, nt, sets, shadingNode
from .._add import path
import re

    shaders = []
    for shadingEngine in set(obj.getShape().listConnections( type='shadingEngine')):
        con = shadingEngine.surfaceShader.listConnections()
        if con:
            shaders.append( con[0] )
    
    return shaders


def compare(a, b):
    '''
    Return True if the two shaders are of the same type and have the same color
    or texture.
    '''
    if type(a) != type(b):
        return False
    
    try:
        aColor = a.color.listConnections()
        bColor = b.color.listConnections()
    except Exception:
        aColor = a.outColor.listConnections()
        bColor = b.outColor.listConnections()
    
    if not aColor and not bColor:
        if a.color.get() == b.color.get():
            return True
        
    if aColor and bColor:
        if isinstance(aColor[0], nt.File) and isinstance(bColor[0], nt.File):

            if path.compare( aColor[0].fileTextureName.get(), bColor[0].fileTextureName.get() ):