background_plane_manager/__init__.py

77 lines
1.7 KiB
Python
Raw Normal View History

2023-09-28 11:34:41 +02:00
# SPDX-License-Identifier: GPL-2.0-or-later
bl_info = {
"name": "Background plane manager",
"description": "Manage the background image planes and grease pencil object relative to a camera",
"author": "Samuel Bernou",
"version": (0, 4, 3),
2023-09-28 11:34:41 +02:00
"blender": (3, 5, 0),
"location": "View3D",
"warning": "",
"doc_url": "https://gitlab.com/autour-de-minuit/blender/background_plane_manager",
"category": "Object"
}
import bpy
from pathlib import Path
from . import operators
from . import export_psd_layers
from . import ui
from . import preferences
from . import fn
#from . file_utils import install_module
#install_module('psd_tools', 'psd-tools')
2023-09-28 11:34:41 +02:00
"""
from . import auto_modules
## module auto-install
## module_name, package_name
DEPENDENCIES = {
('psd_tools', 'psd-tools'),
}
# modules_loc = bpy.utils.user_resource('SCRIPTS', path='modules')
modules_loc = Path(__file__).parents[1] / 'modules'
error_message = f'''--- Cannot import modules (see console).
Try enabling addon after restarting blender as admin
---
'''
error = auto_modules.pip_install_and_import(DEPENDENCIES)
# note: an internet connexion is needed to auto-install needed modules)
if error:
raise Exception(error_message) from error
has_psd_tools = True
try:
import psd_tools
except Exception:
has_psd_tools = False
"""
# TODO: Add an enum in prefs to choose default type to use
# Override this enum if there is an environement variable in project
modules = (
operators,
export_psd_layers,
preferences,
ui,
)
def register():
for m in modules:
m.register()
preferences.ui_in_sidebar_update(fn.get_addon_prefs(), bpy.context)
def unregister():
for m in reversed(modules):
m.unregister()