Files
Nexus/2023/scripts/animation_tools/atools/TEST_ATOOLS.py
2025-11-25 02:04:55 +08:00

63 lines
1.8 KiB
Python

#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Test script for aTools module
Run this in Maya to verify aTools can be imported and launched
"""
import sys
import os
# Add scripts path if not already there
scripts_path = r'h:\Workspace\Raw\Tools\Plugins\Maya\2023\scripts'
if scripts_path not in sys.path:
sys.path.insert(0, scripts_path)
print("=" * 60)
print("Testing aTools Module")
print("=" * 60)
# Test 1: Import module
try:
import animation_tools.atools as atools
print("✓ Import successful")
except ImportError as e:
print("✗ Import failed:", e)
sys.exit(1)
# Test 2: Check attributes
print("✓ Has show:", hasattr(atools, 'show'))
print("✓ Has launch:", hasattr(atools, 'launch'))
print("✓ Has version:", hasattr(atools, 'version'))
# Test 3: Check version
print("✓ Version:", atools.version())
# Test 4: Check if aTools modules are in correct location
atools_dir = os.path.dirname(atools.__file__)
print("✓ atools directory:", atools_dir)
print("✓ animTools exists:", os.path.exists(os.path.join(atools_dir, 'animTools')))
print("✓ commonMods exists:", os.path.exists(os.path.join(atools_dir, 'commonMods')))
print("✓ generalTools exists:", os.path.exists(os.path.join(atools_dir, 'generalTools')))
# Test 5: Try to launch (only in Maya)
try:
if atools.isMaya():
print("\n✓ Running in Maya, attempting to launch...")
result = atools.show()
if result:
print("✓ aTools launched successfully!")
else:
print("✗ aTools launch returned None")
else:
print("\n⚠ Not running in Maya, skipping launch test")
except Exception as e:
print("✗ Launch failed:", e)
import traceback
traceback.print_exc()
print("=" * 60)
print("Test Complete")
print("=" * 60)