use prefix for custom properties
This commit is contained in:
parent
d1d71f03ad
commit
409e06bd44
3 changed files with 58 additions and 9 deletions
25
butils.py
25
butils.py
|
@ -407,7 +407,6 @@ def load_font_from_filepath(filepath):
|
|||
o_exists = True
|
||||
try:
|
||||
o, o.name
|
||||
|
||||
except ReferenceError as e:
|
||||
o_exists = False
|
||||
if o_exists and o.name not in allObjectsBefore:
|
||||
|
@ -449,10 +448,13 @@ def load_font_from_filepath(filepath):
|
|||
# f.font_name = font_name
|
||||
# f.face_name = face_name
|
||||
# print(f"{__name__} added {font_name} {face_name}")
|
||||
else:
|
||||
elif o_exists:
|
||||
remove_list.append(o)
|
||||
for o in remove_list:
|
||||
bpy.data.objects.remove(o, do_unlink=True)
|
||||
try:
|
||||
bpy.data.objects.remove(o, do_unlink=True)
|
||||
except ReferenceError as e:
|
||||
print(f"{__name__} could not remove object, because it doesn't exist")
|
||||
print(f"{__name__}: loaded font from {filepath}")
|
||||
update_available_fonts()
|
||||
|
||||
|
@ -600,8 +602,8 @@ def set_text_on_curve(text_properties):
|
|||
regenerate = True
|
||||
elif len(text_properties.text) > i and g.glyph_id != text_properties.text[i]:
|
||||
regenerate = True
|
||||
elif len(text_properties.text) > i and (g.glyph_object['font_name'] != text_properties.font_name
|
||||
or g.glyph_object['face_name'] != text_properties.face_name):
|
||||
elif len(text_properties.text) > i and (g.glyph_object[f"{utils.prefix()}_font_name"] != text_properties.font_name
|
||||
or g.glyph_object[f"{utils.prefix()}_face_name"] != text_properties.face_name):
|
||||
regenerate = True
|
||||
|
||||
if len(text_properties.text) != len(text_properties.glyphs):
|
||||
|
@ -660,9 +662,9 @@ def set_text_on_curve(text_properties):
|
|||
ob = None
|
||||
if regenerate:
|
||||
ob = bpy.data.objects.new(f"{glyph_id}", glyph.data)
|
||||
ob['linked_textobject'] = text_properties.text_id
|
||||
ob['font_name'] = text_properties.font_name
|
||||
ob['face_name'] = text_properties.face_name
|
||||
ob[f"{utils.prefix()}_linked_textobject"] = text_properties.text_id
|
||||
ob[f"{utils.prefix()}_font_name"] = text_properties.font_name
|
||||
ob[f"{utils.prefix()}_face_name"] = text_properties.face_name
|
||||
else:
|
||||
ob = text_properties.glyphs[i].glyph_object
|
||||
|
||||
|
@ -732,6 +734,13 @@ def set_text_on_curve(text_properties):
|
|||
|
||||
if regenerate:
|
||||
mom.select_set(True)
|
||||
mom[f"{utils.prefix()}_linked_textobject"] = text_properties.text_id
|
||||
mom[f"{utils.prefix()}_font_name"] = text_properties.font_name
|
||||
mom[f"{utils.prefix()}_face_name"] = text_properties.face_name
|
||||
mom[f"{utils.prefix()}_font_size"] = text_properties.font_size
|
||||
mom[f"{utils.prefix()}_letter_spacing"] = text_properties.letter_spacing
|
||||
mom[f"{utils.prefix()}_orientation"] = text_properties.orientation
|
||||
mom[f"{utils.prefix()}_translation"] = text_properties.translation
|
||||
bpy.context.view_layer.objects.active = mom
|
||||
bpy.ops.object.parent_set(type='OBJECT')
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue