use prefix for custom properties

This commit is contained in:
jrkb 2024-08-14 14:57:34 +02:00
parent d1d71f03ad
commit 409e06bd44
3 changed files with 58 additions and 9 deletions

View file

@ -372,7 +372,7 @@ class ABC3D_PT_TextManagement(bpy.types.Panel):
continue
remove_me = True
for c in t.text_object.children:
if len(c.users_collection) > 0 and (c.get('linked_textobject')) != type(None) and c.get('linked_textobject') == t.text_id:
if len(c.users_collection) > 0 and (c.get(f"{utils.prefix()}_linked_textobject")) != type(None) and c.get(f"{utils.prefix()}_linked_textobject") == t.text_id:
remove_me = False
# not sure how to solve this reliably atm,
# we need to reassign the glyph, but also get the proper properties from glyph_properties
@ -394,6 +394,14 @@ class ABC3D_PT_TextManagement(bpy.types.Panel):
remove_list.append(i)
for i in remove_list:
if type(abc3d_data.available_texts[i].text_object) != type(None):
del mom[f"{utils.prefix()}_linked_textobject"]
del mom[f"{utils.prefix()}_font_name"]
del mom[f"{utils.prefix()}_face_name"]
del mom[f"{utils.prefix()}_font_size"]
del mom[f"{utils.prefix()}_letter_spacing"]
del mom[f"{utils.prefix()}_orientation"]
del mom[f"{utils.prefix()}_translation"]
abc3d_data.available_texts.remove(i)
for i, t in enumerate(abc3d_data.available_texts):
@ -531,7 +539,13 @@ class ABC3D_OT_LoadInstalledFonts(bpy.types.Operator):
scene = bpy.context.scene
butils.load_installed_fonts()
butils.ShowMessageBox("Loading Fonts",
'INFO',
"Updating Data Structures.")
butils.update_available_fonts()
butils.ShowMessageBox("Loading Fonts",
'INFO',
"Done loading installed fonts.")
return {'FINISHED'}
@ -612,6 +626,20 @@ class ABC3D_OT_PlaceText(bpy.types.Operator):
bl_label = "Place Text"
bl_options = {'REGISTER', 'UNDO'}
# t.font_name = font_name
# t.face_name = face_name
# t.text_object = selected
# t.text = scene.abc3d.text
# t.letter_spacing = scene.abc3d.letter_spacing
# t.font_size = scene.abc3d.font_size
# t.translation = scene.abc3d.translation
# t.orientation = scene.abc3d.orientation
# t.distribution_type = distribution_type
# def invoke(self, context, event):
# wm = context.window_manager
# return wm.invoke_props_dialog(self)
def execute(self, context):
global shared
scene = bpy.context.scene