[fix] glyph receives text_id
This commit is contained in:
parent
59edb2e786
commit
14d1b7a160
2 changed files with 25 additions and 31 deletions
54
__init__.py
54
__init__.py
|
@ -660,42 +660,34 @@ class ABC3D_PT_TextPropertiesPanel(bpy.types.Panel):
|
||||||
# and bpy.context.object.select_get():
|
# and bpy.context.object.select_get():
|
||||||
a_o = bpy.context.active_object
|
a_o = bpy.context.active_object
|
||||||
if a_o is not None:
|
if a_o is not None:
|
||||||
if f"{utils.prefix()}_text_id" in a_o:
|
# if f"{utils.prefix()}_text_id" in a_o:
|
||||||
text_index = a_o[f"{utils.prefix()}_text_id"]
|
# text_id = a_o[f"{utils.prefix()}_text_id"]
|
||||||
return bpy.context.scene.abc3d_data.available_texts[text_index]
|
# return butils.get_text_properties(text_id)
|
||||||
elif a_o.parent is not None and f"{utils.prefix()}_text_id" in a_o.parent:
|
# # elif a_o.parent is not None and f"{utils.prefix()}_text_id" in a_o.parent:
|
||||||
text_index = a_o.parent[f"{utils.prefix()}_text_id"]
|
# # text_id = a_o.parent[f"{utils.prefix()}_text_id"]
|
||||||
return bpy.context.scene.abc3d_data.available_texts[text_index]
|
# # return butils.get_text_properties(text_id)
|
||||||
else:
|
# else:
|
||||||
for t in bpy.context.scene.abc3d_data.available_texts:
|
for t in bpy.context.scene.abc3d_data.available_texts:
|
||||||
if butils.is_or_has_parent(
|
if butils.is_or_has_parent(
|
||||||
bpy.context.active_object, t.text_object, max_depth=4
|
bpy.context.active_object, t.text_object, max_depth=4
|
||||||
):
|
):
|
||||||
return t
|
return t
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_active_glyph_properties(self):
|
def get_active_glyph_properties(self, text_properties):
|
||||||
|
if text_properties is None:
|
||||||
|
return None
|
||||||
a_o = bpy.context.active_object
|
a_o = bpy.context.active_object
|
||||||
if a_o is not None:
|
if a_o is not None:
|
||||||
if (
|
if f"{utils.prefix()}_glyph_index" in a_o:
|
||||||
f"{utils.prefix()}_text_id" in a_o
|
|
||||||
and f"{utils.prefix()}_glyph_index" in a_o
|
|
||||||
):
|
|
||||||
text_index = a_o[f"{utils.prefix()}_text_id"]
|
|
||||||
glyph_index = a_o[f"{utils.prefix()}_glyph_index"]
|
glyph_index = a_o[f"{utils.prefix()}_glyph_index"]
|
||||||
return bpy.context.scene.abc3d_data.available_texts[text_index].glyphs[
|
if len(text_properties.glyphs) <= glyph_index:
|
||||||
glyph_index
|
return None
|
||||||
]
|
return text_properties.glyphs[glyph_index]
|
||||||
else:
|
else:
|
||||||
for t in bpy.context.scene.abc3d_data.available_texts:
|
for g in text_properties.glyphs:
|
||||||
if butils.is_or_has_parent(
|
if butils.is_or_has_parent(a_o, g.glyph_object, max_depth=4):
|
||||||
a_o, t.text_object, if_is_parent=False, max_depth=4
|
return g
|
||||||
):
|
|
||||||
for g in t.glyphs:
|
|
||||||
if butils.is_or_has_parent(
|
|
||||||
a_o, g.glyph_object, max_depth=4
|
|
||||||
):
|
|
||||||
return g
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -709,7 +701,7 @@ class ABC3D_PT_TextPropertiesPanel(bpy.types.Panel):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
|
|
||||||
props = self.get_active_text_properties()
|
props = self.get_active_text_properties()
|
||||||
glyph_props = self.get_active_glyph_properties()
|
glyph_props = self.get_active_glyph_properties(props)
|
||||||
|
|
||||||
if props is None or props.text_object is None:
|
if props is None or props.text_object is None:
|
||||||
# this should not happen
|
# this should not happen
|
||||||
|
|
|
@ -1301,6 +1301,8 @@ def transfer_text_object_to_text_properties(
|
||||||
transfer_glyph_object_to_glyph_properties(glyph_object, glyph_properties)
|
transfer_glyph_object_to_glyph_properties(glyph_object, glyph_properties)
|
||||||
glyph_properties["glyph_object"] = glyph_object
|
glyph_properties["glyph_object"] = glyph_object
|
||||||
glyph_properties["glyph_index"] = glyph_index
|
glyph_properties["glyph_index"] = glyph_index
|
||||||
|
glyph_properties["text_id"] = text_properties.text_id
|
||||||
|
glyph_object["text_id"] = text_properties.text_id
|
||||||
inner_node = None
|
inner_node = None
|
||||||
for c in glyph_object.children:
|
for c in glyph_object.children:
|
||||||
if c.name.startswith(f"{glyph_id}_mesh"):
|
if c.name.startswith(f"{glyph_id}_mesh"):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue