bl-symmetrize-texture/addon/__init__.py

89 lines
2.5 KiB
Python

'''
Copyright (C) 2021 - 2023 Akaneyu
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
'''
bl_info = {
"name": "Symmetrize Texture",
"author": "akaneyu",
"version": (1, 1, 3),
"blender": (2, 93, 0),
"location": "View3D",
"warning": "",
"description": "",
"wiki_url": "",
"tracker_url": "",
"category": "3D View"}
if "bpy" in locals():
import importlib
importlib.reload(app)
importlib.reload(operators)
importlib.reload(ui)
importlib.reload(ui_renderer)
importlib.reload(utils)
import bpy
from . import app
from . import operators
from . import ui
classes = [
app.SYMMETRIZE_TEXTURE_PropertyGroup,
operators.SYMMETRIZE_TEXTURE_OT_use_3d_brush,
operators.SYMMETRIZE_TEXTURE_OT_mirrored_copy,
operators.SYMMETRIZE_TEXTURE_OT_use_2d_brush,
operators.SYMMETRIZE_TEXTURE_OT_save_image,
ui.SYMMETRIZE_TEXTURE_MT_menu_3d,
ui.SYMMETRIZE_TEXTURE_MT_menu_2d,
ui.SYMMETRIZE_TEXTURE_PT_panel_3d,
ui.SYMMETRIZE_TEXTURE_PT_panel_2d
]
def register():
app.load_icons()
for cls in classes:
bpy.utils.register_class(cls)
bpy.types.VIEW3D_MT_object.append(ui.menu_func_3d)
bpy.types.IMAGE_MT_image.append(ui.menu_func_2d)
wm = bpy.types.WindowManager
wm.symmetrizetexture_properties = \
bpy.props.PointerProperty(type=app.SYMMETRIZE_TEXTURE_PropertyGroup)
app.SYMMETRIZE_TEXTURE_PropertyGroup.image_mirror_axis = \
bpy.props.EnumProperty(items=(
('x_axis', 'X', 'X Axis', ui.get_icon_id('mirror_x'), 0),
('y_axis', 'Y', 'Y Axis', ui.get_icon_id('mirror_y'), 1)))
def unregister():
app.dispose_icons()
for cls in classes:
bpy.utils.unregister_class(cls)
bpy.types.VIEW3D_MT_object.remove(ui.menu_func_3d)
bpy.types.IMAGE_MT_image.remove(ui.menu_func_2d)
wm = bpy.types.WindowManager
del wm.symmetrizetexture_properties
if __name__ == "__main__":
register()