# Path: mayaLib/shaderLib/shader.py
# class TextureShader():
#     def __init__(self, texture_path, geo_name, textureset_dict, single_place_node=True):
#     def build_aiStandard(self, texture_path, geo_name, textureset_dict, single_place_node=True):
#     def build_pxrSurface(self, texture_path, geo_name, textureset_dict, pxrTextureNode=True, single_place_node=True):
#     def getShader(self):
# 
# Path: mayaLib/shaderLib/utils/file.py
# class TextureFile():  # ToDo: move in util?
# class TextureFileManager():
#     def __init__(self, path, filename):
#     def _partition(self):
#     def get_channels(self):
#     def __init__(self, dirname=pm.workspace(q=True, dir=True, rd=True) + '/sourceimages/', ext='exr'):
#     def search_in_directory(self, dirname, ext):
#     def build_dict(self):
#     def get_path(self):
# 
# Path: mayaLib/shaderLib/utils/texture_ext_path.py
# def replacePath(fileName, oldPath, newPath):
# def changeExtension(filename, newExtension):
# def replace_ext(ext, file_name_attribute, file_type):
# def replace_path(oldPath, path, file_name_attribute, file_type):


import pymel.core as pm
from mayaLib.shaderLib import shader
from mayaLib.shaderLib.utils import file
from mayaLib.shaderLib.utils import texture_ext_path
__author__ = 'Lorenzo Argentieri'




class ShadersManager():
    def __init__(self, path=str(pm.workspace(q=True, dir=True, rd=True) + 'sourceimages/'), ext='exr',
                 autoAssingShader=True):
        # See active Renderer
        self.render_engine = pm.ls('defaultRenderGlobals')[0].currentRenderer.get()
        self.file_manager = file.TextureFileManager(dirname=path, ext=ext)
        self.texture_dict = self.file_manager.texture_dict

        # for all geo
        for geo_key in list(self.texture_dict.keys()):
            # check if is UDIM or, for all texture set
            for texture_set in list(self.texture_dict[geo_key].keys()):
                if texture_set == 'UDIM':
                    textureset_dict = self.texture_dict[geo_key][texture_set]

# Path: mayaLib/shaderLib/shader.py
# class TextureShader():
#     def __init__(self, texture_path, geo_name, textureset_dict, single_place_node=True):
#     def build_aiStandard(self, texture_path, geo_name, textureset_dict, single_place_node=True):
#     def build_pxrSurface(self, texture_path, geo_name, textureset_dict, pxrTextureNode=True, single_place_node=True):
#     def getShader(self):
# 
# Path: mayaLib/shaderLib/utils/file.py
# class TextureFile():  # ToDo: move in util?
# class TextureFileManager():
#     def __init__(self, path, filename):
#     def _partition(self):
#     def get_channels(self):
#     def __init__(self, dirname=pm.workspace(q=True, dir=True, rd=True) + '/sourceimages/', ext='exr'):
#     def search_in_directory(self, dirname, ext):
#     def build_dict(self):
#     def get_path(self):
# 
# Path: mayaLib/shaderLib/utils/texture_ext_path.py
# def replacePath(fileName, oldPath, newPath):
# def changeExtension(filename, newExtension):
# def replace_ext(ext, file_name_attribute, file_type):
# def replace_path(oldPath, path, file_name_attribute, file_type):


# Path: mayaLib/shaderLib/shaders_maker.py
import pymel.core as pm
from mayaLib.shaderLib import shader
from mayaLib.shaderLib.utils import file
from mayaLib.shaderLib.utils import texture_ext_path

__author__ = 'Lorenzo Argentieri'




class ShadersManager():
    def __init__(self, path=str(pm.workspace(q=True, dir=True, rd=True) + 'sourceimages/'), ext='exr',
                 autoAssingShader=True):
        # See active Renderer
        self.render_engine = pm.ls('defaultRenderGlobals')[0].currentRenderer.get()
        self.file_manager = file.TextureFileManager(dirname=path, ext=ext)
        self.texture_dict = self.file_manager.texture_dict

        # for all geo
        for geo_key in list(self.texture_dict.keys()):
            # check if is UDIM or, for all texture set
            for texture_set in list(self.texture_dict[geo_key].keys()):
                if texture_set == 'UDIM':
                    textureset_dict = self.texture_dict[geo_key][texture_set]

                    currentShader = shader.TextureShader(texture_path=self.file_manager.path,