fix: bfont is missing

related to #116
This commit is contained in:
Swann 2020-09-18 23:09:47 +02:00
parent 62221c9e49
commit 38f06683be
No known key found for this signature in database
GPG Key ID: E1D3641A7C43AACB
2 changed files with 2 additions and 4 deletions

View File

@ -35,7 +35,7 @@ class BlFont(BlDatablock):
def _construct(self, data): def _construct(self, data):
if data['filepath'] == '<builtin>': if data['filepath'] == '<builtin>':
return bpy.data.fonts[data['name']] return bpy.data.fonts.load(data['filepath'])
elif 'font_file' in data.keys(): elif 'font_file' in data.keys():
prefs = utils.get_preferences() prefs = utils.get_preferences()
font_name = f"{self.uuid}.ttf" font_name = f"{self.uuid}.ttf"

View File

@ -57,13 +57,11 @@ def get_datablock_users(datablock):
def clean_scene(): def clean_scene():
builtin = ['Bfont']
for type_name in dir(bpy.data): for type_name in dir(bpy.data):
try: try:
type_collection = getattr(bpy.data, type_name) type_collection = getattr(bpy.data, type_name)
for item in type_collection: for item in type_collection:
if item.name not in builtin: type_collection.remove(item)
type_collection.remove(item)
except: except:
continue continue