def save(self): if len(self.text_input.value) > 0: if ((self.animation.name == "") or (self.animation.name != self.text_input.value)): self.animation.name = self.text_input.value if self.animation_type == None: animationexplorer.save_animation(self.text_input.value, \ self.animation) else: actionwizard.save_animation(self.animation_type, self.animation) self.animation_saved = True
def save_animation_without_overwrite(animation_type, animation): #save the moveset if a moveset with its name doesn't already exist. If it does exist find a name that has yet to be saved by appending '(#)' where # is a number. existing_animation = actionwizard.get_animation(animation_type, animation.name) if existing_animation == None: actionwizard.save_animation(animation_type, animation) else: name_counter = 1 name = animation.name while existing_animation != None: name_counter += 1 animation.name = name + "(" + str(name_counter) + ")" existing_animation = actionwizard.get_animation(animation_type, animation.name) actionwizard.save_animation(animation_type, animation)