def generate_audio_menu(self): items = [] for i in range(0, director.app.audio.input_device.nb_input_channels): items.append(ShakeMenuItem("Input %d" % (i+1), self.audio_menu_select_input, i+1)) if len(items) == 0: # Can't create any input, so go back to the default behavior director.app.play_scene.messages.show("No input device in your system.") self.object.attach_behavior(DefaultBehavior.DefaultBehavior()) self.menu = ShakeMenu(self.object, *items, no_shake=True)
def generate_audio_menu(self): items = [] # print samples for sample in self.samples: samplename = os.path.splitext(sample)[0] items.append( ShakeMenuItem(samplename, self.audio_menu_select_sample, "loops/" + sample)) if len(items) == 0: # Can't create any sample, so go back to the default behavior director.app.play_scene.messages.show("No loop in directory.") self.object.attach_behavior(DefaultBehavior.DefaultBehavior()) self.menu = ShakeMenu(self.object, *items, no_shake=True)
def show_menu(self): self.target_mode = False items = [] if not isinstance(self.target.behavior, DefaultBehavior): items.append( ShakeMenuItem( "Detach", self.on_detach_target, description= "Detaches the selected behavior from its object.")) if self.target.behavior.association: items.append( ShakeMenuItem("Un%s" % self.target.behavior.association_name, self.on_unassociate_target, description='')) else: items.append( ShakeMenuItem(self.target.behavior.association_name, self.on_associate_target, self.target, description='')) else: items.append( ShakeMenuItem( "Attach", self.on_attach_target, description="Attaches a behavior to the selected object.")) items.append( ShakeMenuItem( "Inspect", self.on_inspect_target, description="Inspects the attributes of the selected behavior." )) self.menu = ShakeMenu(self.object, *items, no_shake=True, on_cancel=self.menu_cancelled) # Still allow the user to cancel self.menu.no_shake = False