2025-12-01

This commit is contained in:
2026-03-17 14:58:51 -06:00
parent 183e865f8b
commit 4b82b57113
6846 changed files with 954887 additions and 162606 deletions
+42
View File
@@ -0,0 +1,42 @@
# SPDX-FileCopyrightText: 2021 Blender Studio Tools Authors
#
# SPDX-License-Identifier: GPL-3.0-or-later
import re
from typing import Union
import bpy
from . import bkglobals
def ui_redraw() -> None:
"""
Forces blender to redraw the UI.
"""
for screen in bpy.data.screens:
for area in screen.areas:
area.tag_redraw()
def get_version(str_value: str, format: type = str) -> Union[str, int, None]:
match = re.search(bkglobals.VERSION_PATTERN, str_value)
if match:
version = match.group()
if format == str:
return version
if format == int:
return int(version.replace("v", ""))
return None
def addon_prefs_get(context: bpy.types.Context) -> bpy.types.AddonPreferences:
# NOTE: This was moved out of prefs.py to resolve a circular dependency with cache.py.
if not context:
context = bpy.context
base_package = __package__
if base_package.startswith('bl_ext'):
# 4.2
return context.preferences.addons[base_package].preferences
else:
return context.preferences.addons[base_package.split(".")[0]].preferences