open asset directory
This commit is contained in:
parent
dfd08de27d
commit
e5e8a1b053
1 changed files with 24 additions and 0 deletions
24
__init__.py
24
__init__.py
|
@ -282,6 +282,7 @@ class ABC3D_PT_Panel(bpy.types.Panel):
|
||||||
layout.row().label(text='no fonts loaded yet')
|
layout.row().label(text='no fonts loaded yet')
|
||||||
|
|
||||||
layout.operator(f"{__name__}.load_installed_fonts", text="load installed fonts", icon=icon)
|
layout.operator(f"{__name__}.load_installed_fonts", text="load installed fonts", icon=icon)
|
||||||
|
layout.operator(f"{__name__}.open_asset_directory", text="open asset directory", icon='FILEBROWSER')
|
||||||
|
|
||||||
|
|
||||||
class ABC3D_PT_LoadFontPanel(bpy.types.Panel):
|
class ABC3D_PT_LoadFontPanel(bpy.types.Panel):
|
||||||
|
@ -674,6 +675,28 @@ class ABC3D_OT_InstallFont(bpy.types.Operator):
|
||||||
|
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
class ABC3D_OT_OpenAssetDirectory(bpy.types.Operator):
|
||||||
|
"""Open Asset Directory"""
|
||||||
|
bl_idname = f"{__name__}.open_asset_directory"
|
||||||
|
bl_label = "Opens asset directory."
|
||||||
|
bl_options = {'REGISTER', 'UNDO'}
|
||||||
|
|
||||||
|
def execute(self, context):
|
||||||
|
preferences = getPreferences(context)
|
||||||
|
directory = os.path.realpath(preferences.assets_dir)
|
||||||
|
if os.path.exists(directory):
|
||||||
|
utils.open_file_browser(directory)
|
||||||
|
return {'FINISHED'}
|
||||||
|
else:
|
||||||
|
butils.ShowMessageBox(
|
||||||
|
title=f"{__name__} Warning",
|
||||||
|
icon="ERROR",
|
||||||
|
message=("Asset directory does not exist.",
|
||||||
|
f"Command failed trying to access '{directory}'.",
|
||||||
|
"Please, make sure it exists or chose another directory."))
|
||||||
|
return {'CANCELLED'}
|
||||||
|
|
||||||
|
|
||||||
class ABC3D_OT_LoadInstalledFonts(bpy.types.Operator):
|
class ABC3D_OT_LoadInstalledFonts(bpy.types.Operator):
|
||||||
"""Load installed fontfiles from datapath."""
|
"""Load installed fontfiles from datapath."""
|
||||||
bl_idname = f"{__name__}.load_installed_fonts"
|
bl_idname = f"{__name__}.load_installed_fonts"
|
||||||
|
@ -1371,6 +1394,7 @@ classes = (
|
||||||
ABC3D_PT_TextManagement,
|
ABC3D_PT_TextManagement,
|
||||||
ABC3D_PT_FontCreation,
|
ABC3D_PT_FontCreation,
|
||||||
ABC3D_PT_TextPropertiesPanel,
|
ABC3D_PT_TextPropertiesPanel,
|
||||||
|
ABC3D_OT_OpenAssetDirectory,
|
||||||
ABC3D_OT_LoadInstalledFonts,
|
ABC3D_OT_LoadInstalledFonts,
|
||||||
ABC3D_OT_LoadFont,
|
ABC3D_OT_LoadFont,
|
||||||
ABC3D_OT_AddDefaultMetrics,
|
ABC3D_OT_AddDefaultMetrics,
|
||||||
|
|
Loading…
Reference in a new issue