def lcObjToolsUI(dockable=False, *args, **kwargs): ''' ''' global prefix ci = 0 #color index iterator windowName = 'lcObjTools' shelfCommand = 'import lct.src.lcObjTools.lcObjTools as lcObj\nreload(lcObj)\nlcObj.lcObjToolsUI()' icon = basePath+'lcObjTools.png' winWidth = 204 winHeight = 158 mainWindow = lcWindow(windowName=windowName, width=winWidth, height=winHeight, icon=icon, shelfCommand=shelfCommand, annotation=annotation, dockable=dockable, menuBar=True) mainWindow.create() # pm.columnLayout(prefix+'_columLayout_main') # pm.rowColumnLayout(nc=2, cw=([1,150], [2,50]) ) pm.textField(prefix+'_textField_export_path', w=150) pm.button(prefix+'_button_browse_path', l='Browse', bgc=colorWheel.getColorRGB(ci), annotation='Choose an export directory', w=50, command=lambda *args: path.browsePathTextField(prefix+'_textField_export_path', "Wavefront Obj (*.obj)", 'Obj Export Location') ) ci+=1 pm.setParent(prefix+'_columLayout_main') # pm.checkBox(prefix+'_checkBox_export_indi', l='Export Individual', v=False) pm.checkBox(prefix+'_checkBox_use_smooth', l='Use Smooth Preview', v=True) # pm.rowColumnLayout(nc=2, cw=([1,100], [2,100]) ) pm.textField(prefix+'_textField_prefix', w=100) pm.text(l=' Prefix_', al='left') pm.setParent(prefix+'_columLayout_main') # pm.rowColumnLayout(nc=2, cw=([1,169], [2,31]) ) pm.columnLayout(w=169) pm.button(prefix+'_button_export', l='Export OBJ', bgc=colorWheel.getColorRGB(ci), annotation='Export the selected geometry', w=168, h=30, command=lambda *args: lcObj_exportObjs() ) ci+=1 pm.button(prefix+'_button_Import', l='Import Multiple OBJs', bgc=colorWheel.getColorRGB(ci), annotation='Clean import more than one obj', w=168, h=20, command=lambda *args: lcObj_importMultiple() ) ci+=1 pm.setParent('..') pm.columnLayout(w=31) pm.iconTextButton(prefix+'_button_open_folder', style='iconOnly', image=iconBasePath+'folder_30x50.png', annotation='Open the export folder', w=30, h=50, command=lambda *args: path.openFilePath(pm.textField(prefix+'_textField_export_path', query=True, text=True) ) ) ci+=1 # mainWindow.show() plugin.reloadPlugin(plugin='objExport', autoload=True)
def createShader(cls, name, path, *args, **kwargs): """ 'name' is the name you want to give the shader 'path' is the filepath with .cgfx file """ plugin.reloadPlugin('cgfxShader', True) shaderCGFX = pm.shadingNode('cgfxShader', asShader=True, name=name+'_CGFX_01' ) SG = pm.sets(renderable=True, noSurfaceShader=True, empty=True, name=(shaderCGFX+'_SG') ) pm.connectAttr(shaderCGFX.outColor, SG.surfaceShader, force=True) pm.cgfxShader(shaderCGFX, edit=True, fx=path) #this will fail if the cgfxShader plugin is not loaded return shaderCGFX
def createShader(cls, name, path, *args, **kwargs): """ name is the name you want to give the shader path is the filepath with .fx file """ plugin.reloadPlugin('hlslShader', True) shaderHLSL = pm.shadingNode('hlslShader', asShader=True, name=name+'_HLSL_01' ) SG = pm.sets(renderable=True, noSurfaceShader=True, empty=True, name=(shaderHLSL+'_SG') ) pm.connectAttr(shaderHLSL.outColor, SG.surfaceShader, force=True) shaderHLSL.shader.set(path) print '# hlslShader : \"{0}\" loaded effect \"{1}\" #'.format(shaderHLSL, path) return shaderHLSL
def lcBatchBakeUI(dockable=False, *args, **kwargs): ''' ''' ci = 0 #color index iterator windowName = 'lcBatchBake' shelfCommand = 'import lct.src.lcBatchBake.lcBatchBake as lcBake\nreload(lcBake)\nlcBake.lcBatchBakeUI()' icon = basePath + 'lcBatchBake.png' winWidth = 204 winHeight = 218 mainWindow = lcWindow(windowName=windowName, width=winWidth, height=winHeight, icon=icon, shelfCommand=shelfCommand, annotation=annotation, dockable=dockable, menuBar=True) mainWindow.create() pm.menu(l='Options', helpMenu=True) pm.menuItem( l='Delete All bake sets', command=lambda *args: lcBake_delete_all_bake_sets(bakeSetListDropdown)) # pm.columnLayout(prefix + '_columLayout_main') # pm.rowColumnLayout(nc=2, cw=([1, 100], [2, 100])) pm.button(l='Make Texture', bgc=colorWheel.getColorRGB(ci), w=100, h=25, annotation='Create a Texture bake set', command=lambda *args: lcBake_make_new_bake_set( bakeSetListDropdown, 'texture')) ci += 1 pm.button(l='Make Vertex', bgc=colorWheel.getColorRGB(ci), w=100, h=25, annotation='Create a Texture bake set', command=lambda *args: lcBake_make_new_bake_set( bakeSetListDropdown, 'vertex')) ci += 1 pm.setParent(prefix + '_columLayout_main') # pm.rowColumnLayout(nc=3, cw=([1, 25], [2, 150], [3, 25])) pm.iconTextButton(w=25, h=25, style='iconOnly', image=iconBasePath + 'reloadList.png', annotation='Reload the bake set list', command=lambda *args: lcBake_populate_bake_set_list( bakeSetListDropdown)) bakeSetListDropdown = pm.optionMenu(prefix + '_optionMenu_bake_set_list', w=150, h=25, annotation='List of bake sets') pm.iconTextButton(w=25, h=25, style='iconOnly', image=iconBasePath + 'deleteItem.png', annotation='Delete this bake set', command=lambda *args: lcBake_delete_current_bake_set( bakeSetListDropdown)) pm.setParent(prefix + '_columLayout_main') # pm.rowColumnLayout(nc=2, cw=([1, 100], [2, 100])) #nc=3, cw=([1,50], [2,50], [3,100] ) ) pm.button(l='+ Add', bgc=colorWheel.getColorRGB(ci), w=100, h=25, annotation='Add geometry to bake set', command=lambda *args: lcBake_add_to_current_bake_set( bakeSetListDropdown)) ci += 1 # pm.button(l='- Rem', bgc=colorWheel.getColorRGB(ci), w=50, h=25, annotation='Remove geometry from bake set', command=lambda *args: lcBake_fake_command() ) # ci+=1 pm.button( l='Edit Options', bgc=colorWheel.getColorRGB(ci), w=100, h=25, annotation='Edit the bake set options', command=lambda *args: lcBake_show_bake_set_attrs(bakeSetListDropdown)) ci += 1 pm.setParent(prefix + '_columLayout_main') # pm.rowColumnLayout(nc=2, cw=([1, 75], [2, 125])) pm.text(l='Bake Camera: ', al='right') cameraListDropdown = pm.optionMenu(prefix + '_optionMenu_camera_list', w=125, h=25, annotation='List of cameras') pm.text(l='') pm.checkBox(prefix + '_checkBox_shadows', w=125, h=25, value=True, label='Shadows and AO?', annotation='Turn on to bake shadows and ambient occlusion') pm.setParent(prefix + '_columLayout_main') # pm.separator(style='none', h=10) pm.rowColumnLayout(nc=2, cw=([1, 150], [2, 50])) pm.textField(prefix + '_textField_texture_path', text='texture output directory', annotation='Output directory path', w=150) pm.button( prefix + '_button_browse_path', l='Browse', bgc=colorWheel.getColorRGB(ci), annotation='Choose a directory', w=50, command=lambda *args: path.browsePathTextField( prefix + '_textField_texture_path', '', 'Browse a Directory')) ci += 1 pm.setParent(prefix + '_columLayout_main') # pm.rowColumnLayout(nc=2, cw=([1, 150], [2, 50])) pm.button(l='Bake It !!', bgc=colorWheel.getColorRGB(ci), w=150, h=25, annotation='Bake to texture or vertex', command=lambda *args: lcBake_convert_lightmap( bakeSetListDropdown, cameraListDropdown)) ci += 1 pm.button(l='Open Dir', bgc=colorWheel.getColorRGB(ci), w=50, h=25, annotation='Open the output directory', command=lambda *args: lcBake_open_lightmap_folder()) ci += 1 # mainWindow.show() plugin.reloadPlugin(plugin='Mayatomr', autoload=True) lcBake_populate_bake_set_list(bakeSetListDropdown) lcBake_populate_camera_list(cameraListDropdown)
def lcObjToolsUI(dockable=False, *args, **kwargs): ''' ''' global prefix ci = 0 #color index iterator windowName = 'lcObjTools' shelfCommand = 'import lct.src.lcObjTools.lcObjTools as lcObj\nreload(lcObj)\nlcObj.lcObjToolsUI()' icon = basePath + 'lcObjTools.png' winWidth = 204 winHeight = 158 mainWindow = lcWindow(windowName=windowName, width=winWidth, height=winHeight, icon=icon, shelfCommand=shelfCommand, annotation=annotation, dockable=dockable, menuBar=True) mainWindow.create() # pm.columnLayout(prefix + '_columLayout_main') # pm.rowColumnLayout(nc=2, cw=([1, 150], [2, 50])) pm.textField(prefix + '_textField_export_path', w=150) pm.button(prefix + '_button_browse_path', l='Browse', bgc=colorWheel.getColorRGB(ci), annotation='Choose an export directory', w=50, command=lambda *args: path.browsePathTextField( prefix + '_textField_export_path', "Wavefront Obj (*.obj)", 'Obj Export Location')) ci += 1 pm.setParent(prefix + '_columLayout_main') # pm.checkBox(prefix + '_checkBox_export_indi', l='Export Individual', v=False) pm.checkBox(prefix + '_checkBox_use_smooth', l='Use Smooth Preview', v=True) # pm.rowColumnLayout(nc=2, cw=([1, 100], [2, 100])) pm.textField(prefix + '_textField_prefix', w=100) pm.text(l=' Prefix_', al='left') pm.setParent(prefix + '_columLayout_main') # pm.rowColumnLayout(nc=2, cw=([1, 169], [2, 31])) pm.columnLayout(w=169) pm.button(prefix + '_button_export', l='Export OBJ', bgc=colorWheel.getColorRGB(ci), annotation='Export the selected geometry', w=168, h=30, command=lambda *args: lcObj_exportObjs()) ci += 1 pm.button(prefix + '_button_Import', l='Import Multiple OBJs', bgc=colorWheel.getColorRGB(ci), annotation='Clean import more than one obj', w=168, h=20, command=lambda *args: lcObj_importMultiple()) ci += 1 pm.setParent('..') pm.columnLayout(w=31) pm.iconTextButton( prefix + '_button_open_folder', style='iconOnly', image=iconBasePath + 'folder_30x50.png', annotation='Open the export folder', w=30, h=50, command=lambda *args: path.openFilePath( pm.textField( prefix + '_textField_export_path', query=True, text=True))) ci += 1 # mainWindow.show() plugin.reloadPlugin(plugin='objExport', autoload=True)
def lcBatchBakeUI(dockable=False, *args, **kwargs): ''' ''' ci = 0 #color index iterator windowName = 'lcBatchBake' shelfCommand = 'import lct.src.lcBatchBake.lcBatchBake as lcBake\nreload(lcBake)\nlcBake.lcBatchBakeUI()' icon = basePath+'lcBatchBake.png' winWidth = 204 winHeight = 218 mainWindow = lcWindow(windowName=windowName, width=winWidth, height=winHeight, icon=icon, shelfCommand=shelfCommand, annotation=annotation, dockable=dockable, menuBar=True) mainWindow.create() pm.menu(l='Options', helpMenu=True) pm.menuItem(l='Delete All bake sets', command=lambda *args: lcBake_delete_all_bake_sets(bakeSetListDropdown) ) # pm.columnLayout(prefix+'_columLayout_main') # pm.rowColumnLayout(nc=2, cw=([1,100], [2,100]) ) pm.button(l='Make Texture', bgc=colorWheel.getColorRGB(ci), w=100, h=25, annotation='Create a Texture bake set', command=lambda *args: lcBake_make_new_bake_set(bakeSetListDropdown, 'texture') ) ci+=1 pm.button(l='Make Vertex', bgc=colorWheel.getColorRGB(ci), w=100, h=25, annotation='Create a Texture bake set', command=lambda *args: lcBake_make_new_bake_set(bakeSetListDropdown, 'vertex') ) ci+=1 pm.setParent(prefix+'_columLayout_main') # pm.rowColumnLayout(nc=3, cw=([1,25], [2,150], [3,25]) ) pm.iconTextButton(w=25, h=25, style='iconOnly', image=iconBasePath+'reloadList.png', annotation='Reload the bake set list', command=lambda *args: lcBake_populate_bake_set_list(bakeSetListDropdown) ) bakeSetListDropdown = pm.optionMenu(prefix+'_optionMenu_bake_set_list', w=150, h=25, annotation='List of bake sets' ) pm.iconTextButton(w=25, h=25, style='iconOnly', image=iconBasePath+'deleteItem.png', annotation='Delete this bake set', command=lambda *args: lcBake_delete_current_bake_set(bakeSetListDropdown) ) pm.setParent(prefix+'_columLayout_main') # pm.rowColumnLayout(nc=2, cw=([1,100], [2,100] ) ) #nc=3, cw=([1,50], [2,50], [3,100] ) ) pm.button(l='+ Add', bgc=colorWheel.getColorRGB(ci), w=100, h=25, annotation='Add geometry to bake set', command=lambda *args: lcBake_add_to_current_bake_set(bakeSetListDropdown) ) ci+=1 # pm.button(l='- Rem', bgc=colorWheel.getColorRGB(ci), w=50, h=25, annotation='Remove geometry from bake set', command=lambda *args: lcBake_fake_command() ) # ci+=1 pm.button(l='Edit Options', bgc=colorWheel.getColorRGB(ci), w=100, h=25, annotation='Edit the bake set options', command=lambda *args: lcBake_show_bake_set_attrs(bakeSetListDropdown) ) ci+=1 pm.setParent(prefix+'_columLayout_main') # pm.rowColumnLayout(nc=2, cw=([1,75], [2,125] ) ) pm.text(l='Bake Camera: ', al='right') cameraListDropdown = pm.optionMenu(prefix+'_optionMenu_camera_list', w=125, h=25, annotation='List of cameras' ) pm.text(l='') pm.checkBox(prefix+'_checkBox_shadows', w=125, h=25, value=True, label='Shadows and AO?', annotation='Turn on to bake shadows and ambient occlusion' ) pm.setParent(prefix+'_columLayout_main') # pm.separator(style='none', h=10) pm.rowColumnLayout(nc=2, cw=([1,150], [2,50]) ) pm.textField(prefix+'_textField_texture_path', text='texture output directory', annotation='Output directory path', w=150) pm.button(prefix+'_button_browse_path', l='Browse', bgc=colorWheel.getColorRGB(ci), annotation='Choose a directory', w=50, command=lambda *args: path.browsePathTextField(prefix+'_textField_texture_path', '', 'Browse a Directory') ) ci+=1 pm.setParent(prefix+'_columLayout_main') # pm.rowColumnLayout(nc=2, cw=([1,150], [2,50]) ) pm.button(l='Bake It !!', bgc=colorWheel.getColorRGB(ci), w=150, h=25, annotation='Bake to texture or vertex', command=lambda *args: lcBake_convert_lightmap(bakeSetListDropdown, cameraListDropdown) ) ci+=1 pm.button(l='Open Dir', bgc=colorWheel.getColorRGB(ci), w=50, h=25, annotation='Open the output directory', command=lambda *args: lcBake_open_lightmap_folder() ) ci+=1 # mainWindow.show() plugin.reloadPlugin(plugin='Mayatomr', autoload=True) lcBake_populate_bake_set_list(bakeSetListDropdown) lcBake_populate_camera_list(cameraListDropdown)