1 # ##### BEGIN GPL LICENSE BLOCK #####
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 # ##### END GPL LICENSE BLOCK #####
22 "name": "Import Palettes",
23 "author": "Antonio Vazquez",
25 "blender": (2, 81, 6),
26 "location": "File > Import",
27 "description": "Import Palettes",
29 "doc_url": "{BLENDER_MANUAL_URL}/addons/import_export/palettes.html",
30 "category": "Import-Export",
36 # ----------------------------------------------
37 # Add to Phyton path (once only)
38 # ----------------------------------------------
42 if "io_import_palette" in item
:
45 sys
.path
.append(os
.path
.join(os
.path
.dirname(__file__
), '..', 'io_import_palette'))
47 # ----------------------------------------------
49 # ----------------------------------------------
53 imp
.reload(import_ase
)
54 imp
.reload(import_krita
)
60 from bpy
.props
import (
63 from bpy_extras
.io_utils
import (
69 class ImportASE(bpy
.types
.Operator
, ImportHelper
):
70 """Load a Palette File"""
71 bl_idname
= "import_ase.read"
72 bl_label
= "Import ASE"
73 bl_options
= {'PRESET', 'UNDO'}
76 filter_glob
: StringProperty(
81 def execute(self
, context
):
82 return import_ase
.load(context
, self
.properties
.filepath
)
84 def draw(self
, context
):
88 class importKPL(bpy
.types
.Operator
, ImportHelper
):
90 bl_idname
= "import_krita.read"
91 bl_label
= "Import Palette"
92 bl_options
= {'PRESET', 'UNDO'}
95 filter_glob
: StringProperty(
100 def execute(self
, context
):
101 return import_krita
.load(context
, self
.properties
.filepath
)
103 def draw(self
, context
):
107 def menu_func_import(self
, context
):
108 self
.layout
.operator(importKPL
.bl_idname
, text
="KPL Palette (.kpl)")
109 self
.layout
.operator(ImportASE
.bl_idname
, text
="ASE Palette (.ase)")
120 bpy
.utils
.register_class(cls
)
122 bpy
.types
.TOPBAR_MT_file_import
.append(menu_func_import
)
126 bpy
.types
.TOPBAR_MT_file_import
.remove(menu_func_import
)
129 bpy
.utils
.unregister_class(cls
)
132 if __name__
== "__main__":