# 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

        # 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,
                                                         geo_name=geo_key,
                                                         textureset_dict=textureset_dict)

                    if autoAssingShader:
                        currentShader.getShader().assign_shader(geo_key)

                    break
                else:
                    textureset_dict = self.texture_dict[geo_key][texture_set]
                    currentShader = shader.TextureShader(texture_path=self.file_manager.path,
                                                         geo_name=texture_set,
                                                         textureset_dict=textureset_dict)

                    if autoAssingShader:
                        currentShader.getShader().assign_shader(geo_key)

        # set tx or tex file format
        if self.render_engine == 'arnold':
            # for arnold should be default, conversion is done by Maya
            # texture_ext_path.replace_ext(ext='.tx')
            pass
        elif self.render_engine == 'renderman':

# 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


        # 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,
                                                         geo_name=geo_key,
                                                         textureset_dict=textureset_dict)

                    if autoAssingShader:
                        currentShader.getShader().assign_shader(geo_key)

                    break
                else:
                    textureset_dict = self.texture_dict[geo_key][texture_set]
                    currentShader = shader.TextureShader(texture_path=self.file_manager.path,
                                                         geo_name=texture_set,
                                                         textureset_dict=textureset_dict)

                    if autoAssingShader:
                        currentShader.getShader().assign_shader(geo_key)

        # set tx or tex file format
        if self.render_engine == 'arnold':
            # for arnold should be default, conversion is done by Maya
            # texture_ext_path.replace_ext(ext='.tx')
            pass
        elif self.render_engine == 'renderman':

            texture_ext_path.replace_ext(ext='.tex', file_name_attribute='.filename', file_type='PxrTexture')