예제 #1
0
	def UIConvertTool_DisplayChecker(self):
		self.dDict = StudioSettings.SceneInfoStorage(self.sTool)
		aList = ['oUIConvertPick','oUIConvert1','oUIConvert2','oUIConvert3','oUIConvert4']
		aList2 = ['oUIConvertIT','oUIConvert5','oUIConvert6','oUIConvert7','oUIConvert8']
		aColour = ['darkgray', 'tone5']
		aColour2 = ['darkgray', 'tone1']


		# run only if the tool is (UI is) extended. having the conv tools (on extra UI page) displaying
		if self.dDict['ConvertTool']:
			for i in range(5):

				iVal = self.dDict['ConvertToolTo'][i]
				cmds.button(aList2[i], e = True, bgc = self.UIBGColour(aColour[iVal]), en = True)
				if i == 0: # special colour for convert button
					cmds.button(aList2[i], e = True, bgc = self.UIBGColour(aColour2[iVal]), en = True)

				iVal = self.dDict['ConvertToolFrom'][i]
				cmds.button(aList[i], e = True, bgc = self.UIBGColour(aColour[iVal]))

				if iVal:
					if i:
						cmds.button(aList2[i], e = True, bgc = self.UIBGColour(aColour[0]), en = False)



				if i:
					iVal = self.dDict[str(i)]
					if iVal == '-':
						cmds.button(aList2[i], e = True, bgc = self.UIBGColour(aColour[0]), en = False)



			StudioSettings.SceneInfoStorage(self.sTool, self.dDict)
예제 #2
0
	def UIButton_Capture(self, sView, *args):
		# Display Logic
		K = cmds.getModifiers()
		sGrayOut = 'darkgray'

		dToolInfo = StudioSettings.SceneInfoStorage(self.sTool)
		sLabel = dToolInfo[sView]


		iStartCapture = 0
		if K:

			if sLabel == '-':
				sLabel = sView
			else:
				sLabel = '-'

			dToolInfo[sView] = sLabel



			StudioSettings.SceneInfoStorage(self.sTool, dToolInfo)

		else:
			if not sLabel == '-':
				iStartCapture = 1

		#self.UIDisplayChecker()

		# PlayBlast time!
		if iStartCapture:

			sCapturePath = self.dShotInfo['sPlayBlastSeqPath']+'/'+sView+'/PlayBlast_%s'%sView
			#sCapturePath = self.aShotInfo[7]+'/'+sView+'/PlayBlast_%s'%sView
			sIn = dToolInfo['currentStartFrame']
			sOut = dToolInfo['currentEndFrame']

			cmds.playblast(format = 'image', filename = sCapturePath, st = int(sIn), et = int(sOut), sequenceTime = 0, clearCache = 1, viewer = 0, showOrnaments = 1, offScreen = True, fp = 4, percent = 100, compression = "jpg", quality = 70, fo = True, wh = [self.iPBwidth, self.iPBheight])


			cmds.warning('Capture Process All Finished')
			#self.UIDisplayChecker()

			cmds.button('oUICapture%sButton'%sView, e = True, bgc = self.UIBGColour('tone1'))
			#self.dDict['LastCapture'] = sView
			dToolInfo['LastCapture'] = sView

			self.PrintOnScreen(['a7a8af', 'Playblast done [%s]'%sView, 0x6b6c75])



		StudioSettings.SceneInfoStorage(self.sTool, dToolInfo)

		self.UIConvertTool_DisplayChecker()
		self.UIDisplayChecker()
예제 #3
0
    def __init__(self):
        self.Temp = None
        self.sTool = 'PBTool'  # Tool name node under 'Anim_Tool'

        # Importing Studio Settings
        self.dShotInfo = StudioSettings.ShotInfo(1, 0)
        aPBInfo = StudioSettings.ProjectInfo('ABA')[0]
        self.iPBwidth = aPBInfo[0]
        self.iPBheight = aPBInfo[1]

        sFileName = '%s_%s_.rv' % (self.dShotInfo['sSeqNumber'],
                                   self.dShotInfo['sShotNumber'])
        print sFileName
        self.sRvPath = os.path.join(self.dShotInfo['sPlayBlastToolPath'],
                                    sFileName)
        print sRvPath
        self.oUI = 'PB_%s_%s' % (
            self.dShotInfo['sSeqNumber'], self.dShotInfo['sShotNumber']
        )  # Watch out when this is only numbers, the tool fails.

        # Setting up tool custom dictionary for storage
        self.dDict = StudioSettings.SceneInfoStorage(self.sTool)
        if not self.dDict:
            self.dDict = {
                '1': '1',
                '2': '-',
                '3': '-',
                '4': '-',
                'currentStartFrame': 1001,
                'currentEndFrame': 1010,
                'prodStartFrame': None,
                'prodEndFrame': None,
                'markedFrames': [],
                'CalcTool': 0,
                'AnnotateTool': 0,
                'ConvertTool': 0,
                'ConvertToolFrom': [0, 0, 0, 0, 0],
                'ConvertToolTo': [0, 0, 0, 0, 0],
                'PickedFile': '',
                'LastCapture': '',
            }

        # Reset display and sizes of extra tools.
        for tool in ['CalcTool', 'ConvertTool', 'AnnotateTool']:
            self.dDict[tool] = 0

        # Reset Convert tool
        self.dDict['ConvertToolFrom'] = [0, 0, 0, 0, 0]
        self.dDict['ConvertToolTo'] = [0, 0, 0, 0, 0]

        StudioSettings.SceneInfoStorage(self.sTool, self.dDict)  # Store dDict

        self.UISetWindow()
        self.UICreate()
        self.UIDisplayChecker()
예제 #4
0
	def Button_OpenFolder(self, *args):
		StudioSettings.ShotInfo(0,1) # (1,1) = (Folder Creation, Print paths.)
		aPath = self.GetScenePathFromCurrentEnvironment().split('/')
		#aPath = self.sScenePath
		sPath = '/'.join(aPath)

		if not cmds.getModifiers() == 0:
			StudioSettings.OSFileBrowserCommand(sPath)
			aPrint = ['a7a8af', 'Opening Folder.', 0x6b6c75]

		else:
			StudioSettings.CopyToClipBoard(sPath)
			aPrint = ['a7a8af', 'Copied to Clipboard.', 0x6b6c75]

		cmds.inViewMessage(amg = '<text style="color:#%s";>%s</text>'%(aPrint[0], aPrint[1]), pos = 'botCenter', fade = True, fts = 7, ft = 'arial',bkc = aPrint[2] )
예제 #5
0
    def UIButton_OpenFolder(self, sFolder, *args):
        K = cmds.getModifiers()
        if sFolder == 'rv':
            #sPath = self.aShotInfo[6]
            sPath = self.dShotInfo['sPlayBlastToolPath']
        elif sFolder == 'seq':
            ##sPath = self.aShotInfo[7]
            sPath = self.dShotInfo['sPlayBlastSeqPath']

        if K:
            StudioSettings.OSFileBrowserCommand(sPath)
            aPrint = ['a7a8f', 'Opening a FileBrowser.', 0x6b6c75]

        else:
            StudioSettings.CopyToClipBoard(sPath)
            aPrint = ['a7a8af', 'Copied Path to Clipboard.', 0x6b6c75]

        self.PrintOnScreen(aPrint)
예제 #6
0
    def UIDisplayChecker(self):
        self.dDict = StudioSettings.SceneInfoStorage(self.sTool)

        # Frame Count
        iCurrentStart = self.dDict['currentStartFrame']
        iCurrentEnd = self.dDict['currentEndFrame']
        iProdStart = self.dDict['prodStartFrame']
        iProdEnd = self.dDict['prodEndFrame']

        cmds.text('oUIFrameCout',
                  e=True,
                  l=str(iCurrentEnd - iCurrentStart + 1) + ' f')

        # Frames Section
        aTones = ['tone5', 'tone5']

        if iCurrentStart == iProdStart:
            aTones[0] = 'tone1'
        if iCurrentEnd == iProdEnd:
            aTones[1] = 'tone1'

        # if aTones[0]:
        cmds.button('oUIStartButton', e=True, bgc=self.UIBGColour(aTones[0]))
        # if aTones[1]:
        cmds.button('oUIEndButton', e=True, bgc=self.UIBGColour(aTones[1]))

        # Views Section
        aView = ['1', '2', '3', '4']

        for v in aView:
            if self.dDict[v] == '-':
                sBGC = 'CaptureTone3'
                sLabel = '-'
            else:
                sBGC = 'tone4'
                sLabel = v
                if self.dDict['LastCapture'] == v:
                    sBGC = 'tone1'
            cmds.button('oUICapture%sButton' % v,
                        e=True,
                        bgc=self.UIBGColour(sBGC),
                        label=sLabel)

        # Extra tools

        aTones = ['ConvertToolButtonOff', 'ConvertToolButtonOn']
        aTones2 = ['CalcToolButtonOff', 'CalcToolButtonOn']
        aTones3 = ['AnnotateToolButtonOff', 'AnnotateToolButtonOn']
        cmds.button('oUIConvert',
                    e=True,
                    bgc=self.UIBGColour(aTones[self.dDict['ConvertTool']]))
        cmds.button('oUICalc',
                    e=True,
                    bgc=self.UIBGColour(aTones[self.dDict['CalcTool']]))
        cmds.button('oUIAnnotate',
                    e=True,
                    bgc=self.UIBGColour(aTones[self.dDict['AnnotateTool']]))
예제 #7
0
    def Button_Open(self, *args):
        ''' When Open Button is pressed.'''
        sAllPath = self.GetScenePathFromUISelection()
        if cmds.file(q=True, amf=True):
            self.MessageBox('Save?', sAllPath)

        else:
            # cmds.file(sAllPath, o = True)
            StudioSettings.OpenSceneCommand(sAllPath)
예제 #8
0
	def UIButton_SetRangeFromRV(self, *args):
		aContent = self.GetActiveRVinfo()
		iIn = aContent[1][0]
		iOut = aContent[1][1]

		self.dDict['currentStartFrame'] = iIn
		self.dDict['currentEndFrame'] = iOut
		cmds.button('oUIStartButton', e = True, label = iIn)
		cmds.button('oUIEndButton', e = True, label = iOut)

		StudioSettings.SceneInfoStorage(self.sTool, self.dDict)
		self.UIDisplayChecker()
예제 #9
0
	def UIButton_ExtraToolExpand(self, sTool, *args):
		self.dDict = StudioSettings.SceneInfoStorage(self.sTool)

		# Set height of each custom tools.
		dTools = {  'CalcTool' : 62,
					'ConvertTool' : 62,
					'AnnotateTool' : 200,}

		# Change height accordingly
		for tool in dTools.keys():
			if tool == sTool:
				# Toggle and change height
				if self.dDict[tool]:
					dTools[tool] *= -1
				self.Height += dTools[tool]
				self.dDict[tool] = 1 - self.dDict[tool]

		StudioSettings.SceneInfoStorage(self.sTool, self.dDict)
		self.UIReBuild()
		self.UIDisplayChecker()
		self.UIConvertTool_DisplayChecker()
예제 #10
0
	def Button_OpenFile(self, sPath, iVal, *args):
		if iVal == 1: # Don't save
			cmds.file(modified = False) # Fake the maya scene to force open that is has been saved already so it will load without asking.
		elif iVal == 2: # Save
			cmds.file(s = True, f = True)
		elif iVal == 3: # Increment Save
			mel.eval('incrementalSave;')

		if iVal: # if not Cancelled.
			StudioSettings.OpenSceneCommand(sPath)

		if self.oWindow:
			cmds.deleteUI(self.oWindow)
예제 #11
0
    def UIButton_ProdRange(self, *args):

        iRange = StudioSettings.StudioProductionFrameRange()
        iIn = int(cmds.playbackOptions(q=True, minTime=True))
        iOut = int(cmds.playbackOptions(q=True, maxTime=True))
        if iRange:
            cmds.button('oUIProdButton', e=True, bgc=self.UIBGColour('tone2'))
        else:
            self.dDict = StudioSettings.SceneInfoStorage(self.sTool)
            cmds.button('oUIProdButton', e=True, bgc=self.UIBGColour('tone3'))

        self.dDict['currentStartFrame'] = iIn
        self.dDict['currentEndFrame'] = iOut
        cmds.button('oUIStartButton', e=True, label=str(iIn))
        cmds.button('oUIEndButton', e=True, label=str(iOut))

        self.dDict['prodStartFrame'] = iIn
        self.dDict['prodEndFrame'] = iOut

        StudioSettings.SceneInfoStorage(self.sTool,
                                        self.dDict)  # To update the info
        self.UIDisplayChecker()
예제 #12
0
    def UIButton_Open(self, sOpen, *args):
        # 'PB' for quad view, 'Anno' for opening Annotation.rv
        K = cmds.getModifiers()
        if sOpen == 'PB':
            if not os.path.exists(self.sRvPath):
                K = 100
            if K:  # If with any Modifiers, Create a fresh Active.rv. (deletes all markings etc.)
                dInfo = StudioSettings.SceneInfoStorage(
                    self.sTool)  # Check function for more info.

                sIn = dInfo['prodStartFrame']
                if sIn == None:
                    sIn = dInfo['currentStartFrame']

                sOut = dInfo['prodEndFrame']
                if sOut == None:
                    sOut = dInfo['currentEndFrame']

                aPath = [
                    None,
                    None,
                    None,
                    None,
                ]
                for i in range(0, len(aPath)):
                    #aPath[i] = self.aShotInfo[7] + '/%s/PlayBlast_%s.%s-%s@@@@.jpg'%(str(i+1), str(i+1), sIn, sOut)
                    aPath[i] = self.dShotInfo[
                        'sPlayBlastSeqPath'] + '/%s/PlayBlast_%s.%s-%s@@@@.jpg' % (
                            str(i + 1), str(i + 1), sIn, sOut)

                sContent = self.CreateLatestQuadRvFile(aPath)

                if sContent:
                    oRvFile = open(self.sRvPath, 'w')
                    oRvFile.write(sContent)
                    oRvFile.close()

                aPrint = ['a7a8af', 'Creating a New .rv', 0x6b6c75]

            else:
                aPrint = ['a7a8af', 'Opening Existing .rv', 0x6b6c75]

            try:
                cmd = 'rv %s &' % (self.sRvPath)
                os.system(cmd)
            except Exception as e:
                print e

            self.PrintOnScreen(aPrint)

        self.UIDisplayChecker()
예제 #13
0
	def UIButton_InOut(self, sInOut, *args):
		self.dDict = StudioSettings.SceneInfoStorage(self.sTool)

		iCurrent = int(cmds.currentTime(q = True))
		if sInOut == 'Start':
			self.dDict['currentStartFrame'] = iCurrent
			cmds.button('oUIStartButton', e = True, label = iCurrent)

			# if End frame is before current frame.
			if self.dDict['currentEndFrame'] <= iCurrent:
				self.dDict['currentEndFrame'] = iCurrent + 1
				cmds.button('oUIEndButton', e = True, label = iCurrent + 1)


		elif sInOut == 'End':
			self.dDict['currentEndFrame'] = iCurrent
			cmds.button('oUIEndButton', e = True, label = iCurrent)

			# if End frame is before current frame.
			if self.dDict['currentStartFrame'] >= iCurrent:
				self.dDict['currentStartFrame'] = iCurrent - 1
				cmds.button('oUIStartButton', e = True, label = iCurrent - 1)


		elif sInOut == 'Current':
			iIn = int(cmds.playbackOptions(q = True, minTime = True))
			iOut = int(cmds.playbackOptions(q = True, maxTime = True))
			self.dDict['currentStartFrame'] = iIn
			self.dDict['currentEndFrame'] = iOut
			cmds.button('oUIStartButton', e = True, label = iIn)
			cmds.button('oUIEndButton', e = True, label = iOut)

		else:
			pass

		StudioSettings.SceneInfoStorage(self.sTool, self.dDict)

		self.UIDisplayChecker()
예제 #14
0
    def __init__(self):

        self.aDropMenu = [
            [],
            [],
            [],
            [],
        ]
        self.iButton1 = 0
        self.iButton2 = 0
        self.iTextField1 = 0
        self.iTextField2 = 0
        self.sUser = getpass.getuser()
        self.oUI = ''

        # Get Studio Settings from external

        #self.sScriptPath = '/vol/transfer/dyabu/Scripts/mayaScripts'
        #StudioSettings = __import__("StudioSettings")
        #self.StudioSettings = imp.load_source('StudioSettings', '%s/StudioSettings.py'% self.sScriptPath)

        self.dShotInfo = StudioSettings.ShotInfo(
            1, 0)  # (1,1) = (Folder Creation, Print paths.)
        #print self.dShotInfo

        # ScenePath stuffs

        #self.sScenePath = self.aShotInfo[1]
        self.sScenePath = self.dShotInfo['sScenePath']
        #self.sShotPath = ''
        self.sShotPath = '/'.join(self.sScenePath.split('/')[:-1])

        #self.GetScenePathFromCurrentEnvironment()

        if self.ErrorCheckAndFolderCreation():
            self.aAllList = self.CollectMayaFiles()
            self.oWindow = None
            self.UISetWindow()
            self.UICreate()
        else:
            cmds.warning('Please Save your current scene.')
예제 #15
0
	def UIButton_RVInfoToMaya(self, sType, *args):
		K = cmds.getModifiers()



		aContent = self.GetActiveRVinfo()
		# aContent[0] : Capture Frame Range
		# aContent[1] : RV Region
		# aContent[2] : RV Marked Frames
		# aContent[3] : Current Frame

		if aContent:
			if sType == 'Range':
				cmds.playbackOptions(min = aContent[1][0])

			elif sType == 'Current':
				cmds.currentTime(aContent[3][0])

			elif sType == 'Marked':

				oAnimTools = 'ANIM_TOOLS'
				self.sTool = 'PBTool'
				if K:
					oTick = 'KeyPoseFrames'
				else:
					oTick = 'MarkedFrames'


				if aContent[2]:
					if cmds.objExists(oTick):
						cmds.delete(oTick)

					#self.dDict = StudioSettings.SceneInfoStorage(self.sTool)
					self.dDict['markedFrames'] = aContent[2]



					cmds.group(name = oTick, em = True, p = self.sTool)

					cmds.setKeyframe( oTick, attribute = 'translateX', t = self.dDict['markedFrames'])
					StudioSettings.SceneInfoStorage(self.sTool, self.dDict)
    import pickle

import StudioSettings

# vvv 1/1

fNukeCreatorFile = os.path.join(os.path.dirname(__file__),
                                "NukeCreator_Customizer.py")

# Getting Shot Number - StudioSettings.py
#sScriptName = 'StudioSettings' # remove '.py'
#sScriptPath = '/vol/transfer/dyabu/Scripts/mayaScripts/%s.py' % sScriptName
#StudioSettings = imp.load_source(sScriptName, sScriptPath)

# Getting info using StudioSettings
dShotInfo = StudioSettings.ShotInfo(
    1, 0)  # (1,1) = (Folder Creation, Print paths.)

# vvv paths 1/1
dShot = {
    "FilePath":
    "/%s/shots/%s/%s/motion/work/maya/dyabu/Images/Nuke/TheNukeFile.nk" %
    (dShotInfo['sProject'], dShotInfo['sSeqNumber'], dShotInfo['sShotNumber']),
    'ShotNumber':
    "  %s %s" % (dShotInfo['sSeqNumber'], dShotInfo['sShotNumber']),
    'sShotNumber':
    dShotInfo['sShotNumber'],
    'sSeqNumber':
    dShotInfo['sSeqNumber'],
    'sProject':
    dShotInfo['sProject'],
    'sNukeFileFolder':
def main():
	# Start here
	StudioSettings.ShotInfo(0, 1)
예제 #18
0
	def UIConvertTool(self, sType, *args):
		self.dDict = StudioSettings.SceneInfoStorage(self.sTool)
		iNukeConversion = 0

		sPickedFile = ''

		if sType == 'Pick': # Pick Button
			for i in range(5):
				self.dDict['ConvertToolFrom'][i] = 0
			self.dDict['PickedFile'] = None

			sPickedFile = cmds.fileDialog2(ds = 1, cap = 'Title', fm = 1)
			if sPickedFile:
				self.dDict['ConvertToolFrom'][0] = 1
				self.dDict['PickedFile'] = sPickedFile[0]
				StudioSettings.SceneInfoStorage(self.sTool, self.dDict) # Store dDict



		elif sType.isdigit(): # From : 1-4, To : 5-8 Button
			iIndex = int(sType)

			if iIndex <5: # From: 1-4
				sVar = 'ConvertToolFrom'
				#self.aShotInfo[7]
				iVal = 1

				self.dDict['ConvertToolTo'][iIndex] = 0
				self.dDict['PickedFile'] = ''

			else: # To : 5 - 8
				sVar = 'ConvertToolTo'
				iIndex = iIndex - 4
				iVal = 1
				if self.dDict['ConvertToolFrom'][iIndex] == 1:
					iVal = 0


			for i in range(5):
				self.dDict[sVar][i] = 0

			self.dDict[sVar][iIndex] = iVal


		else: # Convert Button
			if self.dDict['ConvertToolTo'][0]: # When ready to convert files.

				# Empty destination Folder
				iTarget =  self.dDict['ConvertToolTo'][1:].index(1)+1
				sTargetPath = self.dShotInfo['sPlayBlastSeqPath'] + '/%s/' % iTarget
				sTargetFilePath = self.dShotInfo['sPlayBlastSeqPath'] + '/%s/PlayBlast_%s.####.jpg' % (iTarget, iTarget)


				if os.path.exists(sTargetPath):
					shutil.rmtree(sTargetPath) # delete .../PB/3/

				if not os.path.exists(sTargetPath):
					os.makedirs(sTargetPath) # create .../PB/3/

				

				# Get SourcePath
				if self.dDict['ConvertToolFrom'][0]: #if user selecting files from browser:
					if self.dDict['PickedFile']:
						aSourceFilePath = self.dDict['PickedFile'].split('.')
						aSourceFilePath[-2] = '####'
						sSourceFilePath = '.'.join(aSourceFilePath)

				else:
					iTarget =  self.dDict['ConvertToolFrom'][1:].index(1)+1
					sSourceFilePath = self.dShotInfo['sPlayBlastSeqPath'] + '/%s/PlayBlast_%s.####.jpg' % (iTarget, iTarget)


				if sSourceFilePath.lower().endswith('jpg'):
					aTargetFilePath = sTargetFilePath.split('.')
					aSourceFilePath = sSourceFilePath.split('.')

					for i in range(self.dDict['prodStartFrame'], self.dDict['prodEndFrame']+1):
						s = '%04d'%i
						aTargetFilePath[-2] = s
						aSourceFilePath[-2] = s

						sTargetFilePath = '.'.join(aTargetFilePath)
						sSourceFilePath = '.'.join(aSourceFilePath)

						shutil.copy(sSourceFilePath, sTargetFilePath)

				else: # If picked files aren't jpgs. (Activate Nuke)

					print sSourceFilePath
					print sTargetFilePath
					print self.dDict['prodStartFrame']
					print self.dDict['prodEndFrame']

					self.NukeConversion([sSourceFilePath, sTargetFilePath, self.dDict['prodStartFrame'], self.dDict['prodEndFrame'], 1.0])


		iCheck = sum(self.dDict['ConvertToolFrom']) + sum(self.dDict['ConvertToolTo'][1:])
		if iCheck == 2:
			self.dDict['ConvertToolTo'][0] = 1
		else:
			self.dDict['ConvertToolTo'][0] = 0


		StudioSettings.SceneInfoStorage(self.sTool, self.dDict)
		self.UIConvertTool_DisplayChecker()
예제 #19
0
	def UIConvertTool(self, sType, *args):
		self.dDict = StudioSettings.SceneInfoStorage(self.sTool)
		iNukeConversion = 0

		sPickedFile = ''

		if sType == 'Pick': # Pick Button
			for i in range(5):
				self.dDict['ConvertToolFrom'][i] = 0
			self.dDict['PickedFile'] = ''

			sPickedFile = cmds.fileDialog2(ds = 1, cap = 'Title', fm = 1)
			if sPickedFile:
				self.dDict['ConvertToolFrom'][0] = 1
				self.dDict['PickedFile'] = sPickedFile
				StudioSettings.SceneInfoStorage(self.sTool, self.dDict) # Store dDict


		elif sType.isdigit(): # From : 1-4, To : 5-8
			iIndex = int(sType)

			if iIndex <5: # From: 1-4
				sVar = 'ConvertToolFrom'
				#self.aShotInfo[7]
				iVal = 1

				self.dDict['ConvertToolTo'][iIndex] = 0

			else: # To : 5 - 8
				sVar = 'ConvertToolTo'
				iIndex = iIndex - 4
				iVal = 1
				if self.dDict['ConvertToolFrom'][iIndex] == 1:
					iVal = 0


			for i in range(5):
				self.dDict[sVar][i] = 0

			self.dDict[sVar][iIndex] = iVal


		else: # Convert
			if self.dDict['ConvertToolTo'][0]:

				# Empty destination Folder
				iTarget =  self.dDict['ConvertToolTo'][1:].index(1)+1
				#sTargetPath = self.aShotInfo[7] + '/%s/' % iTarget
				sTargetPath = self.dShotInfo['sPlayBlastSeqPath'] + '/%s/' % iTarget


				if os.path.exists(sTargetPath):
					shutil.rmtree(sTargetPath) # delete .../PB/3/

				if not os.path.exists(sTargetPath):
					os.makedirs(sTargetPath) # create .../PB/3/



				# Get SourcePath
				if self.dDict['ConvertToolFrom'][0]: #if user selecting files:

					self.dDict = StudioSettings.SceneInfoStorage(self.sTool)
					if self.dDict['PickedFile']:
						if not self.dDict['PickedFile'][0].endswith('jpg'):
							iNukeConversion = 1
						else:
							aPickedPath = self.dDict['PickedFile'][0].split('/')
							sPickedFile = aPickedPath[-1]
							sSourcePath = '/'.join(aPickedPath[:-1])


				else: # if not picked ( if sSourcePath is none)
					iSource = self.dDict['ConvertToolFrom'].index(1)
					#sSourcePath = self.aShotInfo[7] + '/%s/' % iSource
					sSourcePath = self.dShotInfo['sPlayBlastSeqPath'] + '/%s/' % iSource
					#dShotInfo['sPlayBlastSeqPath']



				# Get files to be copied over.
				aTransferFiles = []
				aFileName = [str(_) for _ in sPickedFile.split('.')]

				if not aFileName[-1].lower() == 'jpg':
					iNukeConversion = 1

				for  f in os.listdir(sSourcePath):
					if f.startswith(aFileName[0]):
						aTransferFiles.append(f)
				aTransferFiles.sort()


				sFileName = 'PlayBlast_%s'%iTarget
				for tf in aTransferFiles:
					aName = tf.split('.')
					aName[0] = sFileName

					shutil.copy(sSourcePath+'/' + tf, sTargetPath+'/'+'.'.join(aName))

				if iNukeConversion:
					print 'start nuke'


		iCheck = sum(self.dDict['ConvertToolFrom']) + sum(self.dDict['ConvertToolTo'][1:])
		if iCheck == 2:
			self.dDict['ConvertToolTo'][0] = 1
		else:
			self.dDict['ConvertToolTo'][0] = 0


		StudioSettings.SceneInfoStorage(self.sTool, self.dDict)
		self.UIConvertTool_DisplayChecker()
예제 #20
0
def ProjectCustom_SetUI(): # vvv 2/3 # Completely Custom tool for current proj.

	sSideCamera = 'SIDE_CAM'
	if not cmds.objExists(sSideCamera):
		oSideCamera = cmds.camera()
		cmds.rename(oSideCamera[0], '%s'%sSideCamera)



	oSel = [str(s) for s in cmds.ls(sl = True, o = True)]

	# Creation of  SideCam
	sSideCamera = 'SIDE_CAM'
	if not cmds.objExists(sSideCamera):
		oSideCamera = cmds.camera()
		cmds.rename(oSideCamera[0], '%s'%sSideCamera)


	# Scene Storage. StudioSetting.SceneInfoStorage()
	dSceneInfo = {	'CustomCamViews':0,
				'CustomCamViewList':[]}

	# Node Structure Creation
	aGroup = [	'lllllllllllllllll__CAMERAs__lllllllllllllllll',
				'CardRig___',
				'SideCam___',
				'FaceCam___',
				'RenderCam___',
				'lllllllllllllllll__Main_Puppet__lllllllllllll',
				'lllllllllllllllll__Sub_Puppet__llllllllllllll',
				'lllllllllllllllll__Lights__llllllllllllllllll'] # Do not change the list order. Possible to add more.
	cmds.select(clear = True)

	iError = 0

	# Parent Nodes
	for g in aGroup:
		if not cmds.objExists(g):
			if '___' in g: cmds.group( em = True, name = g, p = aGroup[0])
			else: cmds.group( em = True, name = g)
			if g == aGroup[0]:
				cmds.addAttr(aGroup[0], shortName = 'notes', dataType = 'string') # Activate Notes Attributes to store json
				StudioSettings.SceneInfoStorage(aGroup[0], dSceneInfo) # Store dSceneInfo
		if 'lllll' in g:
			vColour = UIColourControl.keywordColour('MayaBG')
			vColour = UIColourControl.offsetRGBvalues(vColour, R = 0.3, G = 0.3, B = 0.3)
			for i, v in enumerate('RGB'): 
				cmds.setAttr('%s.useOutlinerColor'%g, True)
				cmds.setAttr('%s.outlinerColor%s'%(g, v), vColour[i])


	## Logic to find available cameras. (find children for camera)
	dSceneInfo = StudioSettings.SceneInfoStorage(aGroup[0]) # Get dSceneInfo

	dSceneInfo['CustomCamViewList']  = []
	for cam in aGroup[2:5]: # Using aGroup[2 to 4]
		if cmds.listRelatives(cam, c = True, ad = True, type = 'camera'):
			dSceneInfo['CustomCamViewList'].append(cam)

	dSceneInfo = StudioSettings.SceneInfoStorage(aGroup[0], dSceneInfo) # Store dSceneInfo (update)
	print dSceneInfo


	# Find Next Camera to Display

	if len(dSceneInfo['CustomCamViewList']) == 0: # If no camera is found. (not sorted under cam groups)
		iError = 1 # No camera found.
		aPrint = UIColourControl.inViewMessageColourPreset('Red', 'No Cameras found')
		iIndex = 0

	elif dSceneInfo['CustomCamViews'] >= len(dSceneInfo['CustomCamViewList'])-1:
		iIndex = 0
	else:
		iIndex = dSceneInfo['CustomCamViews'] + 1


	if not iError: # If cameras are found...
		sCamera = dSceneInfo['CustomCamViewList'][iIndex]
		aCamera = cmds.listRelatives(sCamera, c = True, ad = True, type = 'camera')

		if sCamera == aGroup[4]:
			aPrint = UIColourControl.inViewMessageColourPreset('Green', 'RENDER cam')
			aVis = [1, 1, 0, 0, 1, None, None, 1]
			aCamKeyword = ['Left', 'render', 'legalCam']
		elif sCamera == aGroup[3]:
			aPrint = UIColourControl.inViewMessageColourPreset('Blue',  ' FACE cam ')
			aVis = [1, 0, 0, 1, 0, None, None, 0]
			aCamKeyword = ['Shape1', 'FACE']
		elif sCamera == aGroup[2]:
			aPrint = UIColourControl.inViewMessageColourPreset('Gray',  ' SIDE cam ')
			aVis = [1, 0, 1, 0, 1, None, None, 1]
			aCamKeyword = ['SIDE_CAM']

		# Hide unnecessary Groups of camera.
		for i, v in enumerate(aVis):
			if not v == None:
				cmds.setAttr('%s.visibility'%aGroup[i], v)


		# Pick camera of the first match in the keyword.
		sCamera = None
		sTCamera = None # This is needed if keyword search fails. (Just to have something selected.)
		for c in aCamera:
			sCamera = c
			for k in aCamKeyword:
				if k in c:
					sTCamera = c
					break
		if sTCamera:
			sCamera = sCamera
		if sCamera:
			cmds.modelEditor('modelPanel4', e = True, camera = sCamera)
		cmds.modelEditor('modelPanel1', e = True, camera = 'ANIM_CAM', activeView = True)


	# Print Statement
	cmds.inViewMessage(amg = '<text style="color:#%s";>%s</text>'%(aPrint[0], aPrint[1]), pos = 'botCenter', fade = True, fts = 10, ft = 'arial',bkc = aPrint[2] )

	# Store Scene Info.
	dSceneInfo['CustomCamViews'] = iIndex
	StudioSettings.SceneInfoStorage(aGroup[0], dSceneInfo) # Store dSceneInfo

	cmds.select(oSel, r = True)