Files
Nexus/2023/scripts/rigging_tools/ngskintools2/launcher.py
2026-01-22 00:06:13 +08:00

44 lines
1.5 KiB
Python

#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
ngSkinTools2 Launcher
Provides a simple interface to launch ngSkinTools2 from Maya shelf buttons
"""
import sys
def LaunchNgSkinTools():
"""
Launch ngSkinTools2 main UI window
This function handles two scenarios:
1. If module alias exists (ngSkinTools2 -> rigging_tools.ngskintools2), use it
2. If not, create the alias on-the-fly and then launch
"""
try:
# Check if module alias already exists
if 'ngSkinTools2' not in sys.modules:
# Create the alias on-the-fly
try:
import rigging_tools.ngskintools2
sys.modules['ngSkinTools2'] = rigging_tools.ngskintools2
print("Created ngSkinTools2 module alias")
except ImportError as import_err:
print(f"Error: Failed to import rigging_tools.ngskintools2 - {import_err}")
print("Please ensure the ngskintools2 directory is in the correct location")
return
# Now import and launch
from ngSkinTools2 import open_ui
open_ui()
print("ngSkinTools2 launched successfully")
except ImportError as e:
print(f"Error: Failed to import ngSkinTools2 - {e}")
print("Please ensure ngSkinTools2 is properly installed")
except Exception as e:
print(f"Error: Failed to launch ngSkinTools2 - {e}")
import traceback
traceback.print_exc()