def grabFrameFilename(self): n = self.grabFrameNumber() if int(n) <= int(self.xml.getAttribute("frames"))-1: #print stupid.splitjoin(self.xml.getAttribute("folder")+self.xml.getAttribute("prefix")+n.zfill(5)+".jpg") return stupid.splitjoin(self.xml.getAttribute("folder")+self.xml.getAttribute("prefix")+n.zfill(5)+".png") #return the last frame in the clip if we specify freeze = True if self.freeze: n = str(int(self.xml.getAttribute("frames"))-1) return stupid.splitjoin(self.xml.getAttribute("folder")+self.xml.getAttribute("prefix")+n.zfill(5)+".png") return None
def grabFrame(self): #this version does not allow for "freezing" on last frame and requires looping otherwise returns None -> nothing is drawn #todo implement freezing, this should be a either a CLIP property or a GRAPHNODE property that overrides whatever the CLIP property is if self.xml.hasAttribute("suffix"): suffix = self.xml.getAttribute("suffix") else: suffix = ".png" n = self.grabFrameNumber() if int(n) <= int(self.xml.getAttribute("frames"))-1: #print stupid.splitjoin(self.xml.getAttribute("folder")+self.xml.getAttribute("prefix")+n.zfill(5)+".jpg") return glob.wheel.getImage(stupid.splitjoin(self.xml.getAttribute("folder")+self.xml.getAttribute("prefix")+n.zfill(5)+suffix)) #return the last frame in the clip if we specify freeze = True if self.freeze: n = str(int(self.xml.getAttribute("frames"))-1) return glob.wheel.getImage(stupid.splitjoin(self.xml.getAttribute("folder")+self.xml.getAttribute("prefix")+n.zfill(5)+suffix)) return None
def grabFrame(self): """ this version of grab frame asumes the timing information is in the clip xml node and extrapolates image number based on time """ #this version does not allow for "freezing" on last frame and requires looping otherwise returns None -> nothing is drawn #todo implement freezing, this should be a either a CLIP property or a GRAPHNODE property that overrides whatever the CLIP property is n = self.grabFrameNumber() if int(n) <= int(self.xml.getAttribute("frames"))-1: #print stupid.splitjoin(self.xml.getAttribute("folder")+self.xml.getAttribute("prefix")+n.zfill(5)+".jpg") return resource.image(stupid.splitjoin(self.xml.getAttribute("folder")+self.xml.getAttribute("prefix")+n.zfill(5)+".png")) #return the last frame in the clip if we specify freeze = True if self.freeze: n = str(int(self.xml.getAttribute("frames"))-1) return resource.image(stupid.splitjoin(self.xml.getAttribute("folder")+self.xml.getAttribute("prefix")+n.zfill(5)+".png")) return None
def grabFrameOLD(self): """ this version of grabframe assumes that the clip xml node has all its images listed with their respective times. Use this version if you want to have a non constant speed animation. """ #TODO you should really make at least a local dict of image names to map becaus ethis loads the same image multiple times... #print self.xml,"frame","number",self.grabFrameNumber() framexml = utils.getChildWithAttribute(self.xml,"frame","number",self.grabFrameNumber()) if framexml: return resource.image(stupid.splitjoin(framexml.getAttribute("folder")+framexml.getAttribute("filename"))) else: return None
def loadImage(self,filename): if filename not in self.iMap: #self.iMap[filename] = resource.image(filename) try: self.iMap[filename] = image.load(stupid.splitjoin(filename)) except: print "FAIL"