def openSceneButtonFunction(*args):
    import os
    global sceneFileName
    global selectedFileName
    selectedFileName = cmds.fileDialog()
    cmds.launchImageEditor(vif=selectedFileName)
    sceneFileName = os.path.basename(selectedFileName)
    cmds.textField('sceneName', w=400, e=1, fi=sceneFileName)
示例#2
0
 def database_dump_sql(self):
     sql_file = os.path.join(os.path.dirname(__file__), 'debug_db.sql')
     with open(sql_file, 'w') as f:
         for line in self.db.iterdump():
             f.write('%s\n' % line)
     mtt_log('SQL Dump write into : %s' % sql_file, add_tag='DEBUG',
             verbose=False)
     cmds.launchImageEditor(viewImageFile=os.path.dirname(__file__))
def openSceneButtonFunction(*args):
	import os
	global sceneFileName
	global selectedFileName
	selectedFileName=cmds.fileDialog()
	cmds.launchImageEditor(vif=selectedFileName)
	sceneFileName=os.path.basename(selectedFileName)
	cmds.textField('sceneName', w=400, e=1, fi=sceneFileName)
示例#4
0
 def database_dump_sql(self):
     sql_file = os.path.join(os.path.dirname(__file__), 'debug_db.sql')
     with open(sql_file, 'w') as f:
         for line in self.db.iterdump():
             f.write('%s\n' % line)
     mtt_log('SQL Dump write into : %s' % sql_file,
             add_tag='DEBUG',
             verbose=False)
     cmds.launchImageEditor(viewImageFile=os.path.dirname(__file__))
示例#5
0
    def database_dump_csv(self):
        c = self.db.cursor()
        c.execute(
            'SELECT * FROM NodesTable as N '
            'LEFT JOIN FilesTable as F ON N.FileId=F.FileId '
            'LEFT JOIN RefTable as R ON N.RefName=R.RefName')

        import csv
        file_path = os.path.join(os.path.dirname(__file__), 'debug_db.csv')
        csv_file = open(file_path, "w")
        csv_file_writer = csv.writer(csv_file, delimiter=';')
        csv_file_writer.writerows(c.fetchall())
        csv_file.close()
        mtt_log('CSV Dump write into : %s' % file_path, add_tag='DEBUG',
                verbose=False)
        cmds.launchImageEditor(viewImageFile=os.path.dirname(__file__))
示例#6
0
    def database_dump_csv(self):
        c = self.db.cursor()
        c.execute('SELECT * FROM NodesTable as N '
                  'LEFT JOIN FilesTable as F ON N.FileId=F.FileId '
                  'LEFT JOIN RefTable as R ON N.RefName=R.RefName')

        import csv
        file_path = os.path.join(os.path.dirname(__file__), 'debug_db.csv')
        csv_file = open(file_path, "w")
        csv_file_writer = csv.writer(csv_file, delimiter=';')
        csv_file_writer.writerows(c.fetchall())
        csv_file.close()
        mtt_log('CSV Dump write into : %s' % file_path,
                add_tag='DEBUG',
                verbose=False)
        cmds.launchImageEditor(viewImageFile=os.path.dirname(__file__))
示例#7
0
    def export_as_csv(self):
        """ Export texture listing in csv file """
        file_content = self.get_database_content_as_csv()

        # check if current scene is empty
        if not file_content:
            mtt_log('Nothing to save. Operation aborted.',
                    msg_type='warning',
                    verbose=False)
            return

        # clean output
        convert_nicename = {n: t for t, n, a in MTTSettings.SUPPORTED_TYPE}
        for i, row in enumerate(file_content):
            node_type = convert_nicename[row[1]]
            ref_str = 'True' if row[2] == 1 else ''
            missing_str = 'True' if row[3] == -1 else ''
            file_content[i] = (row[0], node_type, ref_str, missing_str, row[4],
                               row[5])

        # query file to write
        scene_name = os.path.basename(cmds.file(query=True, sceneName=True))
        file_path = os.path.join(
            cmds.workspace(query=True, rootDirectory=True), scene_name)
        csv_path = cmds.fileDialog2(fileFilter='Texture List (*.csv)',
                                    caption='Save Texture List',
                                    startingDirectory=file_path,
                                    fileMode=0)

        # fill file
        if csv_path is not None:
            import csv
            file_path = csv_path[0]
            scene_name = cmds.file(q=True, sceneName=True) or 'Scene UNTITLED'
            with open(file_path, "w") as csv_file:
                csv_file_writer = csv.writer(csv_file, delimiter=';')
                csv_file_writer.writerow([scene_name])
                csv_file_writer.writerow([
                    'NODE NAME', 'NODE TYPE', 'IS REF', 'MISSING',
                    'INSTANCE COUNT', 'FILE PATH'
                ])
                csv_file_writer.writerows(file_content)
                csv_file.close()
                mtt_log('CSV file saved to %s' % file_path, verbose=False)
                cmds.launchImageEditor(
                    viewImageFile=os.path.dirname(file_path))
示例#8
0
    def export_as_csv(self):
        """ Export texture listing in csv file """
        file_content = self.get_database_content_as_csv()

        # check if current scene is empty
        if not file_content:
            mtt_log('Nothing to save. Operation aborted.', msg_type='warning',
                    verbose=False)
            return

        # clean output
        convert_nicename = {n: t for t, n, a in MTTSettings.SUPPORTED_TYPE}
        for i, row in enumerate(file_content):
            node_type = convert_nicename[row[1]]
            ref_str = 'True' if row[2] == 1 else ''
            missing_str = 'True' if row[3] == -1 else ''
            file_content[i] = (row[0], node_type, ref_str, missing_str, row[4], row[5])

        # query file to write
        scene_name = os.path.basename(cmds.file(query=True, sceneName=True))
        file_path = os.path.join(cmds.workspace(query=True, rootDirectory=True), scene_name)
        csv_path = cmds.fileDialog2(
            fileFilter='Texture List (*.csv)',
            caption='Save Texture List',
            startingDirectory=file_path,
            fileMode=0)

        # fill file
        if csv_path is not None:
            import csv
            file_path = csv_path[0]
            scene_name = cmds.file(q=True, sceneName=True) or 'Scene UNTITLED'
            with open(file_path, "w") as csv_file:
                csv_file_writer = csv.writer(csv_file, delimiter=';')
                csv_file_writer.writerow([scene_name])
                csv_file_writer.writerow(['NODE NAME', 'NODE TYPE', 'IS REF', 'MISSING', 'INSTANCE COUNT', 'FILE PATH'])
                csv_file_writer.writerows(file_content)
                csv_file.close()
                mtt_log('CSV file saved to %s' % file_path, verbose=False)
                cmds.launchImageEditor(viewImageFile=os.path.dirname(file_path))
示例#9
0
def SundayWarehouseBrowserViewIcon(file):
    file = file + '.png'
    cmds.launchImageEditor(viewImageFile = file)
 def on_open_preference_folder():
     """ Open preference folder """
     folder_path = os.path.dirname(MTTSettings.filename())
     cmds.launchImageEditor(viewImageFile=folder_path)
示例#11
0
def update(item):
        zPath = "Z:/Mudan/Script/AnimTools/Facials/images"
        imagePathH = '%s/%s.jpg'%(zPath, item)
        mc.launchImageEditor(vif=imagePathH)
 def on_open_preference_folder():
     """ Open preference folder """
     folder_path = os.path.dirname(MTTSettings.filename())
     cmds.launchImageEditor(viewImageFile=folder_path)