remove text and allow rudimentary nurbs
This commit is contained in:
parent
28e664cd6c
commit
01c116c321
2 changed files with 67 additions and 36 deletions
51
__init__.py
51
__init__.py
|
@ -479,6 +479,7 @@ class ABC3D_PT_TextManagement(bpy.types.Panel):
|
|||
|
||||
layout.label(text="Text Objects")
|
||||
layout.template_list("ABC3D_UL_texts", "", abc3d_data, "available_texts", abc3d_data, "active_text_index")
|
||||
layout.row().operator(f"{__name__}.remove_text", text="Remove Textobject")
|
||||
|
||||
class ABC3D_PT_FontCreation(bpy.types.Panel):
|
||||
bl_label = "Font Creation"
|
||||
|
@ -754,6 +755,55 @@ class ABC3D_OT_TemporaryHelper(bpy.types.Operator):
|
|||
|
||||
return {'FINISHED'}
|
||||
|
||||
class ABC3D_OT_RemoveText(bpy.types.Operator):
|
||||
"""Remove Text 3D"""
|
||||
bl_idname = f"{__name__}.remove_text"
|
||||
bl_label = "Remove Text"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
remove_objects: bpy.props.BoolProperty(
|
||||
name="Remove Objects",
|
||||
description="Remove both ABC3D text functionality and the objects/meshes",
|
||||
default=True)
|
||||
|
||||
def invoke(self, context, event):
|
||||
wm = context.window_manager
|
||||
return wm.invoke_props_dialog(self)
|
||||
|
||||
def execute(self, context):
|
||||
abc3d_data = context.scene.abc3d_data
|
||||
if abc3d_data.active_text_index < 0:
|
||||
butils.ShowMessageBox(
|
||||
title="No text selected",
|
||||
message=("Please select a text."),
|
||||
icon='GHOST_ENABLED')
|
||||
return {'CANCELLED'}
|
||||
|
||||
i = abc3d_data.active_text_index
|
||||
if type(abc3d_data.available_texts[i].text_object) != type(None):
|
||||
mom = abc3d_data.available_texts[i].text_object
|
||||
def delif(o, p):
|
||||
if p in o:
|
||||
del o[p]
|
||||
delif(mom,f"{utils.prefix()}_linked_textobject")
|
||||
delif(mom,f"{utils.prefix()}_font_name")
|
||||
delif(mom,f"{utils.prefix()}_face_name")
|
||||
delif(mom,f"{utils.prefix()}_font_size")
|
||||
delif(mom,f"{utils.prefix()}_letter_spacing")
|
||||
delif(mom,f"{utils.prefix()}_orientation")
|
||||
delif(mom,f"{utils.prefix()}_translation")
|
||||
if self.remove_objects:
|
||||
remove_list = []
|
||||
for g in abc3d_data.available_texts[i].glyphs:
|
||||
if type(g) != type(None):
|
||||
remove_list.append(g.glyph_object)
|
||||
butils.simply_delete_objects(remove_list)
|
||||
|
||||
abc3d_data.available_texts.remove(i)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class ABC3D_OT_PlaceText(bpy.types.Operator):
|
||||
"""Place Text 3D on active object"""
|
||||
bl_idname = f"{__name__}.placetext"
|
||||
|
@ -1261,6 +1311,7 @@ classes = (
|
|||
ABC3D_OT_AlignMetricsToActiveObject,
|
||||
ABC3D_OT_AlignMetrics,
|
||||
ABC3D_OT_TemporaryHelper,
|
||||
ABC3D_OT_RemoveText,
|
||||
ABC3D_OT_PlaceText,
|
||||
ABC3D_OT_InstallFont,
|
||||
ABC3D_OT_ToggleABC3DCollection,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue