[fix] deletion fixes+
and some smaller cosmetic changes
This commit is contained in:
parent
8470425d20
commit
d61607c75d
2 changed files with 45 additions and 11 deletions
26
__init__.py
26
__init__.py
|
@ -336,7 +336,7 @@ class ABC3D_UL_texts(bpy.types.UIList):
|
|||
|
||||
|
||||
class ABC3D_PT_Panel(bpy.types.Panel):
|
||||
bl_label = f"{__name__} panel"
|
||||
bl_label = f"{utils.prefix()} Panel"
|
||||
bl_category = "ABC3D"
|
||||
bl_space_type = "VIEW_3D"
|
||||
bl_region_type = "UI"
|
||||
|
@ -344,6 +344,9 @@ class ABC3D_PT_Panel(bpy.types.Panel):
|
|||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
row = layout.row()
|
||||
row.label(text=f"{utils.prefix()} v{utils.get_version_string()}")
|
||||
|
||||
icon = "NONE"
|
||||
if len(context.scene.abc3d_data.available_fonts) == 0:
|
||||
icon = "ERROR"
|
||||
|
@ -439,11 +442,9 @@ class ABC3D_PT_FontList(bpy.types.Panel):
|
|||
row = box.row()
|
||||
row.label(text="File and Memory optimization")
|
||||
row = box.row()
|
||||
row.operator(f"{__name__}.refresh_fonts", text="Refresh Font list from disk")
|
||||
row.operator(f"{__name__}.refresh_fonts", text="Refresh font list from disk")
|
||||
row = box.row()
|
||||
row.operator(
|
||||
f"{__name__}.unload_unused_glyphs", text="Unload unused glyphs from memory"
|
||||
)
|
||||
row.operator(f"{__name__}.unload_unused_glyphs", text="Unload unused glyphs")
|
||||
|
||||
|
||||
class ABC3D_PT_TextPlacement(bpy.types.Panel):
|
||||
|
@ -1013,7 +1014,6 @@ class ABC3D_OT_LoadInstalledFonts(bpy.types.Operator):
|
|||
return context.window_manager.invoke_props_dialog(self)
|
||||
|
||||
def execute(self, context):
|
||||
print("EXECUTE LOAD INSTALLED FONTS")
|
||||
scene = bpy.context.scene
|
||||
|
||||
if self.load_into_memory:
|
||||
|
@ -1234,6 +1234,7 @@ class ABC3D_OT_RemoveText(bpy.types.Operator):
|
|||
|
||||
def execute(self, context):
|
||||
abc3d_data = context.scene.abc3d_data
|
||||
lock_depsgraph_updates(auto_unlock_s=-1)
|
||||
if abc3d_data.active_text_index < 0:
|
||||
butils.ShowMessageBox(
|
||||
title="No text selected",
|
||||
|
@ -1269,6 +1270,7 @@ class ABC3D_OT_RemoveText(bpy.types.Operator):
|
|||
butils.simply_delete_objects(remove_list)
|
||||
|
||||
abc3d_data.available_texts.remove(i)
|
||||
unlock_depsgraph_updates()
|
||||
|
||||
return {"FINISHED"}
|
||||
|
||||
|
@ -2033,6 +2035,7 @@ import time
|
|||
@persistent
|
||||
def on_depsgraph_update(scene, depsgraph):
|
||||
if not bpy.context.mode.startswith("EDIT") and not are_depsgraph_updates_locked():
|
||||
lock_depsgraph_updates(auto_unlock_s=-1)
|
||||
for u in depsgraph.updates:
|
||||
if (
|
||||
butils.get_key("text_id") in u.id.keys()
|
||||
|
@ -2046,12 +2049,17 @@ def on_depsgraph_update(scene, depsgraph):
|
|||
if text_properties.text_object == u.id.original:
|
||||
# nothing to do
|
||||
pass
|
||||
else:
|
||||
elif butils.is_text_object_legit(u.id.original):
|
||||
# must be duplicate
|
||||
link_text_object_with_new_text_properties(u.id.original, scene)
|
||||
else:
|
||||
# must be new thing
|
||||
elif (
|
||||
butils.is_text_object_legit(u.id.original)
|
||||
and len(u.id.original.users_collection) > 0
|
||||
):
|
||||
# must be a new thing, maybe manually created or so
|
||||
link_text_object_with_new_text_properties(u.id.original, scene)
|
||||
butils.clean_text_properties()
|
||||
unlock_depsgraph_updates()
|
||||
|
||||
|
||||
def register():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue