def setPosition(self, p): #print "setting position ", p #oldPos = Piavca.Vec()#self.cvm.getVecValueAtTime(self.jointId, 0) if not hasattr(self, "lastShiftTime"): self.lastShiftTime = 0.0 if hasattr(self, "oldPos"): diff = p - self.oldPos #print diff.mag() if abs(diff.mag()) > 0.01: #if not self.alreadyShifted: if (Piavca.getTime() - self.lastShiftTime) > self.interShiftTime: #self.alreadyShifted = True self.getMotion().reset() #self.shiftedlast == False self.lastShiftTime = Piavca.getTime() #else: # self.alreadyShifted = False self.oldPos = p
def getTime(self): return Piavca.getTime()
if len(sys.argv) > 2: motion_name = sys.argv[2] else: motnames = Piavca.Core.getCore().getMotionNames() print motnames dialog_return = singleChoiceDialog (lst=["None"]+motnames) motion_name = dialog_return.selection mot = Piavca.Core.getCore().getMotion(str(motion_name)) if mot != None: mot.Reference() avatar.play_motion(Piavca.LoopMotion(mot)) avatar.play_motion(mot) avatar.showMotionAtTime(Piavca.getTime()) print "loaded motion" #if len(sys.argv) > 1: # path = sys.argv[1] #else: # dialog_return = openFileDialog () # path = dialog_return.paths[0] #dirname = os.path.dirname(path) #os.chdir(dirname) #(splitext, ext) = os.path.splitext(path) #basename = os.path.basename(splitext)
def getTime(self): return Piavca.getTime()
if len(sys.argv) > 2: motion_name = sys.argv[2] else: motnames = Piavca.Core.getCore().getMotionNames() print motnames dialog_return = singleChoiceDialog(lst=["None"] + motnames) motion_name = dialog_return.selection mot = Piavca.Core.getCore().getMotion(str(motion_name)) if mot != None: mot.Reference() avatar.play_motion(Piavca.LoopMotion(mot)) avatar.play_motion(mot) avatar.showMotionAtTime(Piavca.getTime()) print "loaded motion" app.getCanvas().setAvatar(avatar) app.getCanvas().initCameraPosition() app.getCanvas().setClearColour(1.0, 1.0, 1.0) #app = MyApp() #import Piavca.redirect #Piavca.redirect.redirect() print "created app"