Exemple #1
0
 def __init__(self,
              metadata_path='',
              filename='',
              camera='',
              frame_range='',
              format='',
              compression='',
              width='',
              height=''):
     self.metadata_path = metadata_path
     self.camera = camera
     self.frame_range = FrameRange.parse(frame_range)
     self.format = format
     self.compression = compression
     self.widthHeight = (int(width), int(height))
     self.filename = filename
     self.input_pb_args = {
         'filename': self.filename,
         'frame': self.frame_range.get_frames(),
         'format': self.format,
         'compression': self.compression,
         'widthHeight': self.widthHeight
     }
     self.gpu_meshes = []
     self.namespaces = []
     self.colors = []
     self.meshes_with_color = []
     self.old_render_layer = None
     self.playblast_panel = pm.modelPanel(replacePanel='modelPanel4')
     self.old_bkg_color = pm.displayRGBColor("background", query=True)
     self.old_bkg_top_color = pm.displayRGBColor("backgroundTop",
                                                 query=True)
     self.old_bkg_bottom_color = pm.displayRGBColor("backgroundBottom",
                                                    query=True)
 def __init__(self, metadata_path='', filename= '', camera='',
              frame_range='', format='', compression='', width='', height=''):
     self.metadata_path = metadata_path
     self.camera = camera
     self.frame_range = FrameRange.parse(frame_range)
     self.format = format
     self.compression = compression
     self.widthHeight = (int(width), int(height))
     self.filename = filename
     self.input_pb_args = {'filename' : self.filename,
                           'frame' : self.frame_range.get_frames(),
                           'format' : self.format,
                           'compression' : self.compression,
                           'widthHeight' : self.widthHeight}
     self.gpu_meshes = []
     self.namespaces = []
     self.colors = []
     self.meshes_with_color = []
     self.old_render_layer = None
     self.playblast_panel = pm.modelPanel(replacePanel='modelPanel4')
     self.old_bkg_color = pm.displayRGBColor("background", query=True)
     self.old_bkg_top_color = pm.displayRGBColor("backgroundTop", query=True)
     self.old_bkg_bottom_color = pm.displayRGBColor(
         "backgroundBottom",
         query=True
     )
Exemple #3
0
    def runPlayblast(self, _):
        print("this will run the playblast")
        pc_playblast.getEditor()
        pc_playblast.setBlastSettings()

        current = pm.displayRGBColor("background", query=True)
        pm.displayRGBColor("background", 0.2, 0.2, 0.2)

        pc_playblast.pcBlast(self.saveloc.getText(), self.range.getValue1(),
                             self.range.getValue2())
        pm.deleteUI(self.name)

        pm.displayRGBColor("background", current[0], current[1], current[2])
def cam_set_default_colors(*args, **kwargs):
  ''' '''  
  pm.displayRGBColor('background', 0.0, 0.0, 0.0)
  pm.displayRGBColor('backgroundTop', 0.54, 0.62, 0.70)
  pm.displayRGBColor('backgroundBottom', 0.1, 0.1, 0.1)
  
  bkgdColor = pm.displayRGBColor('background', query=True)
  topColor = pm.displayRGBColor('backgroundTop', query=True)
  bottomColor = pm.displayRGBColor('backgroundBottom', query=True)
  
  pm.colorSliderGrp(prefix+'_colorSliderGrp_background_color', edit=True, rgb=bkgdColor )
  pm.colorSliderGrp(prefix+'_colorSliderGrp_gradient_top', edit=True, rgb=topColor )
  pm.colorSliderGrp(prefix+'_colorSliderGrp_gradient_bottom', edit=True, rgb=bottomColor )
  
def cam_get_cam_attrs(cameraListDropdown, *args, **kwargs):
  ''' '''
  camera = cameraListDropdown.getValue()  
  focalLength = pm.getAttr(camera+'.focalLength')
  nearClip = pm.getAttr(camera+'.nearClipPlane')
  farClip = pm.getAttr(camera+'.farClipPlane')
  overscan = pm.getAttr(camera+'.overscan')
  bkgdColor = pm.displayRGBColor('background', query=True)
  topColor = pm.displayRGBColor('backgroundTop', query=True)
  bottomColor = pm.displayRGBColor('backgroundBottom', query=True)
  
  pm.floatField(prefix+'_floatField_focal_length', edit=True, value=focalLength)
  pm.floatField(prefix+'_floatField_near_clip_plane', edit=True, value=nearClip)
  pm.floatField(prefix+'_floatField_far_clip_plane', edit=True, value=farClip)
  pm.floatField(prefix+'_floatField_overscan', edit=True, value=overscan)
  pm.colorSliderGrp(prefix+'_colorSliderGrp_background_color', edit=True, rgb=bkgdColor )
  pm.colorSliderGrp(prefix+'_colorSliderGrp_gradient_top', edit=True, rgb=topColor )
  pm.colorSliderGrp(prefix+'_colorSliderGrp_gradient_bottom', edit=True, rgb=bottomColor )
Exemple #6
0
def get_camera_attrs(ui_elements):
    ''''''
    camera = lcCamera.Camera.get_current_camera()
    focal = ui_elements[0]
    near = ui_elements[1]
    far = ui_elements[2]
    overscan = ui_elements[3]
    background = ui_elements[4]
    top = ui_elements[5]
    bottom = ui_elements[6]

    focal.setValue(camera.focalLength.get())
    near.setValue(camera.nearClipPlane.get())
    far.setValue(camera.farClipPlane.get())
    overscan.setValue(camera.overscan.get())
    background.setRgbValue(pm.displayRGBColor('background', q=True))
    top.setRgbValue(pm.displayRGBColor('backgroundTop', q=True))
    bottom.setRgbValue(pm.displayRGBColor('backgroundBottom', q=True))
Exemple #7
0
def set_camera_attrs(ui_elements):
    ''''''
    camera = lcCamera.Camera.get_current_camera()
    focal = ui_elements[0]
    near = ui_elements[1]
    far = ui_elements[2]
    overscan = ui_elements[3]
    background = ui_elements[4]
    top = ui_elements[5]
    bottom = ui_elements[6]

    background_rgb = background.getRgbValue()
    top_rgb = top.getRgbValue()
    bottom_rgb = bottom.getRgbValue()

    camera.focalLength.set(focal.getValue())
    camera.nearClipPlane.set(near.getValue())
    camera.farClipPlane.set(far.getValue())
    camera.overscan.set(overscan.getValue())
    camera.backgroundColor.set(background_rgb)

    pm.displayRGBColor('background', background_rgb[0], background_rgb[1],
                       background_rgb[2])
    pm.displayRGBColor('backgroundTop', top_rgb[0], top_rgb[1], top_rgb[2])
    pm.displayRGBColor('backgroundBottom', bottom_rgb[0], bottom_rgb[1],
                       bottom_rgb[2])
 def pop(self):
     """ Pop the render layer to remove display in the scene. """
     # Set back tot he old render layer
     pm.editRenderLayerGlobals(currentRenderLayer=self.old_render_layer)
     editor = pm.modelEditor(self.playblast_panel, edit=True,
                            displayTextures=True)
     # Reset the background colors
     pm.displayRGBColor("background", *self.old_bkg_color)
     pm.displayRGBColor("backgroundTop", *self.old_bkg_top_color)
     pm.displayRGBColor("backgroundBottom", *self.old_bkg_bottom_color)
     # Change the attributes on the meshes
     for obj in self.meshes_with_color:
         obj.setAttr('displayColors', 1)
     self.handle_gpu_mesh(1)
     self.pop_namespace_materials()
Exemple #9
0
 def pop(self):
     """ Pop the render layer to remove display in the scene. """
     # Set back tot he old render layer
     pm.editRenderLayerGlobals(currentRenderLayer=self.old_render_layer)
     editor = pm.modelEditor(self.playblast_panel,
                             edit=True,
                             displayTextures=True)
     # Reset the background colors
     pm.displayRGBColor("background", *self.old_bkg_color)
     pm.displayRGBColor("backgroundTop", *self.old_bkg_top_color)
     pm.displayRGBColor("backgroundBottom", *self.old_bkg_bottom_color)
     # Change the attributes on the meshes
     for obj in self.meshes_with_color:
         obj.setAttr('displayColors', 1)
     self.handle_gpu_mesh(1)
     self.pop_namespace_materials()
 def push(self):
     """ Push the render layer to display in the scene. """
     self.old_render_layer = pm.editRenderLayerGlobals(query=True,
                                     currentRenderLayer=True)
     editor = pm.modelEditor(self.playblast_panel, edit=True,
                            displayTextures=False, displayAppearance='smoothShaded')
     # pm.modelEditor(editor, edit=True, displayTextures=False)
     pm.editRenderLayerGlobals(currentRenderLayer=self.layer.name())
     # pm.modelEditor('modelPanel4', query=True, displayTextures=False)
     # Change the background color
     pm.displayRGBColor("background", 0, 0, 0)
     pm.displayRGBColor("backgroundTop", 0, 0, 0)
     pm.displayRGBColor("backgroundBottom", 0, 0, 0)
     self.get_meshes_with_color()
     for obj in self.meshes_with_color:
         obj.setAttr('displayColors', 0)
     self.handle_gpu_mesh(0)
     self.push_namespace_materials()
Exemple #11
0
def colorWireWindow():
    """Color the wireframe of objects."""
    userColors = []

    for i in range( 1, 9 ):
        userColors.append( pm.displayRGBColor( 'userDefined%i' % i, query=True ) )

    if pm.window( 'colorWireWindow', exists=True ):
        pm.deleteUI( 'colorWireWindow' )

    win = pm.window( 'colorWireWindow', title="Color", sizeable=False, resizeToFitChildren=True, toolbox=True )

    pm.columnLayout( adjustableColumn=True )
    pm.frameLayout( borderStyle="etchedOut", labelVisible=False, marginWidth=2, marginHeight=2 )

    pm.columnLayout( adjustableColumn=True, rowSpacing=2 )
    i = 1
    for userColor in userColors:
        pm.button( backgroundColor=userColor, command='color(userDefined=%i)' % i, label='' )
        i += 1

    pm.button( label='Default', command='color()' )

    win.show()
Exemple #12
0
 def push(self):
     """ Push the render layer to display in the scene. """
     self.old_render_layer = pm.editRenderLayerGlobals(
         query=True, currentRenderLayer=True)
     editor = pm.modelEditor(self.playblast_panel,
                             edit=True,
                             displayTextures=False,
                             displayAppearance='smoothShaded')
     # pm.modelEditor(editor, edit=True, displayTextures=False)
     pm.editRenderLayerGlobals(currentRenderLayer=self.layer.name())
     # pm.modelEditor('modelPanel4', query=True, displayTextures=False)
     # Change the background color
     pm.displayRGBColor("background", 0, 0, 0)
     pm.displayRGBColor("backgroundTop", 0, 0, 0)
     pm.displayRGBColor("backgroundBottom", 0, 0, 0)
     self.get_meshes_with_color()
     for obj in self.meshes_with_color:
         obj.setAttr('displayColors', 0)
     self.handle_gpu_mesh(0)
     self.push_namespace_materials()
