#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys import json # Basic Information TOOL_NAME = "MetaFusion" TOOL_VERSION = "Alpha v1.0.0" TOOL_AUTHOR = "CGNICO" TOOL_YEAR = "2025" TOOL_MOD_FILENAME = f"{TOOL_NAME.lower()}.mod" TOOL_LANG = "en_US" TOOL_WSCL_NAME = f"{TOOL_NAME}WorkspaceControl" TOOL_HELP_URL = f"https://gitea.cgnico.com/CGNICO/{TOOL_NAME}/wiki" # Path Configuration TOOL_PATH = os.path.dirname(os.path.abspath(__file__)).replace("\\", "/") SCRIPTS_PATH = os.path.join(TOOL_PATH, "scripts").replace("\\", "/") TOOL_MAIN_SCRIPT = os.path.join(TOOL_PATH, "scripts", "Main.py").replace("\\", "/") UI_PATH = os.path.join(TOOL_PATH, "scripts", "ui").replace("\\", "/") STYLE_FILE = os.path.join(TOOL_PATH, "scripts", "ui", "style.qss").replace("\\", "/") ICONS_PATH = os.path.join(TOOL_PATH, "icons").replace("\\", "/") TOOL_ICON = os.path.join(TOOL_PATH, "icons", "logo.png").replace("\\", "/") ASSETS_PATH = os.path.join(TOOL_PATH, "assets").replace("\\", "/") DNA_FILE_PATH = os.path.join(TOOL_PATH, "assets", "dna").replace("\\", "/") DNA_IMG_PATH = os.path.join(TOOL_PATH, "assets", "img").replace("\\", "/") TOOL_COMMAND_ICON = TOOL_ICON # UI 默认尺寸 TOOL_HEIGHT = 800 TOOL_WIDTH = 600 # DNA Config # GUI相关常量 GUI_HOLDER = "GUI_Holder" ANALOG_GUI_HOLDER = "Analog_GUI_Holder" RIG_LOGIC_PREFIX = "rl4Embedded_" # 用于打印蒙皮权重的范围 SKIN_WEIGHT_PRINT_RANGE = 2000 # System Information import maya.cmds as cmds SYSTEM_OS = "Windows" if cmds.about(os=True).lower().startswith("win") else "Linux" # Define Maya version as integer for easier version comparison MAYA_VERSION = str(int(cmds.about(version=True).split('.')[0])) # Plugins Path def get_pydna_dir(): """Get Python version directory name""" version = sys.version_info if version.major == 3: if version.minor == 9 and version.micro == 7: return "python397" elif version.minor == 10 and version.micro == 8: return "python3108" elif version.minor == 11: return "python311" return "python3" PYVERSION_DIR = get_pydna_dir() PLUGINS_PATH = os.path.join(TOOL_PATH, "plugins", SYSTEM_OS, MAYA_VERSION).replace("\\", "/") PYDNA_PATH = os.path.join(TOOL_PATH, "plugins", SYSTEM_OS, "pydna", PYVERSION_DIR).replace("\\", "/") # Initialize Paths def init_paths(): """Initialize paths""" paths = [ TOOL_PATH, SCRIPTS_PATH, ICONS_PATH, ASSETS_PATH, DNA_FILE_PATH, DNA_IMG_PATH, UI_PATH, PLUGINS_PATH, PYDNA_PATH, STYLE_FILE ] for path in paths: if not os.path.exists(path): try: os.makedirs(path) print(f"Created directory: {path}") except Exception as e: print(f"Failed to create directory: {path}, error: {str(e)}") if __name__ == "__main__": # Initialize paths init_paths()