revamp loading and panels

This commit is contained in:
jrkb 2024-08-26 18:48:43 +02:00
parent 3631ac8e49
commit 97ca4f5d23
4 changed files with 219 additions and 93 deletions

View file

@ -724,6 +724,7 @@ def set_text_on_curve(text_properties, recursive=True):
ob = None
if regenerate:
ob = bpy.data.objects.new(f"{glyph_id}", glyph.data)
ob[f"{utils.prefix()}_type"] = "glyph"
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
@ -808,6 +809,7 @@ def set_text_on_curve(text_properties, recursive=True):
if regenerate:
mom.select_set(True)
mom[f"{utils.prefix()}_type"] = "textobject"
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
@ -823,6 +825,40 @@ def set_text_on_curve(text_properties, recursive=True):
return True
verification_object = {
f"{utils.prefix()}_type": "textobject",
f"{utils.prefix()}_linked_textobject": 0,
f"{utils.prefix()}_font_name": "font_name",
f"{utils.prefix()}_face_name": "face_name",
f"{utils.prefix()}_font_size": 42,
f"{utils.prefix()}_letter_spacing": 42,
f"{utils.prefix()}_orientation": [0,0,0],
f"{utils.prefix()}_translation": [0,0,0],
}
def verify_text_object(o):
pass
def transfer_text_properties_to_text_object(text_properties, o):
o[f"{utils.prefix()}_linked_textobject"] = text_properties.text_id
o[f"{utils.prefix()}_font_name"] = text_properties.font_name
o[f"{utils.prefix()}_face_name"] = text_properties.face_name
o[f"{utils.prefix()}_font_size"] = text_properties.font_size
o[f"{utils.prefix()}_letter_spacing"] = text_properties.letter_spacing
o[f"{utils.prefix()}_orientation"] = text_properties.orientation
o[f"{utils.prefix()}_translation"] = text_properties.translation
o[f"{utils.prefix()}_text"] = text_properties["text"]
def transfer_text_object_to_text_properties(o, text_properties):
text_properties["text_id"] = o[f"{utils.prefix()}_linked_textobject"]
text_properties["font_name"] = o[f"{utils.prefix()}_font_name"]
text_properties["face_name"] = o[f"{utils.prefix()}_face_name"]
text_properties["font_size"] = o[f"{utils.prefix()}_font_size"]
text_properties["letter_spacing"] = o[f"{utils.prefix()}_letter_spacing"]
text_properties["orientation"] = o[f"{utils.prefix()}_orientation"]
text_properties["translation"] = o[f"{utils.prefix()}_translation"]
text_properties["text"] = o[f"{utils.prefix()}_text"]
# blender bound_box vertices
#
# 3------7.
@ -839,7 +875,7 @@ def add_metrics_obj_from_bound_box(glyph, bound_box=None):
obj["font_name"] = glyph["font_name"]
obj["face_name"] = glyph["face_name"]
obj["glyph"] = glyph["glyph"]
obj["type"] = "metrics"
obj[f"{utils.pefix()}_type"] = "metrics"
# remove already existing metrics
remove_metrics = []