245 lines
5.7 KiB
Python
245 lines
5.7 KiB
Python
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
|
Definition function module
|
|
定义系统功能模块 - 提供定义系统相关的功能函数
|
|
"""
|
|
|
|
#===================================== IMPORT MODULES =====================================
|
|
import maya.cmds as cmds
|
|
import pymel.core as pm
|
|
import maya.mel as mel
|
|
from maya import OpenMayaUI as omui
|
|
from scripts.ui.Qt import QtWidgets, QtCore, QtGui
|
|
from scripts.ui.Qt.QtCompat import wrapInstance
|
|
import webbrowser
|
|
import subprocess
|
|
import importlib
|
|
import traceback
|
|
import sys
|
|
import os
|
|
# 导入配置
|
|
import config
|
|
TOOL_NAME = config.TOOL_NAME
|
|
TOOL_VERSION = config.TOOL_VERSION
|
|
TOOL_AUTHOR = config.TOOL_AUTHOR
|
|
TOOL_YEAR = config.TOOL_YEAR
|
|
TOOL_MOD_FILENAME = config.TOOL_MOD_FILENAME
|
|
TOOL_LANG = config.TOOL_LANG
|
|
TOOL_WSCL_NAME = config.TOOL_WSCL_NAME
|
|
TOOL_HELP_URL = config.TOOL_HELP_URL
|
|
TOOL_PATH = config.TOOL_PATH
|
|
SCRIPTS_PATH = config.SCRIPTS_PATH
|
|
TOOL_MAIN_SCRIPT = config.TOOL_MAIN_SCRIPT
|
|
UI_PATH = config.UI_PATH
|
|
STYLE_FILE = config.STYLE_FILE
|
|
ICONS_PATH = config.ICONS_PATH
|
|
TOOL_ICON = config.TOOL_ICON
|
|
ASSETS_PATH = config.ASSETS_PATH
|
|
DNA_FILE_PATH = config.DNA_FILE_PATH
|
|
DNA_IMG_PATH = config.DNA_IMG_PATH
|
|
TOOL_COMMAND_ICON = config.TOOL_COMMAND_ICON
|
|
TOOL_WIDTH = config.TOOL_WIDTH
|
|
TOOL_HEIGHT = config.TOOL_HEIGHT
|
|
# Localization
|
|
from scripts.ui import localization
|
|
TEXT = localization.TEXT
|
|
#========================================== FUNCTIONS ========================================
|
|
|
|
# 左侧面板功能
|
|
# LODs相关功能
|
|
def lod_selected(item):
|
|
"""
|
|
LOD项目被选中
|
|
"""
|
|
print(f"LOD项目被选中: {item.text()}")
|
|
# 这里实现LOD项目选中的功能
|
|
return True
|
|
|
|
def update_lod_selection():
|
|
"""
|
|
更新LOD选择
|
|
"""
|
|
print("更新LOD选择")
|
|
# 这里实现更新LOD选择的功能
|
|
return True
|
|
|
|
def define_lod_relations():
|
|
"""
|
|
定义LOD关联
|
|
"""
|
|
print("定义LOD关联")
|
|
# 这里实现定义LOD关联的功能
|
|
return True
|
|
|
|
# Meshes相关功能
|
|
def mesh_selected(item):
|
|
"""
|
|
网格项目被选中
|
|
"""
|
|
print(f"网格项目被选中: {item.text()}")
|
|
# 这里实现网格项目选中的功能
|
|
return True
|
|
|
|
def update_mesh_selection():
|
|
"""
|
|
更新网格选择
|
|
"""
|
|
print("更新网格选择")
|
|
# 这里实现更新网格选择的功能
|
|
return True
|
|
|
|
def create_geometry():
|
|
"""
|
|
创建几何体
|
|
"""
|
|
print("创建几何体")
|
|
# 这里实现创建几何体的功能
|
|
return True
|
|
|
|
# 右侧面板功能
|
|
# Joints相关功能
|
|
def joint_selected(item):
|
|
"""
|
|
关节项目被选中
|
|
"""
|
|
print(f"关节项目被选中: {item.text()}")
|
|
# 这里实现关节项目选中的功能
|
|
return True
|
|
|
|
def update_joint_selection():
|
|
"""
|
|
更新关节选择
|
|
"""
|
|
print("更新关节选择")
|
|
# 这里实现更新关节选择的功能
|
|
return True
|
|
|
|
# BlendShapes相关功能
|
|
def blendshape_selected(item):
|
|
"""
|
|
形状混合项目被选中
|
|
"""
|
|
print(f"形状混合项目被选中: {item.text()}")
|
|
# 这里实现形状混合项目选中的功能
|
|
return True
|
|
|
|
def update_blendshape_selection():
|
|
"""
|
|
更新形状混合选择
|
|
"""
|
|
print("更新形状混合选择")
|
|
# 这里实现更新形状混合选择的功能
|
|
return True
|
|
|
|
# AnimatedMap相关功能
|
|
def animatedmap_selected(item):
|
|
"""
|
|
动画贴图项目被选中
|
|
"""
|
|
print(f"动画贴图项目被选中: {item.text()}")
|
|
# 这里实现动画贴图项目选中的功能
|
|
return True
|
|
|
|
def update_animatedmap_selection():
|
|
"""
|
|
更新动画贴图选择
|
|
"""
|
|
print("更新动画贴图选择")
|
|
# 这里实现更新动画贴图选择的功能
|
|
return True
|
|
|
|
# 底部工具面板功能
|
|
# 写入部分功能
|
|
def write_neutral_pose_joint_position():
|
|
"""
|
|
写入中性姿势关节位置
|
|
"""
|
|
print("写入中性姿势关节位置")
|
|
# TODO: 实现写入中性姿势关节位置的逻辑
|
|
return True
|
|
|
|
def write_geometry():
|
|
"""
|
|
写入几何体
|
|
"""
|
|
print("写入几何体")
|
|
# TODO: 实现写入几何体的逻辑
|
|
return True
|
|
|
|
def write_skin_weight():
|
|
"""
|
|
写入蒙皮权重
|
|
"""
|
|
print("写入蒙皮权重")
|
|
# TODO: 实现写入蒙皮权重的逻辑
|
|
return True
|
|
|
|
def write_blendshape_target():
|
|
"""
|
|
写入BlendShapes目标
|
|
"""
|
|
print("写入BlendShapes目标")
|
|
# TODO: 实现写入BlendShapes目标的逻辑
|
|
return True
|
|
|
|
# 创建部分功能
|
|
def create_blendshapes_for_mesh():
|
|
"""
|
|
为网格创建BlendShapes
|
|
"""
|
|
print("为网格创建BlendShapes")
|
|
# TODO: 实现为网格创建BlendShapes的逻辑
|
|
return True
|
|
|
|
def create_skin_for_mesh():
|
|
"""
|
|
为网格绑定蒙皮
|
|
"""
|
|
print("为网格绑定蒙皮")
|
|
# TODO: 实现为网格绑定蒙皮的逻辑
|
|
return True
|
|
|
|
def unbind_skin_for_mesh():
|
|
"""
|
|
取消网格蒙皮
|
|
"""
|
|
print("取消网格蒙皮")
|
|
# TODO: 实现取消网格蒙皮的逻辑
|
|
return True
|
|
|
|
# 工具部分功能
|
|
def new_head_netural_joint_transform():
|
|
"""
|
|
新建头部中性关节变换
|
|
"""
|
|
print("新建头部中性关节变换")
|
|
# TODO: 实现新建头部中性关节变换的逻辑
|
|
return True
|
|
|
|
def new_body_netural_joint_transform():
|
|
"""
|
|
新建身体中性关节变换
|
|
"""
|
|
print("新建身体中性关节变换")
|
|
# TODO: 实现新建身体中性关节变换的逻辑
|
|
return True
|
|
|
|
def new_netural_joint_transform():
|
|
"""
|
|
新建中性关节变换
|
|
"""
|
|
print("新建中性关节变换")
|
|
# TODO: 实现新建中性关节变换的逻辑
|
|
return True
|
|
|
|
def quick_create_preset():
|
|
"""
|
|
快速创建预设
|
|
"""
|
|
print("快速创建预设")
|
|
# TODO: 实现快速创建预设的逻辑
|
|
return True
|
|
|