File tree Expand file tree Collapse file tree 5 files changed +21
-12
lines changed
Expand file tree Collapse file tree 5 files changed +21
-12
lines changed Original file line number Diff line number Diff line change 22
33bl_info = {
44 "name" : "Development Kit Tool" ,
5- "version" : (1 , 0 ),
5+ "version" : (1 , 0 , 0 ),
66 "blender" : (4 , 0 , 0 ),
77 "location" : "All over the place" ,
88 "support" : "COMMUNITY" ,
Original file line number Diff line number Diff line change 1+ schema_version = " 1.0.0"
2+
3+ blender_version_min = " 4.2.0"
4+ id = " development_kit"
5+ license = [" SPDX:GPL-3.0-or-later" , ]
6+ maintainer = " 小萌新"
7+ name = " Development Kit"
8+ tagline = " Development Kit"
9+ type = " add-on"
10+ version = " 1.0.0"
11+ tags = [" Development" ]
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ def update_tool(un_register=False):
2929
3030
3131class ToolPreferences (AddonPreferences ):
32- bl_idname = PublicClass . G_ADDON_NAME
32+ bl_idname = __package__
3333
3434 @staticmethod
3535 def update_by_tool_name (tool_name ):
Original file line number Diff line number Diff line change 11import os
22from functools import cache
3- from os .path import dirname , realpath , basename
43
54import bpy
65
76
7+ def get_pref ():
8+ return bpy .context .preferences .addons [__package__ ].preferences
9+
10+
811class PublicEvent :
912 not_key : bool
1013 only_ctrl : bool
@@ -44,22 +47,16 @@ class PublicPref:
4447 @staticmethod
4548 @cache
4649 def pref_ ():
47- return bpy . context . preferences . addons [ PublicClass . G_ADDON_NAME ]. preferences
50+ return get_pref ()
4851
4952 @property
5053 def pref (self ):
5154 return self .pref_ ()
5255
53- @staticmethod
54- def get_addon_pref (addon_name = None ):
55- addon = (PublicClass .G_ADDON_NAME if addon_name is None else addon_name )
56- return bpy .context .preferences .addons [addon ].preferences
57-
5856
5957class PublicClass (PublicEvent ,
6058 PublicPref ,
6159 ):
62- G_ADDON_NAME = basename (dirname (realpath (__file__ )))
6360
6461 @staticmethod
6562 def clear_cache ():
Original file line number Diff line number Diff line change 11import bpy
22
3- owner = object ()
43from bpy .app .handlers import persistent
54from ..public import PublicPref
65
6+ owner = object ()
7+
78
89def msgbus_callback ():
910 PublicPref .pref_ ().addon_search = bpy .context .window_manager .addon_search
@@ -19,6 +20,7 @@ def msgbus():
1920 bpy .context .window_manager .addon_search = "test"
2021
2122
23+ @persistent
2224def load_post (self , context ):
2325 msgbus ()
2426
@@ -35,4 +37,3 @@ def register():
3537
3638def unregister ():
3739 bpy .msgbus .clear_by_owner (owner )
38- bpy .app .handlers .load_post .remove (load_post )
You can’t perform that action at this time.
0 commit comments