Move operators and preferences out of __init__.py into dedicated modules. Fix cyclic import by using proper AddonPreferences pattern. Replace implicit .zip extension detection in CLI with explicit -z/--zip flag. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
77 lines
2.4 KiB
Python
77 lines
2.4 KiB
Python
# ##### BEGIN GPL LICENSE BLOCK #####
|
|
#
|
|
# 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 2
|
|
# 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, write to the Free Software Foundation,
|
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
#
|
|
# Copyright (C) 2014-2018 Blender Foundation
|
|
#
|
|
# ##### END GPL LICENSE BLOCK #####
|
|
|
|
# <pep8 compliant>
|
|
|
|
__version__ = "1.21"
|
|
|
|
bl_info = {
|
|
"name": "Blender Asset Tracer",
|
|
"author": "Campbell Barton, Sybren A. St\u00fcvel, Lo\u00efc Charri\u00e8re, Cl\u00e9ment Ducarteron, Mario Hawat, Joseph Henry",
|
|
"version": (1, 21, 0),
|
|
"blender": (2, 80, 0),
|
|
"location": "File > External Data > BAT",
|
|
"description": "Utility for packing blend files",
|
|
"warning": "",
|
|
"wiki_url": "https://developer.blender.org/project/profile/79/",
|
|
"category": "Import-Export",
|
|
}
|
|
|
|
# Reset root module name if folder has an unexpected name
|
|
# (like "blender_asset_tracer-main" from zip-dl)
|
|
import sys
|
|
|
|
if __name__ != "blender_asset_tracer":
|
|
sys.modules["blender_asset_tracer"] = sys.modules[__name__]
|
|
|
|
try:
|
|
import bpy
|
|
|
|
_HAS_BPY = True
|
|
except ImportError:
|
|
_HAS_BPY = False
|
|
|
|
if _HAS_BPY:
|
|
from blender_asset_tracer import blendfile
|
|
from . import preferences, operators
|
|
|
|
# Match the CLI's default: skip dangling pointers gracefully instead of crashing.
|
|
# Production blend files often have references to missing linked libraries.
|
|
blendfile.set_strict_pointer_mode(False)
|
|
|
|
classes = (
|
|
preferences.BATPreferences,
|
|
operators.ExportBatPack,
|
|
operators.BAT_OT_export_zip,
|
|
)
|
|
|
|
def register():
|
|
for cls in classes:
|
|
bpy.utils.register_class(cls)
|
|
bpy.types.TOPBAR_MT_file_external_data.append(operators.menu_func)
|
|
|
|
def unregister():
|
|
bpy.types.TOPBAR_MT_file_external_data.remove(operators.menu_func)
|
|
for cls in classes:
|
|
bpy.utils.unregister_class(cls)
|
|
|
|
if __name__ == "__main__":
|
|
register()
|