Exemple #1
0
 def validte_model_publish(self, file, item):
     studio_shader = studioShader.Shader()
     valid = studio_shader.had_valid(file)
     if valid:
         return
     item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsDragEnabled
                   | QtCore.Qt.ItemIsUserCheckable)
Exemple #2
0
 def rename_model(self, lineedit):
     studio_shader = studioShader.Shader()
     if not self.currnet_publish:
         OpenMaya.MGlobal.displayWarning(
             'Not selected any shader or shader not valid.')
         return
     current_image = studio_shader.get_image(self.currnet_publish)
     new_name = '%s' % lineedit.text()
     model_format = os.path.splitext(self.currnet_publish)[-1]
     self.folder.rename(folder_path=self.currnet_publish,
                        name='%s%s' % (new_name, model_format))
     image_format = os.path.splitext(current_image)[-1]
     self.folder.rename(folder_path=current_image,
                        name='%s%s' % (new_name, image_format))
     self.load_current_folder(self.treewidget)
Exemple #3
0
 def builds(self, tag, listwidge, *args):
     current_items = listwidge.selectedItems()
     if not current_items:
         QtGui.QMessageBox.warning(
             self,
             'Warning',
             'Not selected any shader or shader not valid!...',
             QtGui.QMessageBox.Ok)
         OpenMaya.MGlobal.displayWarning(
             'Not select any shader or shader not valid.')
         return
     self.button_publish.hide()
     self.button_build.show()
     self.checkbox_build.show()
     self.checkbox_assign.show()
     publish_path = current_items[-1].toolTip()
     self.currnet_publish = publish_path
     studio_shader = studioShader.Shader(
         path=publish_path, geometry_dag_path=None)
     data = studio_shader.create(False, False, fake=True)
     comment = [
         data['comment'],
         'author : %s' % data['author'],
         data['tag'],
         data['#copyright'],
         'user : %s' % data['user'],
         data['created_date']
     ]
     self.textedit_history.setText('\n'.join(comment))
     self.textedit_history.setReadOnly(True)
     self.lineEdit_label.setText(os.path.basename(
         os.path.splitext(publish_path)[0]))
     self.model.image_to_button(path=studio_shader.get_image(publish_path))
     if tag == 'build':
         result = studio_shader.create(
             self.checkbox_build.isChecked(),
             self.checkbox_assign.isChecked(),
         )
         if False in result:
             OpenMaya.MGlobal.displayWarning(
                 'Build Failed!... %s' % result[False])
         else:
             OpenMaya.MGlobal.displayInfo('Build Success!...')
Exemple #4
0
 def publish(self):
     current_items = self.treewidget.selectedItems()
     if not current_items:
         QtGui.QMessageBox.warning(
             self,
             'Warning',
             'Not found any folder selection.\nSelect the folder and try!...',
             QtGui.QMessageBox.Ok)
         OpenMaya.MGlobal.displayWarning('Not found any folder selection.')
         return
     current_path = str(current_items[-1].toolTip(0))
     if not os.path.isdir(current_path):
         QtGui.QMessageBox.warning(
             self,
             'Warning',
             'Not found such Publish directory!...%s' % current_path,
             QtGui.QMessageBox.Ok)
         OpenMaya.MGlobal.displayWarning(
             'Not found such Publish directory!...%s' % current_path)
         return
     geometry_dag_paths = self.studio_maya.getSelectedObjectShapeNode(
         OpenMaya.MFn.kMesh)
     if not geometry_dag_paths.length():
         QtGui.QMessageBox.warning(
             self, 
             'Warning',
             'Not found any Polygon Geometry in your selection!...',
             QtGui.QMessageBox.Ok)
         OpenMaya.MGlobal.displayWarning(
             'Not found any Polygon Geometry in your selection!...')
         return
     label = self.model.lineEdit_label.text()
     if not label:
         QtGui.QMessageBox.warning(
             self,
             'Warning',
             'Not found the Name of the the Publish!...',
             QtGui.QMessageBox.Ok)
         OpenMaya.MGlobal.displayWarning(
             'Not found the Name of the the Publish!...')
         return        # add condition for mutlipe object
     studio_shader = studioShader.Shader(
         geometry_dag_path=geometry_dag_paths[0])
     if studio_shader.had_file(current_path, label):
         replay = QtGui.QMessageBox.warning(
             self,
             'Warning',
             'Already a file with the same name in the publish\n\"%s\"\nIf you want to overwrite press Yes' % label,
             QtGui.QMessageBox.Yes,
             QtGui.QMessageBox.No)
         OpenMaya.MGlobal.displayWarning(
             'Already a file with the same name in the publish')
         if replay != QtGui.QMessageBox.Yes:
             return
     user_comment = self.model.textedit_history.toPlainText()
     result = studio_shader.save(
         current_path, label, self.image_object, user_comment=user_comment)
     self.load_current_folder(self.treewidget)
     self.clear_publish()
     message = 'Publish success!...'
     if False in result:
         message = 'Publish Failed!...\n%s\n%s' % (
             result[False], '[more details and debugging [email protected]]')
         QtGui.QMessageBox.critical(
             self, 'Failed', message, QtGui.QMessageBox.Ok)
         OpenMaya.MGlobal.displayInfo(message)
         return
     QtGui.QMessageBox.information(
         self, 'Information', message, QtGui.QMessageBox.Ok)
     OpenMaya.MGlobal.displayInfo(message)