1 # SPDX-License-Identifier: GPL-2.0-or-later
4 "name": "Import Palettes",
5 "author": "Antonio Vazquez, Kevin C. Burke (@blastframe)",
8 "location": "File > Import",
9 "description": "Import Palettes",
11 "doc_url": "{BLENDER_MANUAL_URL}/addons/import_export/palettes.html",
12 "category": "Import-Export",
18 # ----------------------------------------------
19 # Add to Python path (once only)
20 # ----------------------------------------------
24 if "io_import_palette" in item
:
27 sys
.path
.append(os
.path
.join(os
.path
.dirname(__file__
), '..', 'io_import_palette'))
29 # ----------------------------------------------
31 # ----------------------------------------------
35 imp
.reload(import_ase
)
36 imp
.reload(import_krita
)
42 from bpy
.props
import (
45 from bpy_extras
.io_utils
import (
51 class ImportASE(bpy
.types
.Operator
, ImportHelper
):
52 """Load a Palette File"""
53 bl_idname
= "import_ase.read"
54 bl_label
= "Import ASE"
55 bl_options
= {'PRESET', 'UNDO'}
58 filter_glob
: StringProperty(
63 def execute(self
, context
):
64 return import_ase
.load(context
, self
.properties
.filepath
)
66 def draw(self
, context
):
70 class importKPL(bpy
.types
.Operator
, ImportHelper
):
72 bl_idname
= "import_krita.read"
73 bl_label
= "Import Palette"
74 bl_options
= {'PRESET', 'UNDO'}
77 filter_glob
: StringProperty(
82 def execute(self
, context
):
83 return import_krita
.load(context
, self
.properties
.filepath
)
85 def draw(self
, context
):
89 def menu_func_import(self
, context
):
90 self
.layout
.operator(importKPL
.bl_idname
, text
="KPL Palette (.kpl)")
91 self
.layout
.operator(ImportASE
.bl_idname
, text
="ASE Palette (.ase)")
102 bpy
.utils
.register_class(cls
)
104 bpy
.types
.TOPBAR_MT_file_import
.append(menu_func_import
)
108 bpy
.types
.TOPBAR_MT_file_import
.remove(menu_func_import
)
111 bpy
.utils
.unregister_class(cls
)
114 if __name__
== "__main__":