Compare commits
1 commit
Author | SHA1 | Date | |
---|---|---|---|
77f30d51d1 |
1 changed files with 83 additions and 0 deletions
83
__init__.py
83
__init__.py
|
@ -311,6 +311,7 @@ class ABC3D_UL_texts(bpy.types.UIList):
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ABC3D_PT_Panel(bpy.types.Panel):
|
class ABC3D_PT_Panel(bpy.types.Panel):
|
||||||
bl_label = f"{__name__} panel"
|
bl_label = f"{__name__} panel"
|
||||||
bl_category = "ABC3D"
|
bl_category = "ABC3D"
|
||||||
|
@ -332,6 +333,27 @@ class ABC3D_PT_Panel(bpy.types.Panel):
|
||||||
text="open asset directory", icon='FILEBROWSER')
|
text="open asset directory", icon='FILEBROWSER')
|
||||||
|
|
||||||
|
|
||||||
|
# class ABC3D_PT_LoadFontPanel(bpy.types.Panel):
|
||||||
|
# bl_label = "Install a new font"
|
||||||
|
# bl_parent_id = "ABC3D_PT_Panel"
|
||||||
|
# bl_category = "ABC3D"
|
||||||
|
# bl_space_type = "VIEW_3D"
|
||||||
|
# bl_region_type = "UI"
|
||||||
|
|
||||||
|
# def draw(self, context):
|
||||||
|
# layout = self.layout
|
||||||
|
# wm = context.window_manager
|
||||||
|
# scene = context.scene
|
||||||
|
|
||||||
|
# abc3d_data = scene.abc3d_data
|
||||||
|
|
||||||
|
# box = layout.box()
|
||||||
|
# box.row().label(text="1. Select fontfile")
|
||||||
|
# box.row().prop(context.scene.abc3d_data, "font_path")
|
||||||
|
# box.row().label(text="2. Install it:")
|
||||||
|
# box.row().operator(f"{__name__}.install_font", text='Install new font')
|
||||||
|
|
||||||
|
|
||||||
class ABC3D_PT_FontList(bpy.types.Panel):
|
class ABC3D_PT_FontList(bpy.types.Panel):
|
||||||
bl_label = "Font List"
|
bl_label = "Font List"
|
||||||
bl_parent_id = "ABC3D_PT_Panel"
|
bl_parent_id = "ABC3D_PT_Panel"
|
||||||
|
@ -1395,6 +1417,65 @@ class ABC3D_OT_CreateFontFromObjects(bpy.types.Operator):
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
|
class ABC3D_PT_RightPropertiesPanel(bpy.types.Panel):
|
||||||
|
"""Creates a Panel in the Object properties window"""
|
||||||
|
bl_label = f"{bl_info['name']}"
|
||||||
|
bl_idname = "ABC3D_PT_RightPropertiesPanel"
|
||||||
|
bl_space_type = 'PROPERTIES'
|
||||||
|
bl_region_type = 'WINDOW'
|
||||||
|
bl_context = "object"
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def poll(self, context):
|
||||||
|
# only show the panel, if it's a textobject or a glyph
|
||||||
|
is_text = type(next((t for t in context.scene.abc3d_data.available_texts if t.text_object ==
|
||||||
|
context.active_object), None)) != type(None)
|
||||||
|
is_glyph = type(next((t for t in context.scene.abc3d_data.available_texts if t.text_object ==
|
||||||
|
context.active_object.parent), None)) != type(None)
|
||||||
|
return is_text or is_glyph
|
||||||
|
|
||||||
|
def draw(self, context):
|
||||||
|
layout = self.layout
|
||||||
|
scene = context.scene
|
||||||
|
abc3d_data = scene.abc3d_data
|
||||||
|
|
||||||
|
obj = context.active_object
|
||||||
|
|
||||||
|
def is_it_text():
|
||||||
|
return type(next((t for t in context.scene.abc3d_data.available_texts if t.text_object == context.active_object), None)) != type(None)
|
||||||
|
|
||||||
|
def is_it_glyph():
|
||||||
|
return type(next((t for t in context.scene.abc3d_data.available_texts if t.text_object == context.active_object.parent), None)) != type(None)
|
||||||
|
|
||||||
|
is_text = is_it_text()
|
||||||
|
is_glyph = is_it_glyph()
|
||||||
|
|
||||||
|
textobject = obj if is_text else obj.parent if is_glyph else obj
|
||||||
|
available_text = abc3d_data.available_texts[abc3d_data.active_text_index]
|
||||||
|
|
||||||
|
# row = layout.row()
|
||||||
|
# row.label(text="Hello world!", icon='WORLD_DATA')
|
||||||
|
# row = layout.row()
|
||||||
|
# row.label(text="Active object is: " + obj.name)
|
||||||
|
# row = layout.row()
|
||||||
|
# row.label(text="text object is: " + textobject.name)
|
||||||
|
row = layout.row()
|
||||||
|
row.label(text=f"active text index is: {abc3d_data.active_text_index}")
|
||||||
|
|
||||||
|
layout.row().label(text="Text Properties:")
|
||||||
|
layout.row().prop(available_text, "text")
|
||||||
|
layout.row().prop(available_text, "letter_spacing")
|
||||||
|
layout.row().prop(available_text, "font_size")
|
||||||
|
layout.row().prop(available_text, "offset")
|
||||||
|
layout.row().prop(available_text, "compensate_curvature")
|
||||||
|
layout.row().prop(available_text, "ignore_orientation")
|
||||||
|
layout.column().prop(available_text, "translation")
|
||||||
|
layout.column().prop(available_text, "orientation")
|
||||||
|
|
||||||
|
if is_glyph:
|
||||||
|
layout.row().label(text="Glyph Properties:")
|
||||||
|
|
||||||
|
|
||||||
class ABC3D_OT_Reporter(bpy.types.Operator):
|
class ABC3D_OT_Reporter(bpy.types.Operator):
|
||||||
bl_idname = f"{__name__}.reporter"
|
bl_idname = f"{__name__}.reporter"
|
||||||
bl_label = "Report"
|
bl_label = "Report"
|
||||||
|
@ -1427,6 +1508,7 @@ classes = (
|
||||||
ABC3D_UL_fonts,
|
ABC3D_UL_fonts,
|
||||||
ABC3D_UL_texts,
|
ABC3D_UL_texts,
|
||||||
ABC3D_PT_Panel,
|
ABC3D_PT_Panel,
|
||||||
|
# ABC3D_PT_LoadFontPanel,
|
||||||
ABC3D_PT_FontList,
|
ABC3D_PT_FontList,
|
||||||
ABC3D_PT_TextPlacement,
|
ABC3D_PT_TextPlacement,
|
||||||
ABC3D_PT_TextManagement,
|
ABC3D_PT_TextManagement,
|
||||||
|
@ -1446,6 +1528,7 @@ classes = (
|
||||||
ABC3D_OT_ToggleABC3DCollection,
|
ABC3D_OT_ToggleABC3DCollection,
|
||||||
ABC3D_OT_SaveFontToFile,
|
ABC3D_OT_SaveFontToFile,
|
||||||
ABC3D_OT_CreateFontFromObjects,
|
ABC3D_OT_CreateFontFromObjects,
|
||||||
|
ABC3D_PT_RightPropertiesPanel,
|
||||||
ABC3D_OT_Reporter,
|
ABC3D_OT_Reporter,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue