Esempio n. 1
0
    def doConnectIn(self, source, *a, **kw):
        """ 
        Attempts to make a connection from a source to our instanced attribute
        
        Keyword arguments:
        source(string) - object or attribute to connect to
        *a, **kw
        """
        assert mc.objExists(source), "'%s' doesn't exist" % source

        if '.' in source:
            try:
                attributes.doConnectAttr(source, self.nameCombined)
            except:
                guiFactory.warning("'%s' failed to connect to '%s'!" %
                                   (source, self.nameCombined))

        else:
            #If the object has a transform
            matchAttr = attributes.returnMatchNameAttrsDict(
                self.obj.nameShort, source, [self.nameLong]) or []
            if matchAttr:
                #If it has a matching attribute
                try:
                    attributes.doConnectAttr(
                        ('%s.%s' % (source, matchAttr.get(self.nameLong))),
                        self.nameCombined)
                except:
                    guiFactory.warning("'%s' failed to connect to '%s'!" %
                                       (source, self.nameCombined))
            else:
                print "Source object doesn't have this particular attribute"
Esempio n. 2
0
 def doConnectIn(self,source,*a, **kw):
     """ 
     Attempts to make a connection from a source to our instanced attribute
     
     Keyword arguments:
     source(string) - object or attribute to connect to
     *a, **kw
     """ 
     assert mc.objExists(source),"'%s' doesn't exist"%source
            
     if '.' in source:           
         try:
             attributes.doConnectAttr(source,self.nameCombined)
         except:
             guiFactory.warning("'%s' failed to connect to '%s'!"%(source,self.nameCombined))  
             
     else:
         #If the object has a transform
         matchAttr = attributes.returnMatchNameAttrsDict(self.obj.nameShort,source,[self.nameLong]) or []
         if matchAttr:
             #If it has a matching attribute
             try:
                 attributes.doConnectAttr(('%s.%s'%(source,matchAttr.get(self.nameLong))),self.nameCombined)
             except:
                 guiFactory.warning("'%s' failed to connect to '%s'!"%(source,self.nameCombined))
         else:
             print "Source object doesn't have this particular attribute"
Esempio n. 3
0
    def doConnectOut(self, target, *a, **kw):
        """ 
        Attempts to make a connection from instanced attribute to a target
        
        Keyword arguments:
        target(string) - object or attribute to connect to
        *a, **kw
        """
        assert mc.objExists(target), "'%s' doesn't exist" % target

        if '.' in target:
            try:
                attributes.doConnectAttr(self.nameCombined, target)
            except:
                guiFactory.warning("'%s' failed to connect to '%s'!" %
                                   (self.nameCombined, target))

        else:
            #If the object has a transform
            matchAttr = attributes.returnMatchNameAttrsDict(
                self.obj.nameShort, target, [self.nameLong]) or []
            if matchAttr:
                #If it has a matching attribute
                try:
                    attributes.doConnectAttr(
                        self.nameCombined,
                        ('%s.%s' % (target, matchAttr.get(self.nameLong))))
                except:
                    guiFactory.warning("'%s' failed to connect to '%s'!" %
                                       (self.nameCombined, target))
            else:
                print "Target object doesn't have this particular attribute"
Esempio n. 4
0
 def doConnectOut(self,target,*a, **kw):
     """ 
     Attempts to make a connection from instanced attribute to a target
     
     Keyword arguments:
     target(string) - object or attribute to connect to
     *a, **kw
     """ 
     assert mc.objExists(target),"'%s' doesn't exist"%target
     
     if '.' in target:           
         try:
             attributes.doConnectAttr(self.nameCombined,target)
         except:
             guiFactory.warning("'%s' failed to connect to '%s'!"%(self.nameCombined,target))  
             
     else:
         #If the object has a transform
         matchAttr = attributes.returnMatchNameAttrsDict(self.obj.nameShort,target,[self.nameLong]) or []
         if matchAttr:
             #If it has a matching attribute
             try:
                 attributes.doConnectAttr(self.nameCombined,('%s.%s'%(target,matchAttr.get(self.nameLong))))
             except:
                 guiFactory.warning("'%s' failed to connect to '%s'!"%(self.nameCombined,target))
         else:
             print "Target object doesn't have this particular attribute"