Skip to content
This repository was archived by the owner on Aug 3, 2025. It is now read-only.

Commit bc1cb64

Browse files
init file now runs auto-installer
The init file will now check if you have the right addons, and install only the ones you are missing. HOWEVER, one of these addons is 37mb, another is 2mb, so if you click New > BLUI, and you're missing Mr Mannequins Tools, and Textools, you'll be left looking at what appears to be a frozen Blender, as the complete install process (6 addons) took a full 5 minutes of waiting on a stalled Blender to come through. But come through it did! So I will have to update the docs about that. There was also a small formatting error in the keymap that caused the Walk modal map to be deleted! What!?!? But it has also been fixed.
1 parent 347ac2b commit bc1cb64

File tree

2 files changed

+82
-7
lines changed

2 files changed

+82
-7
lines changed

BLUI_Keymap.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11450,11 +11450,7 @@
1145011450
("View3D Walk Modal",
1145111451
{"space_type": 'EMPTY', "region_type": 'WINDOW', "modal": True},
1145211452
{"items":
11453-
[("CANCEL",
11454-
{"type": 'RIGHTMOUSE', "value": 'ANY', "any": True},
11455-
{ "active":False,
11456-
},
11457-
),
11453+
[("CANCEL", {"type": 'RIGHTMOUSE', "value": 'ANY', "any": True},{"active":False,},),
1145811454
("CANCEL", {"type": 'ESC', "value": 'PRESS', "any": True, "repeat": True}, None),
1145911455
("CONFIRM", {"type": 'RIGHTMOUSE', "value": 'RELEASE', "any": True}, None),
1146011456
("CONFIRM", {"type": 'RET', "value": 'PRESS', "any": True, "repeat": True}, None),

__init__.py

Lines changed: 81 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,98 @@
1-
# BLUI v0.8.2
1+
# BLUI v0.8.3
22

3-
import bpy
3+
import bpy, os, urllib.request, addon_utils
44
from bpy.app.handlers import persistent
55

6+
@persistent
7+
def load_handler_for_preferences(_):
8+
print("Changing Preference Defaults!")
9+
#from . import BLUI_Keymap
10+
11+
string = bpy.app.version_string
12+
blenderversion = string.rstrip(string[-2:])
13+
keymap_filepath = str(os.path.expanduser('~/AppData/Roaming/Blender Foundation/Blender/')) + blenderversion + str('/scripts/startup/bl_app_templates_user/BLUI/BLUI_Keymap.py')
14+
15+
bpy.ops.preferences.keyconfig_import(filepath=keymap_filepath)
16+
bpy.ops.preferences.keyconfig_activate(filepath=keymap_filepath)
17+
618
@persistent
719
def load_handler_for_startup(_):
820
print("Changing Startup Defaults!")
921

22+
prefs = bpy.context.preferences
23+
active_addons = prefs.addons
24+
25+
addons = []
26+
addon = {
27+
'addon_name':'',
28+
'url':'',
29+
}
30+
31+
addon1 = addon.copy()
32+
addon1['addon_name'] = 'MrMannequinsTools'
33+
addon1['url'] = 'https://github.com/Jim-Kroovy/Mr-Mannequins-Tools/releases/download/v1.4/MrMannequinsTools-1.4.zip'
34+
35+
addon2 = addon.copy()
36+
addon2['addon_name'] = 'blender-for-unrealengine'
37+
addon2['url'] = 'https://github.com/xavier150/Blender-For-UnrealEngine-Addons/releases/download/v0.2.8/blender-for-unrealengine.zip'
38+
39+
addon3 = addon.copy()
40+
addon3['addon_name'] = 'TexTools_1_4_4'
41+
addon3['url'] = 'https://github.com/SavMartin/TexTools-Blender/releases/download/v1.4.4/TexTools_1_4_4.zip'
42+
43+
addon4 = addon.copy()
44+
addon4['addon_name'] = 'modifier_stack_manager'
45+
addon4['url'] = 'https://github.com/salaivv/modifier-stack-manager/releases/download/0.2/modifier_stack_manager.zip'
46+
47+
addon5 = addon.copy()
48+
addon5['addon_name'] = 'RightMouseNavigation'
49+
addon5['url'] = 'https://github.com/SpectralVectors/RightMouseNavigation/releases/download/1.8/RightMouseNavigation.zip'
50+
51+
addon6 = addon.copy()
52+
addon6['addon_name'] = 'CommentBox-main'
53+
addon6['url'] = 'https://github.com/SpectralVectors/CommentBox/archive/refs/heads/main.zip'
54+
55+
for addon in active_addons:
56+
57+
if addon_utils.check('MrMannequinsTools') == (True, False):
58+
addons.append(addon1)
59+
60+
if addon_utils.check('blender-for-unrealengine') == (True, False):
61+
addons.append(addon2)
62+
63+
if addon_utils.check('TexTools_1_4_4') == (True, False):
64+
addons.append(addon3)
65+
66+
if addon_utils.check('modifier_stack_manager') == (True, False):
67+
addons.append(addon4)
68+
69+
if addon_utils.check('RightMouseNavigation') == (True, False):
70+
addons.append(addon5)
71+
72+
if addon_utils.check('CommentBox-main') == (True, False):
73+
addons.append(addon6)
74+
75+
for addon in addons:
76+
url_file = bpy.path.basename(addon['url'])
77+
module_name = bpy.path.display_name_from_filepath(addon['url'])
78+
filepath = str(os.path.expanduser('~/Downloads/') + url_file)
79+
file = urllib.request.urlretrieve(addon['url'], filepath)
80+
overwrite_setting = False
81+
bpy.ops.preferences.addon_install(overwrite=overwrite_setting, filepath=filepath)
82+
try:
83+
bpy.ops.preferences.addon_enable(module=module_name)
84+
except: # ModuleNotFoundError
85+
bpy.ops.preferences.addon_enable(module=addon['addon_name'])
86+
1087
bpy.ops.wm.splash('INVOKE_DEFAULT')
1188

1289
def register():
1390
print("Registering to Change Defaults")
91+
bpy.app.handlers.load_factory_preferences_post.append(load_handler_for_preferences)
1492
bpy.app.handlers.load_factory_startup_post.append(load_handler_for_startup)
1593

1694

1795
def unregister():
1896
print("Unregistering to Change Defaults")
97+
bpy.app.handlers.load_factory_preferences_post.remove(load_handler_for_preferences)
1998
bpy.app.handlers.load_factory_startup_post.remove(load_handler_for_startup)

0 commit comments

Comments
 (0)