'Shift + Control + p' invokes a pop up for the number of the frame the playhead will be set to. There also appears an entry 'Set current frame' in the view menus of the Sequencer, Graph Editor and Timeline Editor.
'Shift + Control + p' öffnet ein Popup für die Nummer des Frames auf die die Abspielposition gesetzt werden soll. Ebenso erscheint Menüeintrag 'Set current frame' im View Menü des Sequencers, Graph Editors und Timeline Editors.
bl_info = { "name": "Set Current Frame", "description": "Dialogbox to set the number of the current frame", "author": "Lothar Rosengarten", "version": (1, 0), "blender": (3, 0, 0), "location": "Window", "category": "Animation", } import bpy #Fehlermeldungsbox def oops(self, context): self.layout.label() # set current frame v1 class SetCurrentFrame(bpy.types.Operator): """lot Set current frame""" # Use this as a tooltip for menu items and buttons. bl_idname = "wm.setcurrrentframe" # Unique identifier for buttons and menu items to reference. bl_label = "Set current frame" # Display name in the interface. bl_options = {'REGISTER', 'UNDO'} # Enable undo for the operator. bl_property = "current_frame" # sorgt für den Fokus auf die so benannte Property, !leider nur bei StringsProporty! current_frame: bpy.props.StringProperty( name= "Frame:", description= "Start here", default = '500', ) def execute(self, context): # execute() is called after running invoke try: b = int(int(self.current_frame)) except (TypeError, ValueError): bpy.context.window_manager.popup_menu(oops, title="Framenumber has to be an Integer!", icon='ERROR') return {'CANCELLED'} else: bpy.context.scene.frame_set(b) return {'FINISHED'} # Lets Blender know the operator finished successfully. #end execute def invoke(self, context, event): # invoke() is called when running the operator. return context.window_manager.invoke_props_dialog(self) #end invoke #end SetCurrentFrame def menu_func(self, context): self.layout.operator(SetCurrentFrame.bl_idname) # store keymaps here to access after registration addon_keymaps = [] def register(): bpy.types.SEQUENCER_MT_view.append(menu_func) # Adds the operator to the view menu of the Sequencer bpy.types.TIME_MT_view.append(menu_func) # Adds the operator to the view menu of the view menu of the timeline editor bpy.types.GRAPH_MT_view.append(menu_func) # Adds the operator to the view menu of the view menu of the graph editor # handle the keymap wm = bpy.context.window_manager km = wm.keyconfigs.addon.keymaps.new(name='Window', space_type='EMPTY', region_type='WINDOW') # name + region_type 'WINDOW' sorgt dafür daß es überall geht kmi = km.keymap_items.new(SetCurrentFrame.bl_idname, 'P', 'PRESS', ctrl=True, shift=True) addon_keymaps.append((km, kmi)) def unregister(): bpy.utils.unregister_class(SetCurrentFrame) # handle the keymap for km, kmi in addon_keymaps: km.keymap_items.remove(kmi) addon_keymaps.clear() # This allows you to run the script directly from Blender's Text editor # to test the add-on without having to install it. if __name__ == "__main__": register()
computer.lothar-rosengarten.de/blender/setplayheadtoframe.html – 2022-06-03 |
Wer mich in meinem Tun unterstützen will kann gern vorm Bildschirm beifällig mit dem Kopf nicken oder: |
Kontakt |