cleanup prints
This commit is contained in:
parent
8f3d58aad0
commit
e14251523b
2 changed files with 6 additions and 124 deletions
46
__init__.py
46
__init__.py
|
@ -1805,7 +1805,6 @@ def link_text_object_with_new_text_properties(text_object, scene = None):
|
|||
|
||||
def detect_text():
|
||||
lock_depsgraph_updates(auto_unlock_s=-1)
|
||||
print("DETECT TEXT:: begin")
|
||||
scene = bpy.context.scene
|
||||
abc3d_data = scene.abc3d_data
|
||||
required_keys = [
|
||||
|
@ -1817,48 +1816,24 @@ def detect_text():
|
|||
]
|
||||
objects = scene.objects
|
||||
for o in objects:
|
||||
print(f" {o.name=}")
|
||||
valid = True
|
||||
for key in required_keys:
|
||||
if butils.get_key(key) not in o:
|
||||
# print(f" key {butils.get_key(key)} not there")
|
||||
valid = False
|
||||
break
|
||||
if not valid:
|
||||
continue
|
||||
print(" object may be valid textobject")
|
||||
if o[butils.get_key("type")] == "textobject":
|
||||
print(" {o.name=} a textobject")
|
||||
print(f" {type(o)=} {o.name=}")
|
||||
current_text_id = int(o[butils.get_key("text_id")])
|
||||
text_properties = butils.get_text_properties(current_text_id)
|
||||
if (
|
||||
text_properties is not None
|
||||
and text_properties.text_object == o
|
||||
):
|
||||
print(" {o.name=} seems fine")
|
||||
# all good
|
||||
pass
|
||||
# t = abc3d_data.available_texts[text_id]
|
||||
# a = test_availability(o[butils.get_key("font_name")],
|
||||
# o[butils.get_key("face_name")],
|
||||
# o[butils.get_key("text")])
|
||||
# butils.transfer_text_object_to_text_properties(o, t)
|
||||
else:
|
||||
butils.link_text_object_with_new_text_properties(o, scene)
|
||||
# print(" {o.name=} is a duplicate")
|
||||
# text_id = butils.find_free_text_id()
|
||||
# t = abc3d_data.available_texts.add()
|
||||
# t["text_id"] = text_id
|
||||
# print(f" found free {text_id=}")
|
||||
# print(" preparing text")
|
||||
# butils.prepare_text(o[butils.get_key("font_name")],
|
||||
# o[butils.get_key("face_name")],
|
||||
# o[butils.get_key("text")])
|
||||
# print(" prepared text, transferring text object")
|
||||
# t.text_object = o
|
||||
# butils.transfer_text_object_to_text_properties(o, t)
|
||||
# print(" {o.name=} transerred text object")
|
||||
print("DETECT TEXT:: end")
|
||||
unlock_depsgraph_updates()
|
||||
|
||||
|
||||
|
@ -1935,7 +1910,6 @@ import time
|
|||
|
||||
@persistent
|
||||
def on_depsgraph_update(scene, depsgraph):
|
||||
print("DEPSGRAPH:: BEGIN")
|
||||
if not bpy.context.mode.startswith("EDIT") and not are_depsgraph_updates_locked():
|
||||
for u in depsgraph.updates:
|
||||
if (
|
||||
|
@ -1943,31 +1917,19 @@ def on_depsgraph_update(scene, depsgraph):
|
|||
and butils.get_key("type") in u.id.keys()
|
||||
and u.id[butils.get_key("type")] == "textobject"
|
||||
):
|
||||
print("DEPSGRAPH:: we have a textobject")
|
||||
text_id = u.id[butils.get_key("text_id")]
|
||||
if u.is_updated_geometry:
|
||||
print(" updated geometry is true")
|
||||
print(f" is {len(scene.abc3d_data.available_texts)} bigger than {text_id=} is true?")
|
||||
# butils.detect_texts()
|
||||
# if u.is_updated_geometry:
|
||||
text_properties = butils.get_text_properties(text_id)
|
||||
if text_properties is not None:
|
||||
print(" YES")
|
||||
print(f" is ? {text_properties.text_object.name=} is {u.id.name=}")
|
||||
if text_properties.text_object == u.id.original:
|
||||
print(" yes by id")
|
||||
# nothing to do
|
||||
pass
|
||||
else:
|
||||
# must be duplicate
|
||||
link_text_object_with_new_text_properties(u.id.original, scene)
|
||||
print(" no by id")
|
||||
else:
|
||||
# must be new thing
|
||||
print(" NO, LINK TO NEW TEXTOBJECT")
|
||||
link_text_object_with_new_text_properties(u.id.original, scene)
|
||||
print(" NO")
|
||||
print("DEPSGRAPH:: done textobject")
|
||||
if are_depsgraph_updates_locked():
|
||||
print(" L O C K E D")
|
||||
print("DEPSGRAPH:: done")
|
||||
|
||||
|
||||
def register():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue