예제 #1
0
def get_data_from_shotgun(cb010 = True, cb020 = True, cb030 = True, cb040 = True, cb050 = True, cb060 = True, optimizeEnv = True, rippleLyr = True, bgHillLyr = True, directory = 'I:/bubblebathbay/episodes', **kwargs):
	episode = kwargs['code'].split('_')[0] if kwargs['code'] else None
	shotName = kwargs['code'] if kwargs['code'] else None
	minTime = kwargs['sg_cut_in'] if kwargs['sg_cut_in'] else None
	maxTime = kwargs['sg_cut_out'] if kwargs['sg_cut_out'] else None
	timeOfDay = kwargs['sg_tod'] if kwargs['sg_tod'] else None
	oceanType = kwargs['sg_ocean_type'] if kwargs['sg_ocean_type'] else None
	
	if shotName:
		## New File!
		cmds.file(new = True, force = True)

		## Load plugins
		plugins_to_load = ['AbcImport', 'Mayatomr'];	[cmds.loadPlugin(plug) for plug in plugins_to_load if not cmds.pluginInfo(plug, q = True, name = True, loaded = True)]

		## Enable Mentalcore
		cmds.deleteUI('unifiedRenderGlobalsWindow') if cmds.window('unifiedRenderGlobalsWindow', exists = True, q = True) else None
		bbbLightTools._setRenderGlobals()

		if minTime and maxTime:
			## Sync frame range from shotgun (min)
			cmds.playbackOptions(minTime = minTime, maxTime = maxTime, animationStartTime = minTime, animationEndTime = maxTime)

		sceneName = 'I:/bubblebathbay/episodes/%s/%s/Light/work/maya/' % (episode, shotName)
		############################################################################################################
		## Fetch latest anim publish
		bbbLightTools._fetchAnimPublish(filteredPublish = 'Fetch Anim Publish', sceneName = sceneName)
		cmds.select(cmds.listRelatives('ABC_ANIM_CACHES_hrc', children = True, fullPath = True), replace = True) if cmds.objExists('ABC_ANIM_CACHES_hrc') and cmds.listRelatives('ABC_ANIM_CACHES_hrc', children = True) else None
		bbbLightTools.fetchShadersForSelected()
		
		###########################################################################################################
		## Fetch latest crease xml publish
		bbbLightTools._fetchAnimPublish(filteredPublish = 'Fetch Crease XML Publish', sceneName = sceneName)

		###########################################################################################################
		## Fetch latest camera publish
		bbbLightTools._fetchAnimPublish(filteredPublish = 'Fetch Camera Publish', sceneName = sceneName)
		shotCam = [cmds.listRelatives(cam, fullPath = True)[0] for cam in cmds.listCameras(perspective = True) if cam != 'persp' if cmds.objExists('%s.type' % cam) if cmds.getAttr('%s.type' % cam) == 'shotCam']
		shotCam = shotCam[0] if shotCam else None
		cmds.setAttr("%s.displayResolution" % shotCam, 1)
		cmds.setAttr("%s.overscan" % shotCam, 1.3)
		
		###########################################################################################################
		## Fetch latest fx ocean publish
		bbbLightTools._fetchAnimPublish(filteredPublish = 'Fetch FX Publish', sceneName = sceneName)

		## Fetch Static ENVs
		bbbLightTools._doSTATIC_import(path = '//192.168.5.253/BBB_main/bbb/i/bubblebathbay/episodes/ep000/ep000_sh010/Light/publish/maya', namespace = 'ep000_sh010_ep000sh010_LIGHTENV') if cb010 else None
		bbbLightTools._doSTATIC_import(path = '//192.168.5.253/BBB_main/bbb/i/bubblebathbay/episodes/ep000/ep000_sh020/Light/publish/maya', namespace = 'ep000_sh020_ep000sh020_LIGHTENV') if cb020 else None
		bbbLightTools._doSTATIC_import(path = '//192.168.5.253/BBB_main/bbb/i/bubblebathbay/episodes/ep000/ep000_sh030/Light/publish/maya', namespace = 'ep000_sh030_ep000sh030_LIGHTENV') if cb030 else None
		bbbLightTools._doSTATIC_import(path = '//192.168.5.253/BBB_main/bbb/i/bubblebathbay/episodes/ep000/ep000_sh040/Light/publish/maya', namespace = 'ep000_sh040_ep000sh040_LIGHTENV') if cb040 else None
		bbbLightTools._doSTATIC_import(path = '//192.168.5.253/BBB_main/bbb/i/bubblebathbay/episodes/ep000/ep000_sh050/Light/publish/maya', namespace = 'ep000_sh050_ep000sh050_LIGHTENV') if cb050 else None
		bbbLightTools._doSTATIC_import(path = '//192.168.5.253/BBB_main/bbb/i/bubblebathbay/episodes/ep000/ep000_Docks_Addon/Light/publish/maya', namespace = 'ep000_sh050_ep000sh060_LIGHTENV') if cb060 else None

		# Do static env quick optimize
		if optimizeEnv:
			if camMovementDetector():
				bbbLightTools.optimizeScene( still = False, step = 5, offset = 1.1, startFrame = int( camMovementDetector()[0] ), endFrame = int( camMovementDetector()[1] ) )
			else:
				bbbLightTools.optimizeScene(still = True, step = 5, offset = 1.1)

		## Setup Lighting
		if timeOfDay:
			bbbLightTools.setTOD_automatic(TODay = "dawn") if timeOfDay == 'Dawn' else None
			bbbLightTools.setTOD_automatic(TODay = "sunrise") if timeOfDay == 'Sunrise' else None
			bbbLightTools.setTOD_automatic(TODay = "morning") if timeOfDay == 'Morning' else None
			bbbLightTools.setTOD_automatic(TODay = "midday") if timeOfDay == 'Day' else None
			bbbLightTools.setTOD_automatic(TODay = "afternoon") if timeOfDay == 'Afternoon' else None
			bbbLightTools.setTOD_automatic(TODay = "afternoon") if timeOfDay == 'AfternoonLate' else None
			bbbLightTools.setTOD_automatic(TODay = "sunset") if timeOfDay == 'Sunset' else None
			bbbLightTools.setTOD_automatic(TODay = "dusk") if timeOfDay == 'Dusk' else None
			bbbLightTools.setTOD_automatic(TODay = "night") if timeOfDay == 'Night' else None

			tod_setter(timeOfDay = timeOfDay)

		## Finally, render setup!
		bbbLightTools.RenderSetup()

		if rippleLyr:
			## Go to defaultRenderLayer before setting up ripple or bg hills separated render layers
			cmds.editRenderLayerGlobals(currentRenderLayer = 'defaultRenderLayer')
			## Import ripple layer
			bbbLightTools.importRippleLayer()
			## Ripple_Lyr
			bbbLightTools.setRippleLYR()

		if bgHillLyr:
			## Go to defaultRenderLayer before setting up ripple or bg hills separated render layers
			cmds.editRenderLayerGlobals(currentRenderLayer = 'defaultRenderLayer')
			## BGHills_Lyr
			bbbLightTools.setBGHills()

		## Save scene!
		shotPath = '%s.generated__.ma' % shotName.replace('_', '')
		shotPath = '%s/%s/%s/Light/work/maya/%s' % (directory, episode, shotName, shotPath)

		if not os.path.exists( os.path.dirname(shotPath) ):
			os.makedirs( os.path.dirname(shotPath) )

		cmds.file(rename = shotPath)
		cmds.file(save = True, type = "mayaAscii")
예제 #2
0
def optimizerButton():
    still = cmds.checkBox("bbbOptimizerStillCB", q=True, value=True)
    step = cmds.intField("bbbOptimizerIntField", q=True, value=True)
    offset = cmds.floatField("bbbOptimizerFloatField", q=True, value=True)

    bbbLightTools.optimizeScene(still=still, step=step, offset=offset)