2025-07-01

This commit is contained in:
2026-03-17 14:30:01 -06:00
parent f9a22056dd
commit 62b5978595
4579 changed files with 1257472 additions and 0 deletions
@@ -0,0 +1,21 @@
from typing import List, Tuple
# This cache is required as a workaround for character encoding issue
# when using dynamic EnumProperty items (https://docs.blender.org/api/master/bpy.props.html#bpy.props.EnumProperty).
# Do not remove it otherwise non ascii characters will be displayed as Mojibake (https://github.com/Charley3d/lip-sync/issues/14)
STRING_CACHE = {}
def intern_enum_items(items: List[Tuple[str, str, str]]) -> List[Tuple[str, str, str]]:
"""Cache strings to prevent memory issues"""
def intern_string(s):
if not isinstance(s, str):
return s
global STRING_CACHE
if s not in STRING_CACHE:
STRING_CACHE[s] = s
return STRING_CACHE[s]
return [tuple(intern_string(s) for s in item) for item in items]