def finalize(self): log.debug("returnList: %s"% self.returnList) log.debug("createdList: %s"% self.createdList) buffer = [] #self.i_module.templateNull.templateStarterData log.debug("starting data: %s"% buffer) #Make sure we have enough points #============== handles = self.i_module.templateNull.handles if len(self.returnList) < handles: log.warning("Creating curve to get enough points") curve = curves.curveFromPosList(self.returnList) mc.rebuildCurve (curve, ch=0, rpo=1, rt=0, end=1, kr=0, kcp=0, kep=1, kt=0,s=(handles-1), d=1, tol=0.001) self.returnList = curves.returnCVsPosList(curve)#Get the pos of the cv's mc.delete(curve) #Store info #============== for i,p in enumerate(self.returnList): buffer.append(p)#need to ensure it's storing properly #log.info('[%s,%s]'%(buffer[i],p)) #Store locs #============== log.debug("finish data: %s"% buffer) self.templateNull.__setattr__('templateStarterData',buffer,lock=True) #self.i_module.templateNull.templateStarterData = buffer#store it log.info("'%s' sized!"%self.i_module.getShortName()) dragFactory.clickMesh.finalize(self)
def finalize(self): log.debug("returnList: %s" % self.returnList) log.debug("createdList: %s" % self.createdList) buffer = [] #self.i_module.templateNull.templateStarterData log.debug("starting data: %s" % buffer) #Make sure we have enough points #============== handles = self.i_module.templateNull.handles if len(self.returnList) < handles: log.warning("Creating curve to get enough points") curve = curves.curveFromPosList(self.returnList) mc.rebuildCurve(curve, ch=0, rpo=1, rt=0, end=1, kr=0, kcp=0, kep=1, kt=0, s=(handles - 1), d=1, tol=0.001) self.returnList = curves.returnCVsPosList( curve) #Get the pos of the cv's mc.delete(curve) #Store info #============== for i, p in enumerate(self.returnList): buffer.append(p) #need to ensure it's storing properly #log.info('[%s,%s]'%(buffer[i],p)) #Store locs #============== log.debug("finish data: %s" % buffer) self.templateNull.__setattr__('templateStarterData', buffer, lock=True) #self.i_module.templateNull.templateStarterData = buffer#store it log.info("'%s' sized!" % self.i_module.getShortName()) dragFactory.clickMesh.finalize(self)
def doSize(self,sizeMode='normal',geo = [],posList = [],*args,**kws): """ Size a module 1) Determine what points we need to gather 2) Initiate draggerContextFactory 3) Prompt user per point 4) at the end of the day have a pos list the length of the handle list @ sizeMode 'all' - pick every handle position 'normal' - first/last, if child, will use last position of parent as first 'manual' - provide a pos list to size from TODO: Add option for other modes Add geo argument that can be passed for speed Add clamp on value Add a way to pull size info from a mirror module """ log.debug(">>> doSize") clickMode = {"heel":"surface"} #Gather info #============== handles = self.templateNull.handles if len(self.i_coreNames.value) == handles: names = self.i_coreNames.value else: log.warning("Not enough names. Generating") names = getGeneratedCoreNames(self) if not geo: geo = self.modulePuppet.getGeo() log.debug("Handles: %s"%handles) log.debug("Names: %s"%names) log.debug("Puppet: %s"%self.getMessage('modulePuppet')) log.debug("Geo: %s"%geo) log.debug("sizeMode: %s"%sizeMode) i_module = self #Bridge holder for our module class to go into our sizer class #Variables #============== if sizeMode == 'manual':#To allow for a pos list to be input if not posList: log.error("Must have posList arg with 'manual' sizeMode!") return False if len(posList) < handles: log.warning("Creating curve to get enough points") curve = curves.curveFromPosList(posList) mc.rebuildCurve (curve, ch=0, rpo=1, rt=0, end=1, kr=0, kcp=0, kep=1, kt=0,s=(handles-1), d=1, tol=0.001) posList = curves.returnCVsPosList(curve)#Get the pos of the cv's mc.delete(curve) self.templateNull.__setattr__('templateStarterData',posList,lock=True) log.info("'%s' manually sized!"%self.getShortName()) return True elif sizeMode == 'normal': if names > 1: namesToCreate = names[0],names[-1] else: namesToCreate = names log.debug("Names: %s"%names) else: namesToCreate = names sizeMode = 'all' class moduleSizer(dragFactory.clickMesh): """Sublass to get the functs we need in there""" def __init__(self,i_module = i_module,**kws): log.debug(">>> moduleSizer.__init__") if kws:log.debug("kws: %s"%str(kws)) super(moduleSizer, self).__init__(**kws) self.i_module = i_module log.info("Please place '%s'"%self.toCreate[0]) def release(self): if len(self.returnList)< len(self.toCreate)-1:#If we have a prompt left log.info("Please place '%s'"%self.toCreate[len(self.returnList)+1]) dragFactory.clickMesh.release(self) def finalize(self): log.debug("returnList: %s"% self.returnList) log.debug("createdList: %s"% self.createdList) buffer = [] #self.i_module.templateNull.templateStarterData log.debug("starting data: %s"% buffer) #Make sure we have enough points #============== handles = self.i_module.templateNull.handles if len(self.returnList) < handles: log.warning("Creating curve to get enough points") curve = curves.curveFromPosList(self.returnList) mc.rebuildCurve (curve, ch=0, rpo=1, rt=0, end=1, kr=0, kcp=0, kep=1, kt=0,s=(handles-1), d=1, tol=0.001) self.returnList = curves.returnCVsPosList(curve)#Get the pos of the cv's mc.delete(curve) #Store info #============== for i,p in enumerate(self.returnList): buffer.append(p)#need to ensure it's storing properly #log.info('[%s,%s]'%(buffer[i],p)) #Store locs #============== log.debug("finish data: %s"% buffer) self.templateNull.__setattr__('templateStarterData',buffer,lock=True) #self.i_module.templateNull.templateStarterData = buffer#store it log.info("'%s' sized!"%self.i_module.getShortName()) dragFactory.clickMesh.finalize(self) #Start up our sizer return moduleSizer(mode = 'midPoint', mesh = geo, create = 'locator', toCreate = namesToCreate)
def doSize(self, sizeMode='normal', geo=[], posList=[], *args, **kws): """ Size a module 1) Determine what points we need to gather 2) Initiate draggerContextFactory 3) Prompt user per point 4) at the end of the day have a pos list the length of the handle list @ sizeMode 'all' - pick every handle position 'normal' - first/last, if child, will use last position of parent as first 'manual' - provide a pos list to size from TODO: Add option for other modes Add geo argument that can be passed for speed Add clamp on value Add a way to pull size info from a mirror module """ log.debug(">>> doSize") clickMode = {"heel": "surface"} #Gather info #============== handles = self.templateNull.handles if len(self.i_coreNames.value) == handles: names = self.i_coreNames.value else: log.warning("Not enough names. Generating") names = getGeneratedCoreNames(self) if not geo: geo = self.modulePuppet.getGeo() log.debug("Handles: %s" % handles) log.debug("Names: %s" % names) log.debug("Puppet: %s" % self.getMessage('modulePuppet')) log.debug("Geo: %s" % geo) log.debug("sizeMode: %s" % sizeMode) i_module = self #Bridge holder for our module class to go into our sizer class #Variables #============== if sizeMode == 'manual': #To allow for a pos list to be input if not posList: log.error("Must have posList arg with 'manual' sizeMode!") return False if len(posList) < handles: log.warning("Creating curve to get enough points") curve = curves.curveFromPosList(posList) mc.rebuildCurve(curve, ch=0, rpo=1, rt=0, end=1, kr=0, kcp=0, kep=1, kt=0, s=(handles - 1), d=1, tol=0.001) posList = curves.returnCVsPosList(curve) #Get the pos of the cv's mc.delete(curve) self.templateNull.__setattr__('templateStarterData', posList, lock=True) log.info("'%s' manually sized!" % self.getShortName()) return True elif sizeMode == 'normal': if names > 1: namesToCreate = names[0], names[-1] else: namesToCreate = names log.debug("Names: %s" % names) else: namesToCreate = names sizeMode = 'all' class moduleSizer(dragFactory.clickMesh): """Sublass to get the functs we need in there""" def __init__(self, i_module=i_module, **kws): log.debug(">>> moduleSizer.__init__") if kws: log.debug("kws: %s" % str(kws)) super(moduleSizer, self).__init__(**kws) self.i_module = i_module log.info("Please place '%s'" % self.toCreate[0]) def release(self): if len(self.returnList) < len( self.toCreate) - 1: #If we have a prompt left log.info("Please place '%s'" % self.toCreate[len(self.returnList) + 1]) dragFactory.clickMesh.release(self) def finalize(self): log.debug("returnList: %s" % self.returnList) log.debug("createdList: %s" % self.createdList) buffer = [] #self.i_module.templateNull.templateStarterData log.debug("starting data: %s" % buffer) #Make sure we have enough points #============== handles = self.i_module.templateNull.handles if len(self.returnList) < handles: log.warning("Creating curve to get enough points") curve = curves.curveFromPosList(self.returnList) mc.rebuildCurve(curve, ch=0, rpo=1, rt=0, end=1, kr=0, kcp=0, kep=1, kt=0, s=(handles - 1), d=1, tol=0.001) self.returnList = curves.returnCVsPosList( curve) #Get the pos of the cv's mc.delete(curve) #Store info #============== for i, p in enumerate(self.returnList): buffer.append(p) #need to ensure it's storing properly #log.info('[%s,%s]'%(buffer[i],p)) #Store locs #============== log.debug("finish data: %s" % buffer) self.templateNull.__setattr__('templateStarterData', buffer, lock=True) #self.i_module.templateNull.templateStarterData = buffer#store it log.info("'%s' sized!" % self.i_module.getShortName()) dragFactory.clickMesh.finalize(self) #Start up our sizer return moduleSizer(mode='midPoint', mesh=geo, create='locator', toCreate=namesToCreate)