blroots/examples/simple/blroots_simple_example/preferences.py

57 lines
1.7 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(blr.prefs.SensiblePrefs(__package__)):
"""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__
####################
# - 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_logging_prefs(layout)
####################
# - Blender Registration
####################
BL_REGISTER = [BLExtPrefs]