def setWorkUnits(self): #load path and config path_config = cfgl.configLoader()[99:101] if self.cboxSysUnits.currentIndex() == 0: cmds.currentUnit(linear='m') self.lblInfo_01.setText("Units changed to m") print "Units changed to m" cfgl.ConfigWriter('Units', 'Custom_System_type_units', 'm', path_config[0], path_config[1]) if self.cboxSysUnits.currentIndex() == 1: cmds.currentUnit(linear='cm') self.lblInfo_01.setText("Units changed to cm") print "Units changed to cm" cfgl.ConfigWriter('Units', 'Custom_System_type_units', 'cm', path_config[0], path_config[1]) if self.cboxSysUnits.currentIndex() == 2: cmds.currentUnit(linear='mm') self.lblInfo_01.setText("Units changed to mm") print "Units changed to mm" cfgl.ConfigWriter('Units', 'Custom_System_type_units', 'mm', path_config[0], path_config[1])
def btnCheGradClicked (self): current_languge = cfgl.configLoader()[14] SelectionData = gen_func.checkSelection() SelectedShapes = SelectionData[0] if len(SelectedShapes) > 0: CurrentShaderData = getCurrentShader(SelectedShapes) self.PreviousShadersArray = CurrentShaderData[0] self.ObjectsWithShadersArray = CurrentShaderData[1] if checkShaderIntegrity("04") == True: changeCheckerTexture ("checker_gradient", SelectedShapes) else: createCheckerMaterial("04") changeCheckerTexture ("checker_gradient", SelectedShapes) self.checkerRoutineFunctions(SelectedShapes) conclusion_text = conclusion.uvOperationConclusion (current_languge, "assign_grad_checker") self.txtbrowUVConclusion.setHtml(conclusion_text) self.showInfo("info", "Gradient checker was assigned!") else: conclusion_text = conclusion.noSelection(current_languge, "assign_grad_checker") self.txtbrowUVConclusion.setHtml(conclusion_text) self.showInfo("warn", "Cant assign checker. Please select mesh object in Object Mode.")
def textureResChange(self): path_config = cfgl.configLoader()[99:101] current_resolution_value = str(self.cboxTexRes.currentIndex()) cfgl.ConfigWriter('Texel', 'Map_resolution', current_resolution_value, path_config[0], path_config[1]) #check Square or Not self.checkSquareMap()
def checkUnits(self): CustomSysUnits = cfgl.configLoader()[9] CurrentWorkUnits = str(rt.units.Systemtype) if CustomSysUnits != CurrentWorkUnits: rt.execute("units.Systemtype = #" + CustomSysUnits) if CustomSysUnits == 'meters': self.cboxSysUnits.setCurrentIndex(0) if CustomSysUnits == 'centimeters': self.cboxSysUnits.setCurrentIndex(1) if CustomSysUnits == 'millimeters': self.cboxSysUnits.setCurrentIndex(2) print("PolygonTools: Units changed to", CustomSysUnits) self.lblInfo_01.setText("Units changed to " + CustomSysUnits) else: if CustomSysUnits == 'meters': self.cboxSysUnits.setCurrentIndex(0) if CustomSysUnits == 'centimeters': self.cboxSysUnits.setCurrentIndex(1) if CustomSysUnits == 'millimeters': self.cboxSysUnits.setCurrentIndex(2) print("PolygonTools: Units is", CustomSysUnits) self.lblInfo_01.setText("Units is " + CustomSysUnits)
def setWorkUnits(self): #load path and config PathConfig = cfgl.configLoader()[99:101] if self.cboxSysUnits.currentIndex() == 0: rt.execute("units.Systemtype = #meters") self.lblInfo_01.setText("Units changed to meters") print(self.lblInfo_01.text()) cfgl.ConfigWriter('Units', 'Custom_System_type_units', 'meters', PathConfig[0], PathConfig[1]) if self.cboxSysUnits.currentIndex() == 1: rt.execute("units.Systemtype = #centimeters") self.lblInfo_01.setText("Units changed to centimeters") print(self.lblInfo_01.text()) cfgl.ConfigWriter('Units', 'Custom_System_type_units', 'centimeters', PathConfig[0], PathConfig[1]) if self.cboxSysUnits.currentIndex() == 2: rt.execute("units.Systemtype = #millimeters") self.lblInfo_01.setText("Units changed to millimeters") print(self.lblInfo_01.text()) cfgl.ConfigWriter('Units', 'Custom_System_type_units', 'millimeters', PathConfig[0], PathConfig[1])
def btnRemCheckClicked (self): current_languge = cfgl.configLoader()[14] for i in range(len(self.PreviousShadersArray)): try: cmds.sets(self.ObjectsWithShadersArray[i], e=True, forceElement = self.PreviousShadersArray[i]) except: pass self.PreviousShadersArray = [] self.ObjectsWithShadersArray = [] print "" print "Delete Checker Shaders:" #delete all checkers for i in range(1,5): Type = "0" + str(i) DeletedElementsCount = 0 try: cmds.delete('pt_shading_group_type_' + Type) DeletedElementsCount += 1 except: pass try: cmds.delete('pt_checker_shader_' + Type) DeletedElementsCount += 1 except: pass try: cmds.delete('pt_checker_texture_' + Type) DeletedElementsCount += 1 except: pass try: cmds.delete('pt_2dTexture_' + Type) DeletedElementsCount += 1 except: pass if DeletedElementsCount > 0: print "PolygonTools. pt_shading_group_type_" + Type, "was removed!" #disable buttons self.btnRemCheck.setEnabled(False) self.gboxCheckRes.setEnabled(False) print "" conclusion_text = conclusion.uvOperationConclusion (current_languge, "delete_checker") self.txtbrowUVConclusion.setHtml(conclusion_text) self.showInfo("info", "Remove pt-chaders operation complete!")
def btnSetTexelClicked (self): SelectionData = gen_func.checkSelection() #shapes array SelectedShapes = SelectionData[0] current_languge = cfgl.configLoader()[14] self.checkDesiredTexel() if len(SelectedShapes) > 0: print"" try: #get map res MapResValue = self.cboxTexRes.currentText() #get texel TexelValue = (str(float(self.edtSetTex.text())/100)) for i in range(len(SelectedShapes)): cmds.select(SelectedShapes[i]) #set texel maya.mel.eval('texSetTexelDensity ' + TexelValue + ' ' + MapResValue + ';') print (gen_func.shortNamer(SelectedShapes[i]) + ". Texel has been set to " + str(float(TexelValue)*100) + " px/m for map size " + MapResValue + "x" + MapResValue + "px") print "" #return selection cmds.select (SelectedShapes) uvOutsideData = gen_func.uvRangeStat(SelectedShapes) if uvOutsideData[1] != []: shapesOutside = False else: shapesOutside = True #conclusion output conclusion_text = conclusion.setTexelConclusion(current_languge, int(self.edtSetTex.text()), shapesOutside, len(SelectedShapes)) self.txtbrowTexConclusion.setHtml(conclusion_text) print "" LongText = ("The number of objects on which the texel is changed: " + str(len(SelectedShapes)) + "\n" + "Texel has been set to " + str(float(TexelValue)*100) + " px/m for map size " + MapResValue + "x" + MapResValue + "px") self.showInfo("info", LongText) except: self.setTexelWarningText() else: self.showInfo("warn", "Can't Set Texel. Please select mesh object in Object Mode.") conclusion_text = conclusion.noSelection(current_languge, "set_texel") self.txtbrowTexConclusion.setHtml(conclusion_text)
def btnRusLangPressed(self): self.btnEngLang.setChecked(False) #for press again if self.btnRusLang.isChecked() == True: self.btnEngLangPressed() #change lang path_config = cfgl.configLoader()[99:101] cfgl.ConfigWriter('Languge', 'current_languge', 'rus', path_config[0], path_config[1])
def checkTexelValue(self): try: self.lblInfo_01.setText("") #Write to config path_config = cfgl.configLoader()[99:101] current_texel_value = self.edtCurTexel.text() cfgl.ConfigWriter('In-Range', 'Texel', current_texel_value, path_config[0], path_config[1]) except: self.showInfo ("warn", "Please input correct Integer value in range 1-10000. Now default value (256) was returned.") self.edtCurTexel.setText("256")
def btnScale2Clicked(self): current_languge = cfgl.configLoader()[14] SelectionData = gen_func.checkSelection() SelectedShapes = SelectionData[0] if len(SelectedShapes) > 0: scaleUV (SelectedShapes, "Up", 2, 2) self.showInfo("info", "UV scaled Up.") else: conclusion_text = conclusion.noSelection(current_languge, "scale_uv_up") self.txtbrowUVConclusion.setHtml(conclusion_text) self.showInfo("warn", "Cant assign checker. Please select mesh object in Object Mode.")
def tinyFinEdit(self): try: tiny_it = float(self.edtTinyIt.text()) if (tiny_it<0.0001) or (tiny_it>1000): self.tinyWarning() #Write to config path_config = cfgl.configLoader()[99:101] current_tinit_value = self.edtTinyIt.text() cfgl.ConfigWriter('In-Range', 'Tiny_it', current_tinit_value, path_config[0], path_config[1]) except: self.tinyWarning()
def btnMoveUVDownClicked (self): current_languge = cfgl.configLoader()[14] SelectionData = gen_func.checkSelection() SelectedShapes = SelectionData[0] if len(SelectedShapes) > 0: moveUV (SelectedShapes, "Down", 0, -1) self.showInfo("info", "UV moved Down.") else: conclusion_text = conclusion.noSelection(current_languge, "move_uv_down") self.txtbrowUVConclusion.setHtml(conclusion_text) self.showInfo("warn", "Cant assign checker. Please select mesh object in Object Mode.")
def checkDesiredTexel(self): try: texel = (float(self.edtSetTex.text())/100) if (texel<0.01): self.setTexelWarningText() #Write to config path_config = cfgl.configLoader()[99:101] current_desired_texel = self.edtSetTex.text() cfgl.ConfigWriter('Texel', 'desired_texel', current_desired_texel, path_config[0], path_config[1]) except: self.setTexelWarningText()
def btnCleanCheckClicked(self): SelectionData = gen_func.checkSelection() #shapes array selectedShapes = SelectionData[0] current_languge = cfgl.configLoader()[14] if len(selectedShapes) > 0: try: for i in range(len(selectedShapes)): CurrentColorSet = cmds.polyColorSet(selectedShapes[i], q=True, currentColorSet=True) if CurrentColorSet != None: cmds.polyColorSet (selectedShapes[i], delete=True ) print gen_func.shortNamer(selectedShapes[i]), "was cleaned." self.showInfo("info", "Check Texel Density results have been cleared!") self.lblInRangeInfo.setText("Previous check results have been cleared!") self.btnSelectTinyUVShell.setText("Not checked yet") self.btnSelectTinyFace.setText("Not checked yet") self.btnSelectTinyFace.setDisabled(True) self.btnSelectTinyUVShell.setDisabled(True) self.tiny_uv_arr=[] self.tiny_geo_arr=[] self.pbChekProgress.setValue(0) cmds.select( selectedShapes ) conclusion_text = conclusion.CleanCheckClicked(current_languge, True) self.txtbrowTexConclusion.setHtml(conclusion_text) except: self.showInfo("warn", "There is nothing to clean! Try to clean after checking.") conclusion_text = conclusion.CleanCheckClicked(current_languge, False) self.txtbrowTexConclusion.setHtml(conclusion_text) else: self.showInfo("warn", "Can't clean check texel density results. Please select already checked mesh object in Object Mode.") conclusion_text = conclusion.noSelection(current_languge, "clean_check") self.txtbrowTexConclusion.setHtml(conclusion_text)
def checkTexelValues(self): #current values current_texel = self.edtCurTexel.text() current_diff = str(self.spnDiff.value()) current_tinyit = self.edtTinyIt.text() current_tinypx = self.edtTinyPX.text() current_desired_texel = self.edtSetTex.text() #load data from config data_from_config = cfgl.configLoader()[0:12] #values from config config_resolution = int(data_from_config[0]) config_texel = data_from_config[1] config_diff = data_from_config[2] config_tinyit = data_from_config[3] config_tinypx = data_from_config[4] config_desired_texel = data_from_config[11] #compare values self.cboxTexRes.setCurrentIndex(config_resolution) #change values if need #setcurtexel if current_texel != config_texel: self.edtCurTexel.setText(config_texel) #set diff if current_diff != config_diff: self.spnDiff.setValue(int(config_diff)) #set tinyit if current_tinyit != config_tinyit: self.edtTinyIt.setText(config_tinyit) #set tinypx if current_tinypx != config_tinypx: self.edtTinyPX.setText(config_tinypx) #set desired_texel if current_desired_texel != config_desired_texel: self.edtSetTex.setText(config_desired_texel)
def btnSelectTinyUVShellsClicked (self): current_languge = cfgl.configLoader()[14] if len(self.tiny_uv_arr) == 1: try: maya.mel.eval('TextureViewWindow;') cmds.select(self.tiny_uv_arr[0]) self.showInfo ("info", "Tiny UV Shells was selected.") conclusion_text = conclusion.selectTinyConclusion(current_languge, "UV", True) self.txtbrowTexConclusion.setHtml(conclusion_text) except: self.showInfo ("warn", "Can not select Tiny UV Shells.") self.btnSelectTinyUVShell.setDisabled(True) self.btnSelectTinyUVShell.setText("Not checked yet") conclusion_text = conclusion.selectTinyConclusion(current_languge, "UV", False) self.txtbrowTexConclusion.setHtml(conclusion_text)
def btnSelectTinyFacesClicked (self): current_languge = cfgl.configLoader()[14] if len(self.tiny_geo_arr) == 1: try: cmds.select(self.tiny_geo_arr[0]) cmds.modelEditor( modelPanel='modelPanel4', da="wireframe", grid=False, displayLights="default", cameras=False, activeView=True) self.showInfo ("info", "Tiny Faces was selected.") conclusion_text = conclusion.selectTinyConclusion(current_languge, "Face", True) self.txtbrowTexConclusion.setHtml(conclusion_text) except: self.showInfo ("warn", "Can not select Tiny Faces") self.btnSelectTinyFace.setDisabled(True) self.btnSelectTinyFace.setText("Not checked yet") conclusion_text = conclusion.selectTinyConclusion(current_languge, "Face", False) self.txtbrowTexConclusion.setHtml(conclusion_text)
def helpOpen(): rt = pymxs.runtime current_languge = cfgl.configLoader()[14] #link to proper help if current_languge == "eng": try: rt.ShellLaunch( "https://docs.google.com/document/d/1_qMTk-jUeqsh-yDwB3fmzu23S18b-AzQf_dzyM2sSB0/edit?usp=sharing", "") except: print "Can't open link. Open it manually - https://docs.google.com/document/d/1IWj53-MlLLP6MJPIJoCVVPzSr1cUAr-ijET6qgJqVDE/edit?usp=sharing" else: try: rt.ShellLaunch( "https://docs.google.com/document/d/1IWj53-MlLLP6MJPIJoCVVPzSr1cUAr-ijET6qgJqVDE/edit?usp=sharing", "") except: print "Can't open link. Open it manually - https://docs.google.com/document/d/1IWj53-MlLLP6MJPIJoCVVPzSr1cUAr-ijET6qgJqVDE/edit?usp=sharing"
def checkUnits(self): #load custom units from cfg file cfgl.configLoader()[9] custom_sys_units = cfgl.configLoader()[9] cur_work_units = cmds.currentUnit(query=True) #check units change Job UnitsCheckerJob = cmds.scriptJob( runOnce=False, event=['linearUnitChanged', self.UnitChanger]) if custom_sys_units != cur_work_units: cmds.currentUnit(linear=custom_sys_units) if custom_sys_units == 'm': self.cboxSysUnits.setCurrentIndex(0) if custom_sys_units == 'cm': self.cboxSysUnits.setCurrentIndex(1) if custom_sys_units == 'mm': self.cboxSysUnits.setCurrentIndex(2) print "PolygonTools: Units changed to ", custom_sys_units self.lblInfo_01.setText("Units changed to " + custom_sys_units) else: if custom_sys_units == 'm': self.cboxSysUnits.setCurrentIndex(0) if custom_sys_units == 'cm': self.cboxSysUnits.setCurrentIndex(1) if custom_sys_units == 'mm': self.cboxSysUnits.setCurrentIndex(2) print "PolygonTools: Units is ", custom_sys_units self.lblInfo_01.setText("Units is " + custom_sys_units)
def __init__(self, parent=None): QWidget.__init__(self, parent=parent) #set layoit self.tabSet_v_layout = QVBoxLayout(self) self.tabSet_v_layout.setAlignment(Qt.AlignTop) MaxWidth = 370 currentDir = os.path.dirname(__file__) try: iconRusLang = QPixmap(currentDir + "/icons/ruslang_icon.png") iconEngLang = QPixmap(currentDir + "/icons/englang_icon.png") iconReset = QPixmap(currentDir + "/icons/reset_icon.png") except: cmds.warning( "PolygonTools: Can't load icons for Settings Tab! Check icon files in pt_modules/icons directory." ) self.gboxSet = QGroupBox("Units Setup") self.gboxSet.setMaximumWidth(MaxWidth) self.gboxSet_v_layout = QVBoxLayout() #Top Label self.lblInfo_01 = QLabel() #Units self.cboxSysUnits = QComboBox() self.cboxSysUnits.addItems(["meters", "centimeters", "millimeters"]) #Units label self.lblSysUnits = QLabel("Working Units ") self.btnReset = QPushButton("Reset All Values to Default") self.btnReset.setStyleSheet("color:#000000;background-color:#E1E1E1;") self.btnReset.setMaximumWidth(MaxWidth) #self.btnReset.setMinimumWidth(200) self.btnReset.setMinimumHeight(30) self.btnReset.setIcon(iconReset) self.lblSysInfo = QLabel("Python Info:") self.gboxConclusionLang = QGroupBox("Conclusion Language") self.gboxConclusionLang.setMaximumWidth(MaxWidth) self.gboxConclusionLang_v_layout = QVBoxLayout() #layout for buttons self.tabSet_h_layout_02 = QHBoxLayout() self.tabSet_h_layout_02.setAlignment(Qt.AlignLeft) #lang icons self.btnRusLang = QToolButton() self.btnRusLang.setCheckable(True) self.btnRusLang.setIcon(iconRusLang) self.btnEngLang = QToolButton() self.btnEngLang.setIcon(iconEngLang) self.btnEngLang.setCheckable(True) #add button to the layout self.tabSet_h_layout_02.addWidget(self.btnEngLang) self.tabSet_h_layout_02.addWidget(self.btnRusLang) self.gboxConclusionLang_v_layout.addLayout(self.tabSet_h_layout_02) self.gboxSysInfo = QGroupBox("System Info") self.gboxSysInfo.setMaximumWidth(375) self.gboxSysInfo_v_layout = QVBoxLayout() #Add Widgets self.tabSet_v_layout.addWidget(self.lblInfo_01) self.tabSet_v_layout.addWidget(self.gboxSet) self.gboxSet.setLayout(self.gboxSet_v_layout) #Horiz Layout for Set self.tabSet_h_layout_01 = QHBoxLayout() self.tabSet_h_layout_01.setAlignment(Qt.AlignLeft) self.gboxSet_v_layout.addLayout(self.tabSet_h_layout_01) self.tabSet_h_layout_01.addWidget(self.lblSysUnits) self.tabSet_h_layout_01.addWidget(self.cboxSysUnits) #conclusion self.gboxConclusionLang.setLayout(self.gboxConclusionLang_v_layout) self.tabSet_v_layout.addWidget(self.gboxConclusionLang) self.tabSet_v_layout.addWidget(self.gboxSysInfo) self.gboxSysInfo.setLayout(self.gboxSysInfo_v_layout) self.gboxSysInfo_v_layout.addWidget(self.lblSysInfo) self.lblSysInfo.setWordWrap(True) self.tabSet_v_layout.addWidget(self.btnReset) #get Pyton version self.lblSysInfo.setText("Python: " + (platform.sys.version)) #SIGNALS self.cboxSysUnits.activated.connect(self.setWorkUnits) #change lang self.btnEngLang.pressed.connect(self.btnEngLangPressed) self.btnRusLang.pressed.connect(self.btnRusLangPressed) #reset self.btnReset.clicked.connect(self.btnResetPressed) #check Units self.checkUnits() #lang selector current_languge = cfgl.configLoader()[14] # check buttons if current_languge == "eng": self.btnRusLang.setChecked(False) self.btnEngLang.setChecked(True) elif current_languge == "rus": self.btnRusLang.setChecked(True) self.btnEngLang.setChecked(False)
def btnResetPressed(self): path_config = cfgl.configLoader()[99:101] #restore default values cfgl.createDefaultConfig(path_config[1], path_config[0])
def __init__(self, parent=None): QWidget.__init__(self, parent=parent) #Create Widgets self.tabTex_v_layout = QVBoxLayout(self) self.tabTex_v_layout.setAlignment(Qt.AlignTop) self.tabTex_v_layout.setContentsMargins(0,10,0,10) self.tabTex_v_layout.setSpacing(5) currentDir = os.path.dirname(__file__) try: iconGetTex = QPixmap(currentDir +"/icons/gettexel_icon.png") iconCheckTex = QPixmap(currentDir +"/icons/checktexel_icon.png") iconSetTex = QPixmap(currentDir +"/icons/settexel_icon.png") iconCleanCheck = QPixmap(currentDir +"/icons/cleancheck_icon.png") except: cmds.warning( "PolygonTools: Can't load icons for Texel Tab! Check icon files in pt_modules/icons directory.") #Top Label self.lblInfo_01 = QLabel() self.lblInfo_01.setWordWrap(True) self.lblInfo_01.setMargin(2) #groupbox Prepare self.gboxGetTexel = QGroupBox("Get Texel Density") self.gboxGetTexel.setMaximumWidth(340) self.gboxGetTexel_v_layout = QVBoxLayout() #groupbox Prepare self.gboxSetTexel = QGroupBox("Set Texel Density") self.gboxSetTexel.setMaximumWidth(340) self.gboxSetTexel_v_layout = QVBoxLayout() self.chkUseInUVI = QCheckBox() self.chkUseInUVI.setText("Use texel value when checking texel density") self.chkUseInUVI.setChecked(True) #Map Res label self.lblMapRes = QLabel("Map size (px)") #System Units cmbox self.cboxTexRes = QComboBox() self.cboxTexRes.addItems(["64", "128", "256x128", "256", "512x256", "512", "1024x512", "1024", "2048x1024", "2048", "4096x2048", "4096", "8192"]) self.btnCalcTex = QPushButton("Get Texel") self.btnCalcTex.setStyleSheet("background-color:#3d664f;") self.btnCalcTex.setMinimumWidth(90) self.btnCalcTex.setMinimumHeight(30) self.btnCalcTex.setIcon(iconGetTex) #set tex button self.btnSetTex = QPushButton("Set Texel") self.btnSetTex.setStyleSheet("background-color:#3d6666;") self.btnSetTex.setMaximumWidth(90) self.btnSetTex.setMinimumHeight(30) self.btnSetTex.setIcon(iconSetTex) self.edtSetTex = QLineEdit() self.edtSetTex.setFixedWidth(50) self.edtSetTex.setMaxLength(4) self.edtSetTex.setText("400") self.lblSetTexel = QLabel("Desired texel (px/m) ") self.lblSetTexel.setMaximumWidth(115) self.lblMapSize = QLabel("Map size: ") #end set block self.lblTexel = QLabel("Texel: ") self.lblTexel.setMaximumWidth(340) self.lblTexel.setStyleSheet('background-color: black; padding: 5px;') #groupbox Prepare self.gboxCheckTexel = QGroupBox("Check Texel Density") self.gboxCheckTexel.setMaximumWidth(340) self.gboxCheckTexel_v_layout = QVBoxLayout() self.lblInRangeInfo = QLabel("Texel has not been checked yet.") self.lblInRangeInfo.setWordWrap(True) #Progress Bar self.pbChekProgress = QProgressBar() self.pbChekProgress.setValue(0) self.pbChekProgress.setMaximumWidth(340) self.lblTexel02 = QLabel("Texel") self.lblTexel02.setMaximumWidth(25) self.edtCurTexel = QLineEdit() self.edtCurTexel.setFixedWidth(50) self.edtCurTexel.setMaxLength(4) self.edtCurTexel.setText("256") self.btnCheckTexel = QPushButton("Check Texel") self.btnCheckTexel.setStyleSheet("background-color:#663d5b;") self.btnCheckTexel.setMinimumWidth(100) self.btnCheckTexel.setMaximumWidth(100) self.btnCheckTexel.setMinimumHeight(30) self.btnCheckTexel.setIcon(iconCheckTex) self.lblDiff = QLabel("Range +/- (%)") self.lblDiff.setFixedWidth(75) #Diff spinbox self.spnDiff = QSpinBox() self.spnDiff.setMinimum(1) self.spnDiff.setMaximum(30) self.spnDiff.setValue(10) #Texel label self.lblAddCheckHeader = QLabel("Additional Checks") self.lblTinyIt = QLabel("Tiny Polygons (m" + u'\N{SUPERSCRIPT TWO}'+")") self.lblTinyIt.setFixedWidth(95) self.edtTinyIt = QLineEdit() self.edtTinyIt.setFixedWidth(50) self.edtTinyIt.setMaxLength(7) self.edtTinyIt.setText("0.0001") self.lblPolyTinyAr = QLabel("Count: ") #self.lblPolyTinyAr.setMaximumWidth(120) self.lblPolyTinyAr.setVisible(False) self.btnSelectTinyFace = QPushButton("Not checked yet") self.btnSelectTinyFace.setMaximumWidth(160) self.lblTinyPX = QLabel("Tiny UV Shells (px)") self.lblTinyPX.setFixedWidth(95) self.edtTinyPX = QLineEdit() self.edtTinyPX.setFixedWidth(50) self.edtTinyPX.setMaxLength(1) self.edtTinyPX.setInputMask("D") self.edtTinyPX.setText("1") self.lblUVTinyAr = QLabel("Count: ") #self.lblUVTinyAr.setMaximumWidth(120) self.lblUVTinyAr.setVisible(False) self.btnSelectTinyUVShell = QPushButton("Not checked yet") self.btnSelectTinyUVShell.setMaximumWidth(160) self.btnCleanCheck = QPushButton("Clean Check") self.btnCleanCheck.setStyleSheet("background-color:#665c63;") self.btnCleanCheck.setMaximumWidth(100) self.btnCleanCheck.setMinimumWidth(100) self.btnCleanCheck.setMinimumHeight(30) self.btnCleanCheck.setIcon(iconCleanCheck) self.gboxTexConclusion = QGroupBox("Conclusion") self.gboxTexConclusion.setMaximumWidth(340) self.gboxTexConclusion.setMinimumHeight(170) self.gboxTexConclusion_v_layout = QVBoxLayout() #conclusion text here self.txtbrowTexConclusion = QTextBrowser() self.txtbrowTexConclusion.setHtml("") self.gboxTexConclusion_v_layout.addWidget(self.txtbrowTexConclusion) #Add to layout self.tabTex_v_layout.addWidget(self.lblInfo_01) #add texel group box self.tabTex_h_layout = QHBoxLayout() self.tabTex_h_layout.setAlignment(Qt.AlignLeft) self.tabTex_h_layout.setContentsMargins(0,0,0,0) self.tabTex_h_layout.setSpacing(10) self.tabTex_h_layout.addWidget(self.lblMapRes) self.tabTex_h_layout.addWidget(self.cboxTexRes) self.tabTex_h_layout.addWidget(self.btnCalcTex) self.gboxGetTexel_v_layout.addLayout(self.tabTex_h_layout) self.gboxGetTexel_v_layout.addWidget(self.lblTexel) self.gboxGetTexel_v_layout.addWidget(self.chkUseInUVI) #add texel group box self.tabTex_v_layout.addWidget(self.gboxGetTexel) self.gboxGetTexel.setLayout(self.gboxGetTexel_v_layout) self.gboxSetTexel_v_layout.addWidget(self.lblMapSize) self.tabTex_h_Setlayout = QHBoxLayout() self.tabTex_h_Setlayout.setAlignment(Qt.AlignLeft) self.tabTex_h_Setlayout.setContentsMargins(0,0,0,0) self.tabTex_h_Setlayout.setSpacing(10) self.gboxSetTexel_v_layout.addLayout(self.tabTex_h_Setlayout) self.tabTex_h_Setlayout.addWidget(self.lblSetTexel) self.tabTex_h_Setlayout.addWidget(self.edtSetTex) self.tabTex_h_Setlayout.addWidget(self.btnSetTex) #add SET texel group box self.tabTex_v_layout.addWidget(self.gboxSetTexel) self.gboxSetTexel.setLayout(self.gboxSetTexel_v_layout) self.gboxCheckTexel_v_layout.addWidget(self.lblInRangeInfo) self.gboxCheckTexel_v_layout.addWidget(self.pbChekProgress) #add layout for CurTexel self.tabTex_h_layout_02 = QHBoxLayout() self.tabTex_h_layout_02.setAlignment(Qt.AlignLeft) self.tabTex_h_layout_02.setSpacing(10) self.gboxCheckTexel_v_layout.addLayout(self.tabTex_h_layout_02) self.tabTex_h_layout_02.addWidget(self.lblTexel02) self.tabTex_h_layout_02.addWidget(self.edtCurTexel) #add layout for lblDiff self.tabTex_h_layout_03 = QHBoxLayout() self.tabTex_h_layout_03.setAlignment(Qt.AlignLeft) self.tabTex_h_layout_03.setSpacing(10) self.gboxCheckTexel_v_layout.addLayout(self.tabTex_h_layout_03) self.tabTex_h_layout_03.addWidget(self.lblDiff) self.tabTex_h_layout_03.addWidget(self.spnDiff) #add layout for CurTexel self.tabTex_h_layout_05 = QHBoxLayout() self.tabTex_h_layout_05.setAlignment(Qt.AlignLeft) self.tabTex_h_layout_05.setSpacing(10) self.tabTex_h_layout_05.setContentsMargins(0,0,0,10) self.gboxCheckTexel_v_layout.addLayout(self.tabTex_h_layout_05) self.tabTex_h_layout_05.addWidget(self.btnCheckTexel) self.tabTex_h_layout_05.addWidget(self.btnCleanCheck) self.tex_h_line_02 = QFrame() self.tex_h_line_02.setFrameShape(QFrame.HLine) self.tex_h_line_02.setFrameShadow(QFrame.Sunken) self.gboxCheckTexel_v_layout.addWidget(self.tex_h_line_02) self.gboxCheckTexel_v_layout.addWidget(self.lblAddCheckHeader) #add layout for TinyIt self.tabTex_h_layout_04 = QHBoxLayout() self.tabTex_h_layout_04.setAlignment(Qt.AlignLeft) self.tabTex_h_layout_04.setSpacing(10) self.gboxCheckTexel_v_layout.addLayout(self.tabTex_h_layout_04) self.tabTex_h_layout_04.addWidget(self.lblTinyIt) self.tabTex_h_layout_04.addWidget(self.edtTinyIt) self.tabTex_h_layout_04.addWidget(self.lblPolyTinyAr) self.tabTex_h_layout_04.addWidget(self.btnSelectTinyFace) #add layout for TinyPX self.tabTex_h_layout_05 = QHBoxLayout() self.tabTex_h_layout_05.setAlignment(Qt.AlignLeft) self.tabTex_h_layout_05.setSpacing(10) self.gboxCheckTexel_v_layout.addLayout(self.tabTex_h_layout_05) self.tabTex_h_layout_05.addWidget(self.lblTinyPX) self.tabTex_h_layout_05.addWidget(self.edtTinyPX) self.tabTex_h_layout_05.addWidget(self.lblUVTinyAr) self.tabTex_h_layout_05.addWidget(self.btnSelectTinyUVShell) #H-Line 4 self.tex_h_line_04 = QFrame() self.tex_h_line_04.setFrameShape(QFrame.HLine) self.tex_h_line_04.setFrameShadow(QFrame.Sunken) self.gboxCheckTexel_v_layout.addWidget(self.tex_h_line_04) #group Check self.tabTex_v_layout.addWidget(self.gboxCheckTexel) self.gboxCheckTexel.setLayout(self.gboxCheckTexel_v_layout) #conclusion self.gboxTexConclusion.setLayout(self.gboxTexConclusion_v_layout) #conclusion area self.tabTex_v_layout.addWidget(self.gboxTexConclusion) #SIGNALS #Calculate Texel self.btnCalcTex.clicked.connect(self.btnCalcTexClicked) #SetTexel self.btnSetTex.clicked.connect(self.btnSetTexelClicked) #changes in texel self.edtCurTexel.editingFinished.connect(self.checkTexelValue) #changes in Tiny It self.edtTinyIt.textChanged.connect(self.tinyChanged) self.edtTinyIt.editingFinished.connect(self.tinyFinEdit) #changes in TinyPX self.edtTinyPX.editingFinished.connect(self.tinyPXFinEdit) self.btnCheckTexel.clicked.connect(self.btnCheckTexelClicked) self.btnCleanCheck.clicked.connect(self.btnCleanCheckClicked) self.spnDiff.editingFinished.connect(self.diffFinEdit) self.cboxTexRes.activated.connect(self.textureResChange) self.btnSelectTinyFace.clicked.connect(self.btnSelectTinyFacesClicked) self.btnSelectTinyUVShell.clicked.connect(self.btnSelectTinyUVShellsClicked) self.edtSetTex.editingFinished.connect(self.checkDesiredTexel) self.checkTexelValues() #arrays for mistakes self.tiny_uv_arr=[] self.tiny_geo_arr=[] self.btnSelectTinyFace.setDisabled(True) self.btnSelectTinyUVShell.setDisabled(True) self.checkSquareMap() self.lblInfo_01.setText("Texel operations not yet performed!") #lang selector current_languge = cfgl.configLoader()[14] self.txtbrowTexConclusion.setHtml( conclusion.texTabIntroConclusion(current_languge) )
def diffFinEdit(self): #Write to config path_config = cfgl.configLoader()[99:101] current_diff_value = str(self.spnDiff.value()) cfgl.ConfigWriter('In-Range', 'Difference', current_diff_value, path_config[0], path_config[1])
def btnViewUVPressed(self): current_languge = cfgl.configLoader()[14] SelectionData = gen_func.checkSelection() SelectedShapes = SelectionData[0] #delete colorsets for i in range(len(SelectedShapes)): CurrentColorSet = cmds.polyColorSet(SelectedShapes[i], q=True, currentColorSet=True) if CurrentColorSet != None: cmds.polyColorSet (SelectedShapes[i], delete=True ) #create and delete file if len(SelectedShapes) > 0: #if pressed if self.btnViewUV.isChecked() == True: #delete shader if cmds.objExists('pt_uv_shader'): DelUVShaders() self.btnViewUV.setText("Show UV") #assign prev mat for i in range(len(self.PreviousShadersArray)): try: cmds.sets(self.ObjectsWithShadersArray[i], e=True, forceElement = self.PreviousShadersArray[i]) except: pass self.showInfo("info", "UV Snapshot was removed.") else: try: #get previous shader CurrentShaderData = getCurrentShader(SelectedShapes) self.PreviousShadersArray = CurrentShaderData[0] self.ObjectsWithShadersArray = CurrentShaderData[1] #remove old uv if exist if cmds.objExists('pt_uv_shader') == True: DelUVShaders() self.btnViewUV.setText("Show UV") #create and showe shader createUVTexture(SelectedShapes) cmds.sets(SelectedShapes, e=True, forceElement='pt_shading_group_uv') cmds.select(SelectedShapes) self.btnViewUV.setText("Hide UV") conclusion_text = conclusion.uvOperationConclusion (current_languge, "assign_uv") self.txtbrowUVConclusion.setHtml(conclusion_text) self.showInfo("info", "UV Snapshot was assigned to objects.") except: self.showInfo ("warn", "Can't create UV Snapshot.") else: conclusion_text = conclusion.noSelection(current_languge, "show_uv") self.txtbrowUVConclusion.setHtml(conclusion_text) #If nothing selected self.btnViewUV.setChecked(True) #delete shader if not selected if cmds.objExists('pt_uv_shader'): DelUVShaders() self.btnViewUV.setText("Show UV") self.showInfo ("info", "UV Snapshot was removed.") else: self.showInfo ("warn", "Please select something. Mesh object for example...")
def tinyPXFinEdit(self): #Write to config path_config = cfgl.configLoader()[99:101] current_tiny_value = self.edtTinyPX.text() cfgl.ConfigWriter('In-Range', 'Tiny UV', current_tiny_value, path_config[0], path_config[1])
def btnCalcTexClicked(self): selectedTextureIndex = int(self.cboxTexRes.currentIndex()) selectedTextureArea = resolutionSelected(selectedTextureIndex) #randomPoly, uv_area[0], geo_area, cur_work_units, gp_ratio, texel, matrix texelData = CalculateTexel(selectedTextureArea) #get current language current_languge = cfgl.configLoader()[14] if texelData != False: print "-----------------------------------------" print " PolygonTools TEXEL STATISTICS" print "-----------------------------------------" if texelData[1] == 0: print ("UV-Face Area: No UV-layout on selected face. Its problem!") else: print ("UV-Face Area: "+ str(texelData[1])) print ("Geo-Face Area: " + str(texelData[2]) +" "+ texelData[3] + u'\N{SUPERSCRIPT TWO}') print ("Texture size: " + self.cboxTexRes.currentText() +" px") print ("Texture area: " + str(selectedTextureArea) +" px") if (self.chkUseInUVI.isChecked()==True) and texelData[5] > 0.0: self.edtCurTexel.setText(str(int(texelData[5]))) else: self.edtCurTexel.setText("1") if texelData[6] == 3: self.lblTexel.setText("Texel: " + str(int(texelData[5])) + " px/" + texelData[3]) self.lblTexel.setStyleSheet('background-color: black; padding: 5px;') else: self.lblTexel.setText("Texel: " + str(int(texelData[5])) + " px/" + texelData[3] + " | Object with Scale transformation!") self.lblTexel.setStyleSheet('background-color: #9e0b0f; padding: 5px;') print "ATTENTION! Object with Scale transformation!" print "" if texelData[0] == False: self.showInfo ("info", "Texel successfully calculated for selected polygon.") #set conclusion text conclusion_text = conclusion.calcTexelConclusion(current_languge, int(texelData[5]), True) else: self.showInfo ("warn", "Texel successfully calculated for random polygon.") #set conclusion text conclusion_text = conclusion.calcTexelConclusion(current_languge, int(texelData[5]), False) #conclusion output self.txtbrowTexConclusion.setHtml(conclusion_text) print "-----------------------------------------" else: self.showInfo ("warn", "Can't Get Texel. Please select one Face.") self.lblTexel.setText("Texel:") self.lblTexel.setStyleSheet('background-color: black; padding: 5px;') conclusion_text = conclusion.noSelection(current_languge, "check_texel") self.txtbrowTexConclusion.setHtml(conclusion_text)
def btnCheckTexelClicked(self): GreenBox = ("<font color='#80ff80'>" + u'\N{BLACK SQUARE}' + "</font> In-Range: ") BlueBox = (u'\N{BOX DRAWINGS LIGHT VERTICAL}' + " <font color='#80c0ff'>" + u'\N{BLACK SQUARE}' + "</font> Streched: ") RedBox = (u'\N{BOX DRAWINGS LIGHT VERTICAL}' + "<font color='#ffc0c0'>" + u'\N{BLACK SQUARE}' + "</font> Compressed: ") self.lblInfo_01.setText("") self.checkTexelValue() self.btnSelectTinyUVShell.setDisabled(True) self.btnSelectTinyUVShell.setText("Not checked yet") self.btnSelectTinyFace.setDisabled(True) self.btnSelectTinyFace.setText("Not checked yet") SelectionData = gen_func.checkSelection() #shapes array selectedShapes = SelectionData[0] current_languge = cfgl.configLoader()[14] if len(selectedShapes) > 0: try: all_sel_obj = cmds.ls ( selection=True, objectsOnly=True, long=1, shortNames=1 ) #total polygons totalpoly = cmds.polyEvaluate( face=True ) #set range from 0 to max polycount self.pbChekProgress.setRange ( 0, 100 ) self.pbChekProgress.setValue(0) #turn on vertex color for i in range(len(selectedShapes)): cmds.polyColorPerVertex (selectedShapes[i], colorDisplayOption=1 ) #get selected texture selected_texture_index = int(self.cboxTexRes.currentIndex()) print "-----------------------------------------" print " PolygonTools. Check Texle Density" print "-----------------------------------------" current_time = time.strftime("%H:%M:%S ", time.localtime()) print "Check Start at", current_time print "" #texture area selected_texture_area = resolutionSelected(selected_texture_index) #print "Selected Texture Area:", selected_texture_area #get curent texel current_texel = float(self.edtCurTexel.text()) #get curent diff DifferenceMargin = float(self.spnDiff.value()) #get current tiny tiny_polygon_area = float(self.edtTinyIt.text()) CurrentTinyUVValue = int(self.edtTinyPX.text()) print "Current Tiny UV:", CurrentTinyUVValue SelectedResolution = self.cboxTexRes.currentText() #main func CheckTexelData = CheckTexel (selectedShapes, selected_texture_index, current_texel, DifferenceMargin, tiny_polygon_area, SelectedResolution, CurrentTinyUVValue, True) #global_inrange_arr, global_streched_arr, global_compressed_arr, global_tiny_uv_arr, global_tiny_geo_arr correct=[] streched=[] compressed=[] self.tiny_uv_arr = [] self.tiny_geo_arr = [] for k in range(len(selectedShapes)): for i in range(len(CheckTexelData)): if i == 0: correct.append(len(CheckTexelData[i][k])) if i == 1: streched.append(len(CheckTexelData[i][k])) if i == 2: compressed.append(len(CheckTexelData[i][k])) if i == 3: if CheckTexelData[i][k] != []: self.tiny_uv_arr.append(CheckTexelData[i][k]) if i == 4: if CheckTexelData[i][k] != []: self.tiny_geo_arr.append(CheckTexelData[i][k]) self.pbChekProgress.setValue(100) TinyFace = False TinyUV = False if self.tiny_uv_arr != [] and len(selectedShapes) == 1: self.btnSelectTinyUVShell.setDisabled(False) self.btnSelectTinyUVShell.setText("Select " + str(len(self.tiny_uv_arr[0])) + " tiny UV Shell(s)") TinyUV = True elif self.tiny_uv_arr != []: self.btnSelectTinyUVShell.setText("Tiny UV Shells on " + str(len(self.tiny_uv_arr)) + " objects") TinyUV = True if self.tiny_geo_arr != [] and len(selectedShapes) == 1: self.btnSelectTinyFace.setDisabled(False) self.btnSelectTinyFace.setText("Select " + str(len(self.tiny_geo_arr[0])) + " tiny face(s)") TinyFace = True elif self.tiny_geo_arr != []: self.btnSelectTinyFace.setText("Tiny faces on " + str(len(self.tiny_geo_arr)) + " objects") TinyFace = True print "" LongText = ("Check texel density complete! See log for details." +"\n" + "Number of checked objects: " + str(len(selectedShapes))) self.showInfo("info", LongText) print "" self.lblInRangeInfo.setText(GreenBox + str(sum(correct)) + RedBox + str(sum(streched)) + BlueBox + str(sum(compressed))) print ("Correct: " + str(sum(correct)) + " | Streched: " + str(sum(streched)) + " | Compressed: " + str(sum(compressed))) print "" print "Objects with Tiny geometry area:", len(self.tiny_geo_arr) print "Objects with Tiny UV Shells:", len(self.tiny_uv_arr) print "" current_time = time.strftime("%H:%M:%S ", time.localtime()) print "Check complete at", current_time print "-----------------------------------------" conclusion_text = conclusion.checkTexelConclusion(current_languge, DifferenceMargin, correct, streched, compressed, TinyUV, TinyFace) self.txtbrowTexConclusion.setHtml(conclusion_text) cmds.select( selectedShapes ) except: self.showInfo("warn", "Error. Can't Check Texel. Please select mesh object in Object Mode.") self.pbChekProgress.setValue(0) conclusion_text = conclusion.noSelection(current_languge, "set_texel") self.txtbrowTexConclusion.setHtml(conclusion_text) else: self.showInfo("warn", "Can't Check Texel. Please select mesh object in Object Mode.") conclusion_text = conclusion.noSelection(current_languge, "check_texel") self.txtbrowTexConclusion.setHtml(conclusion_text)
def __init__(self, parent=None): QWidget.__init__(self, parent=parent) #Create Widgets self.tabUv_v_layout = QVBoxLayout(self) self.tabUv_v_layout.setAlignment(Qt.AlignTop) self.tabUv_v_layout.setContentsMargins(0,10,0,10) self.tabUv_v_layout.setSpacing(5) currentDir = os.path.dirname(__file__) try: iconScaleUV2 = QPixmap(currentDir +"/icons/scale_uv2_icon.png") iconScaleUV05 = QPixmap(currentDir +"/icons/scale_uv05_icon.png") iconMoveVUp = QPixmap(currentDir +"/icons/move_v_up_icon.png") iconMoveVDown = QPixmap(currentDir +"/icons/move_v_down_icon.png") iconMoveURight = QPixmap(currentDir +"/icons/move_u_right_icon.png") iconMoveULeft = QPixmap(currentDir +"/icons/move_u_left_icon.png") iconShowUV = QPixmap(currentDir +"/icons/show_uv_icon.png") iconRemoveChecker = QPixmap(currentDir +"/icons/remove_checker_icon.png") except: cmds.warning( "PolygonTools: Can't load icons for UV Tab! Check icon files in pt_modules/icons directory.") #label for info self.lblInfo_01 = QLabel("Select an object and click on the necessary checker or utility.") self.lblInfo_01.setMargin(2) #group for Checkers self.gboxCheckers = QGroupBox("Checker Textures") self.gboxCheckers.setMaximumWidth(340) self.gboxCheckers_v_layout = QVBoxLayout() #Red checker self.btnCheStd = QPushButton() self.btnCheStd.setMaximumWidth(68) self.btnCheStd.setMaximumHeight(68) #Digit checker self.btnCheDig = QPushButton() self.btnCheDig.setMaximumWidth(68) self.btnCheDig.setMaximumHeight(68) #Diagonal checker self.btnCheDiag = QPushButton() self.btnCheDiag.setMaximumWidth(68) self.btnCheDiag.setMaximumHeight(68) #Gradient checker self.btnCheGrad = QPushButton() self.btnCheGrad.setMaximumWidth(68) self.btnCheGrad.setMaximumHeight(68) currentDir = os.path.dirname(__file__) #Red checker icon self.iconCheRed = QIcon() checker_standard_path = currentDir +"/icons/checker_standard_icon.png" checkCheckerTextureFile(checker_standard_path) self.iconCheRed.addPixmap(QPixmap(checker_standard_path), QIcon.Normal, QIcon.Off) self.btnCheStd.setIcon(self.iconCheRed) self.btnCheStd.setIconSize(QSize(64, 64)) #Digit checker icon self.iconCheDig = QIcon() checker_digital_path = currentDir +"/icons/checker_digital_icon.png" checkCheckerTextureFile(checker_digital_path) self.iconCheDig.addPixmap(QPixmap(checker_digital_path), QIcon.Normal, QIcon.Off) self.btnCheDig.setIcon(self.iconCheDig) self.btnCheDig.setIconSize(QSize(64, 64)) #Diagoanl checker icon self.iconCheDiag = QIcon() checker_diagonal_path = currentDir +"/icons/checker_diagonal_icon.png" checkCheckerTextureFile(checker_diagonal_path) self.iconCheDiag.addPixmap(QPixmap(checker_diagonal_path), QIcon.Normal, QIcon.Off) self.btnCheDiag.setIcon(self.iconCheDiag) self.btnCheDiag.setIconSize(QSize(64, 64)) #Gradient checker icon self.iconCheGrad = QIcon() checker_gradient_path = currentDir +"/icons/checker_gradient_icon.png" checkCheckerTextureFile(checker_gradient_path) self.iconCheGrad.addPixmap(QPixmap(checker_gradient_path), QIcon.Normal, QIcon.Off) self.btnCheGrad.setIcon(self.iconCheGrad) self.btnCheGrad.setIconSize(QSize(64, 64)) self.gboxCheckRes = QGroupBox("Checker Texture Size Emulation (px)") self.gboxCheckRes.setMaximumWidth(340) self.gboxCheckRes.setMaximumHeight(50) self.gboxCheckRes.setEnabled(False) self.gboxCheckRes_h_layout = QHBoxLayout() self.rbtn256 = QRadioButton() self.rbtn256.setText("256") self.rbtn512 = QRadioButton() self.rbtn512.setText("512") self.rbtn1024 = QRadioButton() self.rbtn1024.setText("1K") self.rbtn2048 = QRadioButton() self.rbtn2048.setText("2K") self.rbtn4096 = QRadioButton() self.rbtn4096.setText("4K") self.rbtn8192 = QRadioButton() self.rbtn8192.setText("8K") #UV Utils self.gboxUVUtils = QGroupBox("UV Utilities") self.gboxUVUtils.setMaximumWidth(340) self.gboxUVUtils.setMaximumHeight(350) self.gboxUVUtils.setEnabled(True) self.gboxUVUtil_h_layout = QHBoxLayout() self.gboxUVUtil_v_layout1 = QVBoxLayout() self.gboxUVUtil_v_layout1.setAlignment(Qt.AlignTop) self.gboxUVUtil_v_layout2 = QVBoxLayout() self.gboxUVUtil_v_layout2.setAlignment(Qt.AlignTop) self.gboxUVUtil_v_layout3 = QVBoxLayout() self.gboxUVUtil_v_layout3.setAlignment(Qt.AlignTop) self.btnScale2 = QPushButton("x2") self.btnScale2.setIcon(iconScaleUV2) self.btnScale05 = QPushButton("x0.5") self.btnScale05.setIcon(iconScaleUV05) self.btnMoveUVLeft = QPushButton("-1U") self.btnMoveUVLeft.setIcon(iconMoveULeft) self.btnMoveUVRight = QPushButton("+1U") self.btnMoveUVRight.setIcon(iconMoveURight) self.btnMoveUVUp = QPushButton("+1V") self.btnMoveUVUp.setIcon(iconMoveVUp) self.btnMoveUVDown = QPushButton("-1V") self.btnMoveUVDown.setIcon(iconMoveVDown) self.btnViewUV = QToolButton() self.btnViewUV.setText("Show UV") self.btnViewUV.setIcon(iconShowUV) self.btnViewUV.setMaximumWidth(125) self.btnViewUV.setCheckable(True) self.lblUvScale = QLabel("Scale UV") self.lblMoveUV = QLabel("Move UV") self.lblShowUV = QLabel("Additional") #layouting self.gboxCheckRes_h_layout.addWidget(self.rbtn256) self.gboxCheckRes_h_layout.addWidget(self.rbtn512) self.gboxCheckRes_h_layout.addWidget(self.rbtn1024) self.gboxCheckRes_h_layout.addWidget(self.rbtn2048) self.gboxCheckRes_h_layout.addWidget(self.rbtn4096) self.gboxCheckRes_h_layout.addWidget(self.rbtn8192) self.gboxUVUtil_v_layout1.addWidget(self.lblUvScale) self.gboxUVUtil_v_layout1.addWidget(self.btnScale2) self.gboxUVUtil_v_layout1.addWidget(self.btnScale05) self.gboxUVUtil_v_layout2.addWidget(self.lblMoveUV) self.gboxUVUtil_v_layout2.addWidget(self.btnMoveUVLeft) self.gboxUVUtil_v_layout2.addWidget(self.btnMoveUVRight) self.gboxUVUtil_v_layout2.addWidget(self.btnMoveUVUp) self.gboxUVUtil_v_layout2.addWidget(self.btnMoveUVDown) self.gboxUVUtil_v_layout3.addWidget(self.lblShowUV) self.gboxUVUtil_v_layout3.addWidget(self.btnViewUV) self.gboxUVUtil_h_layout.addLayout(self.gboxUVUtil_v_layout1) self.gboxUVUtil_h_layout.addLayout(self.gboxUVUtil_v_layout2) self.gboxUVUtil_h_layout.addLayout(self.gboxUVUtil_v_layout3) self.gboxCheckRes.setLayout(self.gboxCheckRes_h_layout) self.gboxUVUtils.setLayout(self.gboxUVUtil_h_layout) self.btnRemCheck = QPushButton("Remove Checker") self.btnRemCheck.setMaximumWidth(146) self.btnRemCheck.setIcon(iconRemoveChecker) self.btnRemCheck.setEnabled(False) self.gboxUVConclusion = QGroupBox("Conclusion") self.gboxUVConclusion.setMaximumWidth(340) self.gboxUVConclusion.setMinimumHeight(170) self.gboxUVConclusion_v_layout = QVBoxLayout() #conclusion text here self.txtbrowUVConclusion = QTextBrowser() self.txtbrowUVConclusion.setHtml("") #Add Widgets self.gboxUVConclusion_v_layout.addWidget(self.txtbrowUVConclusion) self.tabUv_v_layout.addWidget(self.lblInfo_01) #add gbox self.tabUv_v_layout.addWidget(self.gboxCheckers) self.gboxCheckers.setLayout(self.gboxCheckers_v_layout) self.tabUv_h_layout_01 = QHBoxLayout() self.tabUv_h_layout_01.setAlignment(Qt.AlignLeft) self.gboxCheckers_v_layout.addLayout(self.tabUv_h_layout_01) #add buttons self.tabUv_h_layout_01.addWidget(self.btnCheStd) self.tabUv_h_layout_01.addWidget(self.btnCheDig) self.tabUv_h_layout_01.addWidget(self.btnCheDiag) self.tabUv_h_layout_01.addWidget(self.btnCheGrad) #remove checker button self.gboxCheckers_v_layout.addWidget(self.btnRemCheck) self.tabUv_v_layout.addWidget(self.gboxCheckRes) self.tabUv_v_layout.addWidget(self.gboxUVUtils) #conclusion self.gboxUVConclusion.setLayout(self.gboxUVConclusion_v_layout) #conclusion area self.tabUv_v_layout.addWidget(self.gboxUVConclusion) #SIGNALS self.btnRemCheck.clicked.connect(self.btnRemCheckClicked) #checker buttons click self.btnCheStd.clicked.connect(self.btnCheStdClicked) self.btnCheDig.clicked.connect(self.btnCheDigClicked) self.btnCheDiag.clicked.connect(self.btnCheDiagClicked) self.btnCheGrad.clicked.connect(self.btnCheGradClicked) self.rbtn256.toggled.connect(self.setTile256Toggled) self.rbtn512.toggled.connect(self.setTile512Toggled) self.rbtn1024.toggled.connect(self.setTile1024Toggled) self.rbtn2048.toggled.connect(self.setTile2048Toggled) self.rbtn4096.toggled.connect(self.setTile4096Toggled) self.rbtn8192.toggled.connect(self.setTile8192Toggled) self.btnScale2.clicked.connect(self.btnScale2Clicked) self.btnScale05.clicked.connect(self.btnScale05Clicked) self.btnMoveUVLeft.clicked.connect(self.btnMoveUVLeftClicked) self.btnMoveUVRight.clicked.connect(self.btnMoveUVRightClicked) self.btnMoveUVUp.clicked.connect(self.btnMoveUVUpClicked) self.btnMoveUVDown.clicked.connect(self.btnMoveUVDownClicked) self.btnViewUV.pressed.connect(self.btnViewUVPressed) self.PreviousShadersArray = [] self.ObjectsWithShadersArray = [] #intro text current_languge = cfgl.configLoader()[14] self.txtbrowUVConclusion.setHtml( conclusion.uvTabIntroConclusion(current_languge) ) Created2DNodes = self.introShaderCheck() #if any 2d texture is present if len(Created2DNodes) > 0: #get tile from first Repeat = cmds.getAttr('pt_2dTexture_' + Created2DNodes[0] + '.repeatU') self.toggleTile(int(Repeat)) else: self.rbtn256.setChecked(True) if cmds.objExists('pt_uv_shader') == True and cmds.objExists('pt_shading_group_uv') == True and cmds.objExists('pt_uv_texture') == True and cmds.objExists('pt_2dTUV') == True: self.btnViewUV.setText("Hide UV") self.btnViewUV.setChecked(True) print ("UV Shader integrity ok!") else: print("PolygonTools. UV Shader not yet created or its integrity broken!")