Example #1
0
 def openReference(self):
     self.ref = pm.fileDialog()
     if self.openButtons.getSelect() == 2:
         pm.util.shellOutput(r"open -a Adobe\ Photoshop\ CS4 %s " % self.ref)
         
     if self.openButtons.getSelect() == 1:
         pm.util.shellOutput(r"open  %s " % self.ref)
Example #2
0
    def openReference(self):
        self.ref = pm.fileDialog()
        if self.openButtons.getSelect() == 2:
            pm.util.shellOutput(r"open -a Adobe\ Photoshop\ CS4 %s " %
                                self.ref)

        if self.openButtons.getSelect() == 1:
            pm.util.shellOutput(r"open  %s " % self.ref)
Example #3
0
 def addImage(self, field):
     self.file = pm.fileDialog()
     self.newFile = os.path.basename(self.file)
     pm.textFieldButtonGrp('%s' % field,
                           edit=True,
                           text='%s' % self.newFile)
     self.imageList.append(self.file)
     self.nameList.append(self.newFile)
 def select_py_ui(self, *args):
     mask = "*.py"
     if self.py_path:
         mask = os.path.join(os.path.dirname(self.py_path), mask)
     else:
         mask = os.path.join(sys.path[-1], mask)
     
     temp = pmc.fileDialog(directoryMask=mask)
     if temp:
         self.set_py(temp, force=True)
Example #5
0
def GetFilePathFromUser(isReadOnly, initialFolderPath=None, fileExtensionMask=None):
    """
    Queries user for a file path with a dialogue box and returns the result. 
    
    :param isReadOnly: True = we are opening a file, False = we want a location to save a file.  
    :param initialFolderPath: full path for starting point, or None for default. 
    :param fileExtensionMask: filter for file extension (e.g. ".zip"), or None for no filter. 
    """
    kwargs = { "mode" :  0 if(isReadOnly) else 1 }
    
    if(initialFolderPath is not None):
        mask = initialFolderPath + '*'
        if(fileExtensionMask is not None):
            mask += fileExtensionMask
        kwargs["directoryMask"] = mask
    elif(fileExtensionMask is not None):
        kwargs["directoryMask"] = "*" + fileExtensionMask
        
    return pm.fileDialog(**kwargs)
    def loadLibrary(self):
        """ FOR INK: open file"""

        # GET THE PATH TO THE PICKLE TO LOAD
        pickleLibPath = pm.fileDialog()
        _logger.debug("LOADING : %s" % pickleLibPath)

        # TEMP HOLDER FOR DATA
        controllers = None

        # IF THERE WAS A PATH TRY AN LOAD IT UP
        if pickleLibPath:
            controllers = pickle.load(open(pickleLibPath, "rb"))

        # UPDATING CONTROLLERS
        if controllers:
            if controllers.keys():
                _logger.debug("replacing self.controllers with pickle data")
                self.controllers = controllers
Example #7
0
def attachToBody():
    '''
    Connect a head to a body. Run inside the body rig.
    
    Example:
        import sys
        path = '/Users/3mo/Documents/repos/artpipeline/maya/RigBuilder/modules'
        if path not in sys.path:
            sys.path.insert(0, path)
        
        import Head as head
        reload( head )
        
        head.attachToBody()
    '''
    # Get head rig file from user, Import file
    try:
        pm.importFile( pm.fileDialog(t='Select Head Rig file') )
    except Exception,e:
        raise Exception(e)
Example #8
0
def create_3dequalizer_points(width, height):
    """creates 3d equalizer points under the selected camera

    :param width: The width of the plate
    :param height: The height of the plate
    """
    width = float(width)
    height = float(height)

    # get the text file
    path = pm.fileDialog()

    # parse the file
    from anima import utils
    man = utils.C3DEqualizerPointManager()
    man.read(path)

    # get the camera
    cam_shape = get_selected_camera()

    pm.getAttr("defaultResolution.deviceAspectRatio")
    pm.getAttr("defaultResolution.pixelAspect")

    frustum_curve = create_frustum_curve(cam_shape)

    for point in man.points:
        # create a locator
        loc = create_camera_space_locator(frustum_curve)
        loc.rename('p%s' % point.name)

        # animate the locator
        for frame in point.data.keys():
            pm.currentTime(frame)
            frame_data = point.data[frame]
            local_x = frame_data[0] / width - 0.5
            local_y = frame_data[1] / width - 0.5 * height / width
            loc.tx.set(local_x)
            loc.ty.set(local_y)
            loc.tx.setKey()
            loc.ty.setKey()
Example #9
0
def create_3dequalizer_points(width, height):
    """creates 3d equalizer points under the selected camera

    :param width: The width of the plate
    :param height: The height of the plate
    """
    width = float(width)
    height = float(height)

    # get the text file
    path = pm.fileDialog()

    # parse the file
    from anima import utils
    man = utils.C3DEqualizerPointManager()
    man.read(path)

    # get the camera
    cam_shape = get_selected_camera()

    pm.getAttr("defaultResolution.deviceAspectRatio")
    pm.getAttr("defaultResolution.pixelAspect")

    frustum_curve = create_frustum_curve(cam_shape)

    for point in man.points:
        # create a locator
        loc = create_camera_space_locator(frustum_curve)
        loc.rename('p%s' % point.name)

        # animate the locator
        for frame in point.data.keys():
            pm.currentTime(frame)
            frame_data = point.data[frame]
            local_x = frame_data[0] / width - 0.5
            local_y = frame_data[1] / width - 0.5 * height / width
            loc.tx.set(local_x)
            loc.ty.set(local_y)
            loc.tx.setKey()
            loc.ty.setKey()
Example #10
0
def _importFile():
    ''' Import a maya scene into the current scene using UI dialog'''
    try:
        pm.importFile(pm.fileDialog())
    except Exception, e:
        raise Exception(e)
Example #11
0
 def importFile(self):
     ''' Import a maya scene into the current scene using UI dialog'''
     try:
         pm.importFile( pm.fileDialog() )
     except Exception,e:
         raise Exception(e)
Example #12
0
 def addImage(self, field):
     self.file = pm.fileDialog()
     self.newFile = os.path.basename(self.file)
     pm.textFieldButtonGrp('%s' % field, edit = True, text = '%s' % self.newFile )
     self.imageList.append(self.file)
     self.nameList.append(self.newFile)
Example #13
0
 def get_file(self, title=None, *args):  # file paths. list[str, ...]
     '''Prompt user for a file
     '''
     return pm.fileDialog(t=title, dm='*.txt')
Example #14
0
 def get_file(self, title=None, *args):  # file paths. list[str, ...]
     """Prompt user for a file
     """
     return pm.fileDialog(t=title, dm="*.txt")
	def setPluginPath(self):
		path = pm.fileDialog(dm='*.mll')
		self.mainObject.pluginPath = path
		print self.mainObject.pluginPath
		self.mainObject.savePluginFile()