This commit is contained in:
2025-11-30 14:49:16 +08:00
parent 021c593241
commit de46c4b073
1406 changed files with 526774 additions and 1221 deletions

View File

@@ -1,13 +1,16 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Site : Virtuos Games
# @Author : ZHou Shuhua
"""
Skin API UI Functions
提供权重导出、导入和解绑的用户界面函数
支持 Maya 所有版本,兼容 pymel cmds
Provides UI functions for weight export, import, and skin unbind
Supports all Maya versions with pymel and cmds compatibility
"""
# 尝试导入 pymel如果不可用则使用 cmds
# Try to import pymel, fall back to cmds if unavailable
try:
import pymel.core as pm
except ImportError:
@@ -27,7 +30,7 @@ def WeightExport():
Export skin weights for selected objects
"""
try:
# 检查是否有选中物体
# Check if there are selected objects
if pm:
selectedNodes = pm.ls(sl=True)
if not selectedNodes:
@@ -73,7 +76,7 @@ def WeightImport():
Import skin weights to selected or matching objects in scene
"""
try:
# 检查是否有选中物体
# Check if there are selected objects
if pm:
selectedNodes = pm.ls(sl=True)
else:
@@ -82,7 +85,7 @@ def WeightImport():
print(f"Import mode: {'selected objects' if useSelection else 'all matching objects'}")
# 使用 ApiVtxAttribs 类导入权重
# Use ApiVtxAttribs class to import weights
api = apiVtxAttribs.ApiVtxAttribs()
msg = api.importSkinWeights(selected=useSelection, stripJointNamespaces=False, addNewToHierarchy=True)
@@ -112,7 +115,7 @@ def WeightImport():
else:
cmds.warning(msg)
else:
# 成功导入
# Import successful
if pm:
pm.confirmDialog(
title="Import Complete",
@@ -140,11 +143,10 @@ def WeightImport():
def UnbindSkin():
"""
解绑选中物体的蒙皮
Unbind skin from selected objects
"""
try:
# 获取选中的物体
# Check selected objects
if pm:
selectedNodes = pm.ls(sl=True)
if not selectedNodes:
@@ -156,7 +158,7 @@ def UnbindSkin():
cmds.warning("Please select at least one object")
return
# 确认对话框
# Confirmation dialog
if pm:
result = pm.confirmDialog(
title="Unbind Skin",
@@ -180,7 +182,7 @@ def UnbindSkin():
print("Unbind cancelled")
return
# 使用 MEL 命令解绑蒙皮
# Use MEL command to unbind skin
mel.eval('doDetachSkin "2" { "1","1" };')
print("Skin unbound successfully!")