コード例 #1
0
 def take_thumbnail(self, button):
     output_path = None
     if self.standalone:
         current_file = swidgets.brows_file(
             'find the thumbnail(image) file', resource.getImageFormats())
         if not current_file:
             return
         output_path = os.path.join(
             tempfile.gettempdir(),
             'thumbnail_%s.png' % resource.getCurrentDateKey())
         output_path = swidgets.image_resize(current_file, output_path, 768,
                                             540)
     else:
         from studio_usd_pipe.api import studioMaya
         smaya = studioMaya.Maya()
         output_path, w, h = smaya.vieport_snapshot(
             output_path=None,
             width=768,
             height=540,
         )
     if not os.path.isfile(output_path):
         return
     qsize = button.minimumSize()
     swidgets.image_to_button(button,
                              qsize.width(),
                              qsize.height(),
                              path=output_path)
     self.button_thumbnail.setToolTip(output_path)
コード例 #2
0
 def read_current_maya(self):
     current_file = swidgets.brows_file('find the maya file',
                                        resource.getMayaFormats())
     if not current_file:
         return
     os.environ['BROWS_PATH'] = os.path.dirname(current_file)
     format = os.path.splitext(current_file)[-1]
     file_types = resource.getMayaFileTypes()
     format = file_types[format]
     self.source_maya = current_file
     return format
コード例 #3
0
 def load_image_file(self):
     current_file = swidgets.brows_file(
         'find the thumbnail(image) file', resource.getImageFormats())        
     if not current_file:
         return
     os.environ['BROWS_PATH'] = os.path.dirname(current_file)
     output_path = os.path.join(
         tempfile.gettempdir(),
         'thumbnail_%s.png' % resource.getCurrentDateKey())        
     output_path = swidgets.image_resize(current_file, output_path, 768, 540)
     size = self.button_thumbnail.minimumSize()
     swidgets.image_to_button(
         self.button_thumbnail, size.width(), size.height(), path=output_path)
     self.button_thumbnail.setToolTip(output_path)