66 lines
2.0 KiB
Python
66 lines
2.0 KiB
Python
# blext
|
|
# Copyright (C) 2025 blext Project Contributors
|
|
#
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU Affero General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU Affero General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
"""Addon preferences, encapsulating the various global modifications that the user may make to how this addon functions."""
|
|
|
|
import blroots as blr
|
|
import bpy
|
|
|
|
|
|
class BLExtPrefs(bpy.types.AddonPreferences):
|
|
"""Manages user preferences and settings.
|
|
|
|
Attributes:
|
|
use_log_file: Whether to log extension messages to a file.
|
|
log_file_level: The importance of messages to log to a file.
|
|
log_file_path: Path to the extension log file.
|
|
use_log_console: Whether to log extension messages to the console.
|
|
log_console_level: The importance of messages to log to the console.
|
|
"""
|
|
|
|
bl_idname = __package__
|
|
|
|
# Logging
|
|
logging_prefs: blr.utils.bl_logger.LoggingPrefs = blr.BLField(
|
|
blr.gather.blext_info.logging_prefs,
|
|
display_name='Logging Settings',
|
|
)
|
|
## Methods on this class should include:
|
|
## - conform_logger
|
|
## - conform_all_loggers_to_prefs
|
|
## - draw: Draw these prefs into a layout.
|
|
|
|
####################
|
|
# - UI
|
|
####################
|
|
def draw(self, _: bpy.types.Context) -> None:
|
|
"""Draw the extension preferences within its panel.
|
|
|
|
Notes:
|
|
Run by Blender when this addon's preferences need to be displayed.
|
|
|
|
Parameters:
|
|
context: The Blender context object.
|
|
"""
|
|
layout = self.layout
|
|
self.draw_blprop(layout, 'logging_prefs')
|
|
|
|
|
|
####################
|
|
# - Blender Registration
|
|
####################
|
|
BL_REGISTER = [BLExtPrefs]
|