Initial Commit

This commit is contained in:
Yusarina
2024-06-12 03:37:46 +01:00
parent c27fe30acd
commit 0f7c46b720
8 changed files with 128 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
import bpy
from . import ui
from .core.register import order_classes
def register():
print("Registering Avatar Toolkit")
# Order the classes before registration
order_classes()
# Register the UI classes
ui.register()
def unregister():
print("Unregistering Avatar Toolkit")
# Unregister the UI classes
ui.unregister()
+16
View File
@@ -0,0 +1,16 @@
# blender_manifest.toml
schema_version = "1.0.0"
id = "avatar_toolkit"
version = "0.0.1"
name = "Avatar Toolkit"
tagline = "A modern tool for importing and optimizing models for VRChat, Resonite, and other similar games."
maintainer = "Your Name <your.email@example.com>"
type = "add-on"
blender_version_min = "4.3.0"
license = [
"SPDX:GPL-3.0-or-later",
]
+3
View File
@@ -0,0 +1,3 @@
# core/__init__.py
from .register import register_wrap
+24
View File
@@ -0,0 +1,24 @@
import bpy
import typing
# List to store the classes to register
__bl_classes = []
# List to store the ordered classes for registration
__bl_ordered_classes = []
def register_wrap(cls):
# Check if the class has a 'bl_rna' attribute (indicating it's a Blender class)
if hasattr(cls, 'bl_rna'):
# Add the class to the list of classes to register
__bl_classes.append(cls)
return cls
def order_classes():
global __bl_ordered_classes
# Create a copy of the classes list to store the ordered classes
__bl_ordered_classes = __bl_classes.copy()
def iter_classes_to_register():
# Iterate over the ordered classes and yield each class for registration
for cls in __bl_ordered_classes:
yield cls
+23
View File
@@ -0,0 +1,23 @@
if "bpy" not in locals():
import bpy
from . import panel, quick_access, optimization
else:
import importlib
# Reload the modules to reflect changes during development
importlib.reload(panel)
importlib.reload(quick_access)
importlib.reload(optimization)
def register():
print("UI register called")
from ..core.register import iter_classes_to_register
# Iterate over the classes to register and register them
for cls in iter_classes_to_register():
bpy.utils.register_class(cls)
def unregister():
print("UI unregister called")
from ..core.register import iter_classes_to_register
# Iterate over the classes to unregister in reverse order and unregister them
for cls in reversed(list(iter_classes_to_register())):
bpy.utils.unregister_class(cls)
+16
View File
@@ -0,0 +1,16 @@
import bpy
from ..core.register import register_wrap
@register_wrap
class AvatarToolkitOptimizationPanel(bpy.types.Panel):
bl_label = "Optimization"
bl_idname = "OBJECT_PT_avatar_toolkit_optimization"
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
bl_category = "Avatar Toolkit"
bl_parent_id = "OBJECT_PT_avatar_toolkit"
def draw(self, context):
layout = self.layout
layout.label(text="Optimization Options")
# Add optimization options here
+15
View File
@@ -0,0 +1,15 @@
import bpy
from ..core.register import register_wrap
@register_wrap
class AvatarToolkitPanel(bpy.types.Panel):
bl_label = "Avatar Toolkit"
bl_idname = "OBJECT_PT_avatar_toolkit"
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
bl_category = "Avatar Toolkit"
def draw(self, context):
layout = self.layout
layout.label(text="Welcome to Avatar Toolkit!")
print("Avatar Toolkit Panel is being drawn")
+16
View File
@@ -0,0 +1,16 @@
import bpy
from ..core.register import register_wrap
@register_wrap
class AvatarToolkitQuickAccessPanel(bpy.types.Panel):
bl_label = "Quick Access"
bl_idname = "OBJECT_PT_avatar_toolkit_quick_access"
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
bl_category = "Avatar Toolkit"
bl_parent_id = "OBJECT_PT_avatar_toolkit"
def draw(self, context):
layout = self.layout
layout.label(text="Quick Access Options")
# Add quick access options here