Exemplo n.º 1
0
 def __createnodeasdf__(self, nodeType, name):
     '''
     :param nodeType: type of node to create
     :param name: name of the new node
     '''
     _str_func = 'cgmLight.__createnode__'        
     
     #Trying to use the light shape as the metaClass caused all sorts of issues. Best just to use the dag
     _light = d_lightCalls.get(nodeType)(name=name)
     _dag = cgmMeta.getTransform(_light)
     ATTR.add(_dag,'mClass','string',value='cgmLight')
     self.__justCreatedState__ = True
     return _dag, True
Exemplo n.º 2
0
 def __init__(self,node=None,name=None,nodeType=None, **kws):
     #>>> TO USE Cached instance ---------------------------------------------------------
     _str_func = 'cgmLight.__init__'        
     if node is None:
         if nodeType not in d_lightCalls.keys():
             raise ValueError,"Unknown light node: {0}".format(nodeType)
         if name is None:
             name = nodeType
         _light = d_lightCalls.get(nodeType)(name=name)
         _dag = cgmMeta.getTransform(_light)
         ATTR.add(_dag,'mClass','string',value='cgmLight',lock=True)
         self.__justCreatedState__ = True                
         node = _dag
             
     try: super(cgmLight, self).__init__(node,name, **kws)
     except StandardError,error:
         raise StandardError, "cgmLight.__init__ fail! | %s"%error
Exemplo n.º 3
0
    def __init__(self,
                 mode = 'surface',
                 mesh = None,
                 create = False,
                 closestOnly = True,
                 clampIntersections = False,
                 dragStore = False,
                 maxStore = False,
                 posOffset = None,
                 clampValues = [None,None,None],
                 offsetMode = 'normal',
                 orientSnap = True,
                 timeDelay = None,
                 tagAndName = {},
                 toCreate = [],
                 toSnap = [],#...objects to snap on release
                 *a,**kws):

        _str_funcName = 'clickMesh.__init__'
        log.info(">>> %s >> "%_str_funcName + "="*75)     	
        #>>> Store our info ====================================================================
        self._createModes = ['locator','joint','jointChain','curve','follicle','group',False]
        self._l_modes = _clickMesh_modes
        self.l_mesh = []
        self.d_meshPos = {} #creating this pretty much just for follicle mode so we can attache to a specific mesh
        self.d_meshUV = {}
        self.f_meshArea = 1
        self.l_toSnap = cgmValid.listArg(toSnap)
        self._createMode = create
        self._getUV = False
        self._time_start = time.clock()
        self._time_delayCheck = timeDelay

        if self._createMode == 'follicle':#Only get uv intersection for follicles
            self._getUV = True

        self.b_closestOnly = closestOnly
        self.l_created = []
        self.b_clampSetting = clampIntersections
        self.b_dragStoreMode = dragStore
        self.l_return = []
        self.d_tagAndName = tagAndName
        self._posBuffer = False
        self.v_posOffset = posOffset or False    
        self.str_offsetMode = offsetMode
        self.b_orientSnap = orientSnap
        self._createModeBuffer = False
        self.int_maxStore = maxStore
        self.l_toCreate = toCreate
        self.v_clampValues = clampValues
        if toCreate:
            self.int_maxStore = len(toCreate)

        self.setMode(mode)
               
        ContextualPick.__init__(self, drag = True, space = 'screen',projection = 'viewPlane', *a,**kws )

        if mesh is None:
            log.info("Using all visible mesh!")
            for l in mc.ls(type='mesh',visible = True), mc.ls(type='nurbsSurface',visible = True):
                for o in l:
                    self.addTargetMesh( cgmMeta.getTransform(o))             
        if mesh is not None:
            assert type(mesh) is list,"Mesh call must be in list form when called"
            for m in mesh:
                self.addTargetMesh(m)    
        self.updateMeshArea()