87 lines
3.5 KiB
Python
87 lines
3.5 KiB
Python
|
#!/usr/bin/env python
|
||
|
# -*- coding: utf-8 -*-
|
||
|
|
||
|
import os
|
||
|
import sys
|
||
|
import maya.cmds as cmds
|
||
|
|
||
|
#===================================== 2. Global Variables =====================================
|
||
|
try:
|
||
|
ROOT_PATH = os.path.dirname(INSTALL_PATH).replace("\\", "/")
|
||
|
except NameError:
|
||
|
# __file__ 在 config 中,所以返回上一级目录即项目根目录
|
||
|
ROOT_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__))).replace("\\", "/")
|
||
|
TOOL_NAME = "MetaFusion"
|
||
|
TOOL_VERSION = "Beta v1.0.0"
|
||
|
TOOL_AUTHOR = "Virtuos"
|
||
|
TOOL_LANG = 'en_US'
|
||
|
TOOL_WSCL_NAME = f"{TOOL_NAME}WorkSpaceControl"
|
||
|
TOOL_HELP_URL = f"https://gitea.cgnico.com/CGNICO/{TOOL_NAME}/wiki"
|
||
|
|
||
|
#===================================== 3. Paths =====================================
|
||
|
# PATHS
|
||
|
SCRIPTS_PATH = os.path.join(ROOT_PATH, "scripts").replace("\\", "/")
|
||
|
ICONS_PATH = os.path.join(ROOT_PATH, "resources", "icons").replace("\\", "/")
|
||
|
STYLES_PATH = os.path.join(ROOT_PATH, "resources", "styles").replace("\\", "/")
|
||
|
|
||
|
MAYA_VERSION = cmds.about(version=True)
|
||
|
SYSTEM_OS = cmds.about(os=True)
|
||
|
if MAYA_VERSION in ["2022", "2023", "2024", "2025"]:
|
||
|
PLUGIN_PATH = os.path.join(ROOT_PATH, "plugins", SYSTEM_OS, MAYA_VERSION).replace("\\", "/")
|
||
|
else:
|
||
|
print(f"MetaFusion is not supported on Maya {MAYA_VERSION}")
|
||
|
|
||
|
PYTHON_VERSION = sys.version_info.major
|
||
|
if PYTHON_VERSION == 3:
|
||
|
PYDNA_PATH = os.path.join(ROOT_PATH, "plugins", SYSTEM_OS, "python3").replace("\\", "/")
|
||
|
elif PYTHON_VERSION == 3.11:
|
||
|
PYDNA_PATH = os.path.join(ROOT_PATH, "plugins", SYSTEM_OS, "python311").replace("\\", "/")
|
||
|
elif PYTHON_VERSION == 3.9:
|
||
|
PYDNA_PATH = os.path.join(ROOT_PATH, "plugins", SYSTEM_OS, "python397").replace("\\", "/")
|
||
|
elif PYTHON_VERSION == 3.10:
|
||
|
PYDNA_PATH = os.path.join(ROOT_PATH, "plugins", SYSTEM_OS, "python3108").replace("\\", "/")
|
||
|
else:
|
||
|
print(f"MetaFusion is not supported on Python {PYTHON_VERSION}")
|
||
|
|
||
|
|
||
|
#===================================== 3. Files =====================================
|
||
|
# FILES
|
||
|
TOOL_MAIN_SCRIPT = os.path.join(SCRIPTS_PATH, f"{TOOL_NAME}.py").replace("\\", "/")
|
||
|
TOOL_STYLE_FILE = os.path.join(STYLES_PATH, "style.qss").replace("\\", "/")
|
||
|
TOOL_ICON = os.path.join(ICONS_PATH, f"{TOOL_NAME}Logo.png").replace("\\", "/")
|
||
|
TOOL_COMMAND_ICON = os.path.join(ICONS_PATH, "CommandButton.png").replace("\\", "/")
|
||
|
TOOL_MOD_FILENAME = f"{TOOL_NAME}.mod"
|
||
|
|
||
|
#===================================== 4. Qt =====================================
|
||
|
# Qt
|
||
|
def Qt():
|
||
|
try:
|
||
|
from PySide import QtCore, QtGui, QtWidgets
|
||
|
return QtCore, QtGui, QtWidgets
|
||
|
except ImportError:
|
||
|
try:
|
||
|
from PySide2 import QtCore, QtGui, QtWidgets
|
||
|
return QtCore, QtGui, QtWidgets
|
||
|
except ImportError:
|
||
|
try:
|
||
|
from PySide3 import QtCore, QtGui, QtWidgets
|
||
|
return QtCore, QtGui, QtWidgets
|
||
|
except ImportError:
|
||
|
try:
|
||
|
from PySide4 import QtCore, QtGui, QtWidgets
|
||
|
return QtCore, QtGui, QtWidgets
|
||
|
except ImportError:
|
||
|
try:
|
||
|
from PySide5 import QtCore, QtGui, QtWidgets
|
||
|
return QtCore, QtGui, QtWidgets
|
||
|
except ImportError:
|
||
|
try:
|
||
|
from PySide6 import QtCore, QtGui, QtWidgets
|
||
|
return QtCore, QtGui, QtWidgets
|
||
|
except ImportError:
|
||
|
print("未找到 Qt 模块")
|
||
|
return None, None, None
|
||
|
|
||
|
|
||
|
|