This commit is contained in:
jrkb 2025-05-13 16:25:19 +02:00
parent abdee651e0
commit a3c7172573

View file

@ -4,14 +4,14 @@
A 3D font helper A 3D font helper
""" """
import functools
import importlib import importlib
import io
import os import os
import bpy import bpy
from bpy.app.handlers import persistent from bpy.app.handlers import persistent
from bpy.types import Panel
from . import addon_updater_ops, bimport, butils
from .common import Font, utils
bl_info = { bl_info = {
"name": "ABC3D", "name": "ABC3D",
@ -24,9 +24,6 @@ bl_info = {
} }
# NOTE: also change version in common/utils.py # NOTE: also change version in common/utils.py
from . import addon_updater_ops, bimport, butils
from .common import Font, utils
# make sure that modules are reloadable # make sure that modules are reloadable
# when registering # when registering
# handy for development # handy for development
@ -127,10 +124,6 @@ class ABC3D_addonPreferences(bpy.types.AddonPreferences):
layout.label(text="Directory for storage of fonts and other assets:") layout.label(text="Directory for storage of fonts and other assets:")
layout.prop(self, "assets_dir") layout.prop(self, "assets_dir")
# Works best if a column, or even just self.layout.
mainrow = layout.row()
col = mainrow.column()
# Updater draw function, could also pass in col as third arg. # Updater draw function, could also pass in col as third arg.
addon_updater_ops.update_settings_ui(self, context) addon_updater_ops.update_settings_ui(self, context)
@ -148,7 +141,6 @@ class ABC3D_glyph_properties(bpy.types.PropertyGroup):
description="Letter Spacing", description="Letter Spacing",
) )
class ABC3D_text_properties(bpy.types.PropertyGroup): class ABC3D_text_properties(bpy.types.PropertyGroup):
def font_items_callback(self, context): def font_items_callback(self, context):
items = [] items = []
@ -158,7 +150,6 @@ class ABC3D_text_properties(bpy.types.PropertyGroup):
def font_default_callback(self, context): def font_default_callback(self, context):
d = context.scene.abc3d_data d = context.scene.abc3d_data
items = self.font_items_callback(context)
if len(d.available_fonts) > 0: if len(d.available_fonts) > 0:
if len(d.available_fonts) > d.active_text_index: if len(d.available_fonts) > d.active_text_index:
f = d.available_fonts[d.active_text_index] f = d.available_fonts[d.active_text_index]
@ -167,7 +158,7 @@ class ABC3D_text_properties(bpy.types.PropertyGroup):
f = d.available_fonts[0] f = d.available_fonts[0]
return 0 # f"{f.font_name} {f.face_name}" return 0 # f"{f.font_name} {f.face_name}"
if type(self.font_name) != type(None) and type(self.face_name) != type(None): if not isinstance(self.font_name, None) and not isinstance(self.face_name, None):
return 0 # f"{self.font_name} {self.face_name}" return 0 # f"{self.font_name} {self.face_name}"
else: else:
return 0 # "" return 0 # ""
@ -481,7 +472,7 @@ class ABC3D_PT_TextManagement(bpy.types.Panel):
for c in t.text_object.children: for c in t.text_object.children:
if ( if (
len(c.users_collection) > 0 len(c.users_collection) > 0
and (c.get(f"{utils.prefix()}_linked_textobject")) != type(None) and not isinstance(c.get(f"{utils.prefix()}_linked_textobject"), None)
and c.get(f"{utils.prefix()}_linked_textobject") == t.text_id and c.get(f"{utils.prefix()}_linked_textobject") == t.text_id
): ):
remove_me = False remove_me = False