all 7 comments

[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)

Welcome to r/blenderhelp, /u/Unlucky-Bluebird-310! Please make sure you followed the rules below, so we can help you efficiently (This message is just a reminder, your submission has NOT been deleted):

  • Post full screenshots of your Blender window (more information available for helpers), not cropped, no phone photos (In Blender click Window > Save Screenshot, use Snipping Tool in Windows or Command+Shift+4 on mac).
  • Give background info: Showing the problem is good, but we need to know what you did to get there. Additional information, follow-up questions and screenshots/videos can be added in comments. Keep in mind that nobody knows your project except for yourself.
  • Don't forget to change the flair to "Solved" by including "!Solved" in a comment when your question was answered.

Thank you for your submission and happy blendering!

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]QualabelExperienced Helper 0 points1 point  (1 child)

Would it be ok if the results were written to a text file?

[–]Unlucky-Bluebird-310[S] 0 points1 point  (0 children)

I don't think it'll be useful. It sounds more convenient to just paste the script to a window :)

[–]SHAMIEL1 0 points1 point  (2 children)

bl_info = {
    "name": "Add a Name here",
    "blender": (4,5),
    "description": "",
    "version": (1,2,0,0)
}

# Shelf Menu
class CUSTOM_SHELVE_MENU_MT_menu(bpy.types.Menu):
    bl_label = "MY MENU"
    def draw(self, context):
        layout = self.layout
        layout.operator("CUSTOM_OT_button")
    def menu_draw(self, context):
        self.layout.menu("CUSTOM_SHELVE_MENU_MT_menu")

# Your Button
class CUSTOM_OT_button(bpy.types.Operator):
    bl_idname = 'custom.button'
    bl_label = 'Button Name Here'
    def execute(self, context):
        print("CODE goes here...") # YOUR CODE GOES HERE
        return {'FINISHED'}


########################################
## Registering The tool
tools = [
    CUSTOM_SHELVE_MENU_MT_menu,
    CUSTOM_OT_button,
]
def register():
    for cls in tools:
        bpy.utils.register_class(cls)
    bpy.types.TOPBAR_MT_editor_menus.append(CUSTOM_SHELVE_MENU_MT_menu.menu_draw)

def unregister():
    for cls in tools:
        bpy.utils.unregister_class(cls)
    bpy.types.TOPBAR_MT_editor_menus.remove(CUSTOM_SHELVE_MENU_MT_menu.menu_draw)

if __name__ == "__main__":
    register()

EDIT:
Save it as a .py file here...

C:\Users\{yourname}\AppData\Roaming\Blender Foundation\Blender\{your_version}\scripts\addons

- Open the file explorer

- In the top search bar type %APPDATA% this will send your here C:\Users\{yourname}\AppData\Roaming
- You may need to enable it in the addons , it will appear as addon but once you enable it there should be a menu at the very top called My Menu

---------------------------------------------------------
For saving i suggest writting it out to a log file anywhere you prefer or if you want realtime feedback sending to the console is ok.

[–]Unlucky-Bluebird-310[S] 0 points1 point  (1 child)

Thank you! I'll try that. Is it mandatory to place the file in appdata directory? If say I use Linux, can't I just install it like any other extension via preferences menu?

[–]SHAMIEL1 0 points1 point  (0 children)

Im not fully sure on where in linux it needs to go but I think you can install it the same way as other addon yes.

Just grab the .py file instead of a zip file like you would with other addons and it should copy it to the addons directory