Refactor Blender addon structure and add explicit --zip CLI flag

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>
This commit is contained in:
2026-02-20 10:50:31 +01:00
co-authored by Claude Opus 4.6
parent 12e6e2643b
commit bb1de717c8
4 changed files with 211 additions and 162 deletions
+12 -1
View File
@@ -97,6 +97,14 @@ def add_parser(subparsers):
"path structure under the target directory. Paths in blend files are "
"rewritten to relative paths within this structure.",
)
parser.add_argument(
"-z",
"--zip",
default=False,
action="store_true",
help="Force output as a ZIP archive, even when the target path does "
"not end in '.zip'. The '.zip' extension is appended automatically.",
)
def cli_pack(args):
@@ -156,12 +164,15 @@ def create_packer(
packer = create_shamanpacker(bpath, ppath, target)
elif target.lower().endswith(".zip"):
elif args.zip:
from blender_asset_tracer.pack import zipped
if args.compress:
raise ValueError("ZIP packer does not support on-the-fly compression")
if not target.lower().endswith(".zip"):
target += ".zip"
packer = zipped.ZipPacker(
bpath, ppath, target, noop=args.noop, relative_only=args.relative_only,
keep_hierarchy=args.keep_hierarchy,