Skip to content

Commit

Permalink
Stable addon loader, moving onto template generation.
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonNordon4 committed Aug 5, 2024
1 parent 4b2918d commit 768861a
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 200 deletions.
4 changes: 3 additions & 1 deletion entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

import template.__init__

# TODO: Make this autoload everything.
importlib.reload(template.__init__)

importlib.reload(template.template_panel)

template.__init__.register()
1 change: 1 addition & 0 deletions generate_addon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addon_name = "test_addon"
15 changes: 5 additions & 10 deletions template/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
from . import auto_load
from . import template_panel

print("Loading template")
print("Running template/__init__.py")

def register():
print("Registering template")
auto_load.test()

template_panel.register()

def unregister():
auto_load.unregister()




template_panel.unregister()

155 changes: 0 additions & 155 deletions template/auto_load.py

This file was deleted.

2 changes: 1 addition & 1 deletion template/blender_manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ schema_version = "1.0.0"
id = "template"
version = "1.0.0"
name = "Template"
tagline = "Template for a Blender Addon"
tagline = "Template Blender Addon"
maintainer = "Simon Nordon <[email protected]>"
# Supported types: "add-on", "theme"
type = "add-on"
Expand Down
1 change: 1 addition & 0 deletions template/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Compress-Archive -Path ".\template" -DestinationPath "template.zip" -Force
33 changes: 0 additions & 33 deletions template/template_dev_panel.py

This file was deleted.

40 changes: 40 additions & 0 deletions template/template_panel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import bpy

class TemplatePanel(bpy.types.Panel):
bl_idname = "OBJECT_PT_template_panel"
bl_label = "Template Panel"
bl_description = "This is a template panel, for starting a new addon."
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
bl_category = "Template"
bl_order = 0

@classmethod
def poll(cls, context):
return context.object is not None

def draw_header(self, context):
layout = self.layout
layout.label(text="", icon="OBJECT_DATA")

def draw(self, context):
layout = self.layout
layout.operator("template.test_operator")

class TemplateTestOperator(bpy.types.Operator):
bl_idname = "template.test_operator"
bl_label = "Testing 1, 2, 3"

def execute(self, context):
self.report({'INFO'}, 'Hello from template panel.')
return {"FINISHED"}

def register():
bpy.utils.register_class(TemplatePanel)
bpy.utils.register_class(TemplateTestOperator)

def unregister():
bpy.utils.unregister_class(TemplatePanel)
bpy.utils.unregister_class(TemplateTestOperator)


0 comments on commit 768861a

Please sign in to comment.