2025-02-05 22:39:45 +08:00
|
|
|
|
#!/usr/bin/env python
|
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
import sys
|
|
|
|
|
import maya.cmds as cmds
|
|
|
|
|
|
|
|
|
|
# Base Information
|
2025-02-06 04:00:17 +08:00
|
|
|
|
TOOL_NAME = str("MetaFusion")
|
|
|
|
|
TOOL_VERSION = str("Beta v1.0.0")
|
|
|
|
|
TOOL_AUTHOR = str("CGNICO")
|
|
|
|
|
TOOL_LANG = str('en_US')
|
|
|
|
|
TOOL_WSCL_NAME = str(f"{TOOL_NAME}WorkSpaceControl")
|
|
|
|
|
TOOL_HELP_URL = str(f"https://gitea.cgnico.com/CGNICO/{TOOL_NAME}/wiki")
|
2025-02-05 22:39:45 +08:00
|
|
|
|
|
|
|
|
|
# BASE_PATH
|
2025-02-06 04:08:52 +08:00
|
|
|
|
TOOL_PATH = str(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))).replace("\\", "/"))
|
|
|
|
|
SCRIPTS_PATH = str(os.path.join(TOOL_PATH, "scripts").replace("\\", "/"))
|
2025-02-06 04:00:17 +08:00
|
|
|
|
|
|
|
|
|
# 资源路径
|
2025-02-06 04:08:52 +08:00
|
|
|
|
RESOURCES_PATH = str(os.path.join(TOOL_PATH, "resources").replace("\\", "/"))
|
2025-02-06 04:00:17 +08:00
|
|
|
|
ICONS_PATH = str(os.path.join(RESOURCES_PATH, "icons").replace("\\", "/"))
|
|
|
|
|
STYLES_PATH = str(os.path.join(RESOURCES_PATH, "styles").replace("\\", "/"))
|
|
|
|
|
DNA_FILE_PATH = str(os.path.join(RESOURCES_PATH, "dna").replace("\\", "/"))
|
|
|
|
|
DNA_IMG_PATH = str(os.path.join(RESOURCES_PATH, "img").replace("\\", "/"))
|
|
|
|
|
|
|
|
|
|
# SYSTEM_INFO
|
|
|
|
|
SYSTEM_OS = str("Windows" if cmds.about(os=True).lower().startswith("win") else "Linux")
|
|
|
|
|
MAYA_VERSION = str(int(cmds.about(version=True).split('.')[0]))
|
|
|
|
|
|
|
|
|
|
# PYTHON_VERSION
|
|
|
|
|
PYTHON_VERSION = str(sys.version.replace(".", ""))
|
|
|
|
|
major_version = int(PYTHON_VERSION[0])
|
|
|
|
|
minor_version = int(PYTHON_VERSION[1:3]) if len(PYTHON_VERSION) > 1 else None
|
|
|
|
|
version_tuple = (major_version,) if minor_version is None else (major_version, minor_version)
|
|
|
|
|
|
|
|
|
|
# 版本映射表
|
|
|
|
|
PYTHON_VERSION_MAP = {
|
|
|
|
|
(3,): "python3", # 所有Python3主版本
|
|
|
|
|
(3, 9): "python397", # 3.9.x → python397
|
|
|
|
|
(3, 10): "python3108", # 3.10.x → python3108
|
|
|
|
|
(3, 11): "python311" # 3.11.x → python311
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# 获取Python版本目录
|
|
|
|
|
PYTHON_VERSION_DIR = str(PYTHON_VERSION_MAP.get(version_tuple, "python3"))
|
|
|
|
|
|
|
|
|
|
# PATHS
|
2025-02-06 04:08:52 +08:00
|
|
|
|
PLUGIN_PATH = str(os.path.join(TOOL_PATH, "plugins", SYSTEM_OS, MAYA_VERSION).replace("\\", "/"))
|
|
|
|
|
PYDNA_PATH = str(os.path.join(TOOL_PATH, "plugins", SYSTEM_OS, "pydna", PYTHON_VERSION_DIR).replace("\\", "/"))
|
2025-02-05 22:39:45 +08:00
|
|
|
|
|
|
|
|
|
# TOOLS_PATH
|
2025-02-06 04:08:52 +08:00
|
|
|
|
DNACALIB_PATH = str(os.path.join(TOOL_PATH, "dnacalib").replace("\\", "/"))
|
2025-02-06 04:00:17 +08:00
|
|
|
|
BUILDER_PATH = str(os.path.join(SCRIPTS_PATH, "builder").replace("\\", "/"))
|
|
|
|
|
DNALIB_PATH = str(os.path.join(SCRIPTS_PATH, "dnalib").replace("\\", "/"))
|
|
|
|
|
UI_PATH = str(os.path.join(SCRIPTS_PATH, "ui").replace("\\", "/"))
|
|
|
|
|
UTILS_PATH = str(os.path.join(SCRIPTS_PATH, "utils").replace("\\", "/"))
|
|
|
|
|
|
|
|
|
|
# FILES
|
|
|
|
|
TOOL_MAIN_SCRIPT = str(os.path.join(SCRIPTS_PATH, f"{TOOL_NAME}.py").replace("\\", "/"))
|
|
|
|
|
TOOL_STYLE_FILE = str(os.path.join(UI_PATH, "style.qss").replace("\\", "/"))
|
|
|
|
|
TOOL_ICON = str(os.path.join(ICONS_PATH, f"{TOOL_NAME}Logo.png").replace("\\", "/"))
|
|
|
|
|
TOOL_COMMAND_ICON = str(os.path.join(ICONS_PATH, "CommandButton.png").replace("\\", "/"))
|
|
|
|
|
TOOL_MOD_FILENAME = str(f"{TOOL_NAME}.mod")
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
validate_paths = {
|
2025-02-06 04:08:52 +08:00
|
|
|
|
TOOL_PATH,
|
2025-02-06 04:00:17 +08:00
|
|
|
|
SCRIPTS_PATH,
|
|
|
|
|
ICONS_PATH,
|
|
|
|
|
STYLES_PATH,
|
|
|
|
|
DNA_FILE_PATH,
|
|
|
|
|
DNA_IMG_PATH,
|
|
|
|
|
PLUGIN_PATH,
|
|
|
|
|
PYDNA_PATH,
|
|
|
|
|
DNACALIB_PATH,
|
|
|
|
|
BUILDER_PATH,
|
|
|
|
|
DNALIB_PATH,
|
|
|
|
|
UI_PATH,
|
|
|
|
|
UTILS_PATH
|
|
|
|
|
}
|
|
|
|
|
for i in validate_paths:
|
|
|
|
|
if not i in sys.path:
|
|
|
|
|
sys.path.append(i)
|
|
|
|
|
|
|
|
|
|
print("============================================")
|
|
|
|
|
print(f"TOOL_NAME: {TOOL_NAME}")
|
|
|
|
|
print(f"TOOL_VERSION: {TOOL_VERSION}")
|
|
|
|
|
print(f"TOOL_AUTHOR: {TOOL_AUTHOR}")
|
|
|
|
|
print(f"TOOL_LANG: {TOOL_LANG}")
|
|
|
|
|
print(f"TOOL_WSCL_NAME: {TOOL_WSCL_NAME}")
|
|
|
|
|
print(f"TOOL_HELP_URL: {TOOL_HELP_URL}")
|
|
|
|
|
|
2025-02-06 04:08:52 +08:00
|
|
|
|
print(f"TOOL_PATH: {TOOL_PATH}")
|
2025-02-06 04:00:17 +08:00
|
|
|
|
print(f"SCRIPTS_PATH: {SCRIPTS_PATH}")
|
|
|
|
|
print(f"ICONS_PATH: {ICONS_PATH}")
|
|
|
|
|
print(f"STYLES_PATH: {STYLES_PATH}")
|
|
|
|
|
print(f"DNA_FILE_PATH: {DNA_FILE_PATH}")
|
|
|
|
|
print(f"DNA_IMG_PATH: {DNA_IMG_PATH}")
|
|
|
|
|
|
|
|
|
|
print(f"PLUGIN_PATH: {PLUGIN_PATH}")
|
|
|
|
|
print(f"PYDNA_PATH: {PYDNA_PATH}")
|
|
|
|
|
|
|
|
|
|
print(f"DNACALIB_PATH: {DNACALIB_PATH}")
|
|
|
|
|
print(f"BUILDER_PATH: {BUILDER_PATH}")
|
|
|
|
|
print(f"DNALIB_PATH: {DNALIB_PATH}")
|
|
|
|
|
print(f"UI_PATH: {UI_PATH}")
|
|
|
|
|
print(f"UTILS_PATH: {UTILS_PATH}")
|
|
|
|
|
|
|
|
|
|
print(f"TOOL_MAIN_SCRIPT: {TOOL_MAIN_SCRIPT}")
|
|
|
|
|
print(f"TOOL_STYLE_FILE: {TOOL_STYLE_FILE}")
|
|
|
|
|
print(f"TOOL_ICON: {TOOL_ICON}")
|
|
|
|
|
print(f"TOOL_COMMAND_ICON: {TOOL_COMMAND_ICON}")
|
|
|
|
|
print(f"TOOL_MOD_FILENAME: {TOOL_MOD_FILENAME}")
|
2025-02-05 22:39:45 +08:00
|
|
|
|
|