def main():
	prefRun()
	
	renderWidth = pm.getAttr("defaultResolution.width")
	renderHeight = pm.getAttr("defaultResolution.height")
	
	current_selection = pm.selected()
	currentState = toggleSpeakers(1)
	
	
	#toggle display color
	pm.displayRGBColor("background", 0.0, 0.0, 0.0)
	
	#get current camera
	activeView = pm.playblast(activeEditor=1)
	activeCamera = pm.modelEditor(activeView, q=1, camera=1).name()
	
	camNameParts = activeCamera.split("_") 
	
	pbVersion =""
	for camNamePart in camNameParts:
		if camNamePart[0] == "v":
			pbVersion = camNamePart
			
			
	startTime = int(camNameParts[-2])
	endTime = int(camNameParts[-1])
	
	setTimeline()
	
	pm.select(cl=1)
	
	pathWithVersion = "X:/Projects/GREY11_ANM71_Rewe_Starzone/GR11A71_Shots/GR11A71_Animatic/Animatic_Maya/data/%s/" % pbVersion
	playblastPath = pathWithVersion+activeCamera
	
	
	#make playblast
	pm.playblast(
		filename = playblastPath,
		format = "movie",
		width = renderWidth,
		height = renderHeight,
		percent = 100,
		compression = "none",
		quality = 100,
		forceOverwrite = 1,
		offScreen = 1,
		framePadding = 4,
		startTime = startTime,
		endTime = endTime,
		showOrnaments=0
	)
	
	
	
	pm.displayRGBColor("background", 0.632, 0.632, 0.632)
	
	
	pm.select(current_selection, r=1)
	
	toggleSpeakers(currentState)
    def process(self, instance, context):
        self.log.info("Extracting capture..")

        camera = instance[0]

        current_min_time = cmds.playbackOptions(minTime=True, query=True)
        current_max_time = cmds.playbackOptions(maxTime=True, query=True)

        default_width = cmds.getAttr("defaultResolution.width")
        default_height = cmds.getAttr("defaultResolution.height")

        width = instance.data('width') or default_width
        height = instance.data('height') or default_height
        start_frame = instance.data('startFrame') or current_min_time
        end_frame = instance.data('endFrame') or current_max_time

        format = instance.data('format') or 'qt'
        compression = instance.data('compression') or 'h264'
        off_screen = instance.data('offScreen', False)
        maintain_aspect_ratio = instance.data('maintainAspectRatio', True)

        cam_opts = capture.CameraOptions()

        # Set viewport settings
        view_opts = capture.ViewportOptions()
        view_opts.displayAppearance = "smoothShaded"
        view_opts.dtx = True
        view_opts.grid = False

        # Set display settings

        display_options = capture.DisplayOptions()
        display_options.background = pm.displayRGBColor('background', q=True)
        display_options.backgroundTop = pm.displayRGBColor('backgroundTop', q=True)
        display_options.backgroundBottom = pm.displayRGBColor('backgroundBottom', q=True)
        display_options.displayGradient = pm.displayPref(dgr=True, q=True)


        if 'show' in instance.data():
            for nodetype in instance.data('show').split():
                self.log.info("Overriding show: %s" % nodetype)
                if hasattr(view_opts, nodetype):
                    setattr(view_opts, nodetype, True)
                else:
                    self.log.warning("Specified node-type in 'show' not "
                                     "recognised: %s" % nodetype)
        else:
            view_opts.polymeshes = True
            view_opts.nurbsSurfaces = True


        # Ensure name of camera is valid
        sourcePath = os.path.normpath(context.data('currentFile'))
        path, extension = os.path.splitext(sourcePath)


        if format == 'image':
            # Append sub-directory for image-sequence
            path = os.path.join(path, camera)
        else:
            path = (path + ".mov")

        self.log.info("Outputting to %s" % path)

        with maintained_time():
            output = capture.capture(
                camera=camera,
                width=width,
                height=height,
                filename=path,
                start_frame=start_frame,
                end_frame=end_frame,
                format=format,
                viewer=False,
                compression=compression,
                off_screen=off_screen,
                maintain_aspect_ratio=maintain_aspect_ratio,
                viewport_options=view_opts,
                camera_options=cam_opts,
                overwrite=True,
                quality=50,
                display_options=display_options,
                )


        components = instance.data('ftrackComponents')
        components['preview']['path'] = path

        instance.set_data("outputPath", output)
Exemple #15
0
def makeBluescreen(value, renderers):
    '''
    if value is absent, then we store the default background color into value, return it, and change
    the background to blue screen.
    if the value is valid, then we simply assign the value to the background
    '''
    if not value:
        # store the default value
        for color in pm.displayRGBColor(list=True):
            if color.startswith('backgroundTop'):
                value.update( {'backgroundTop':[float(c) for c in color.strip().split(' ')[1:]]} )
            if color.startswith('backgroundBottom'):
                value.update( {'backgroundBottom':[float(c) for c in color.strip().split(' ')[1:]]} )
        value.update( {'displayGradient':pm.displayPref(query=True, displayGradient=True)} )
        # set background
        pm.displayPref(displayGradient=True)
        if renderers=='vp2Renderer':
            pm.displayRGBColor('backgroundTop', 0, 0, 0)
            pm.displayRGBColor('backgroundBottom', 0, 0, 0)
        else:
            pm.displayRGBColor('backgroundTop', 0, 0, 1)
            pm.displayRGBColor('backgroundBottom', 0, 0, 1)
        return value
    else:
        pm.displayPref(displayGradient=value['displayGradient'])
        pm.displayRGBColor('backgroundTop', value['backgroundTop'][0], value['backgroundTop'][1], value['backgroundTop'][2])
        pm.displayRGBColor('backgroundBottom', value['backgroundBottom'][0], value['backgroundBottom'][1], value['backgroundBottom'][2])