79 lines
1.8 KiB
Python
79 lines
1.8 KiB
Python
# 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, 5, 2),
|
|
"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 import_planes
|
|
from . import export_psd_layers
|
|
from . import ui
|
|
from . import preferences
|
|
|
|
from . import core
|
|
|
|
#from . file_utils import install_module
|
|
#install_module('psd_tools', 'psd-tools')
|
|
|
|
"""
|
|
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 = (
|
|
import_planes,
|
|
operators,
|
|
export_psd_layers,
|
|
preferences,
|
|
ui,
|
|
)
|
|
|
|
def register():
|
|
for m in modules:
|
|
m.register()
|
|
|
|
preferences.ui_in_sidebar_update(core.get_addon_prefs(), bpy.context)
|
|
|
|
def unregister():
|
|
for m in reversed(modules):
|
|
m.unregister()
|