Update
This commit is contained in:
parent
f91643cc52
commit
8934fc8db4
@ -1,80 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 深圳时光科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2024/03/20
|
|
||||||
"""
|
|
||||||
|
|
||||||
import os
|
|
||||||
import maya.cmds as cmds
|
|
||||||
|
|
||||||
def sg_unload_plugin():
|
|
||||||
"""
|
|
||||||
卸载当前Maya版本的插件
|
|
||||||
"""
|
|
||||||
# 获取Maya版本
|
|
||||||
version = cmds.about(version=True)
|
|
||||||
plugin_name = f"SuperRiggingEditor{version}"
|
|
||||||
|
|
||||||
# 如果插件已加载,则卸载
|
|
||||||
if cmds.pluginInfo(plugin_name, query=True, loaded=True):
|
|
||||||
cmds.unloadPlugin(plugin_name)
|
|
||||||
|
|
||||||
def sg_update_plugin():
|
|
||||||
"""
|
|
||||||
更新插件文件
|
|
||||||
从更新文件夹复制新版本插件到对应的插件目录
|
|
||||||
"""
|
|
||||||
# 获取更新文件夹路径
|
|
||||||
sg_path = os.environ.get("SG_PATH")
|
|
||||||
update_folder = os.path.join(sg_path, "plug-ins-update")
|
|
||||||
|
|
||||||
# 检查更新文件夹是否存在
|
|
||||||
if os.path.exists(update_folder):
|
|
||||||
# 卸载当前插件
|
|
||||||
sg_unload_plugin()
|
|
||||||
|
|
||||||
# 支持的Maya版本列表
|
|
||||||
versions = ["2018", "2019", "2020", "2022", "2023", "2024"]
|
|
||||||
|
|
||||||
# 处理每个版本的插件
|
|
||||||
for version in versions:
|
|
||||||
# 构建路径
|
|
||||||
update_path = os.path.join(sg_path, "plug-ins-update", version)
|
|
||||||
target_path = os.path.join(sg_path, "plug-ins", version)
|
|
||||||
|
|
||||||
# 获取需要更新的插件文件列表
|
|
||||||
if os.path.exists(update_path):
|
|
||||||
plugins = [f for f in os.listdir(update_path) if f.endswith('.mll')]
|
|
||||||
|
|
||||||
# 更新每个插件
|
|
||||||
for plugin in plugins:
|
|
||||||
new_file = os.path.join(update_path, plugin)
|
|
||||||
old_file = os.path.join(target_path, plugin)
|
|
||||||
|
|
||||||
try:
|
|
||||||
# 复制新文件到目标位置
|
|
||||||
if os.path.exists(new_file):
|
|
||||||
os.replace(old_file, new_file)
|
|
||||||
print(f"{old_file} update succeeded...")
|
|
||||||
os.remove(new_file)
|
|
||||||
except Exception as e:
|
|
||||||
print(f"{old_file} update failed: {str(e)}")
|
|
||||||
|
|
||||||
# 删除空的更新目录
|
|
||||||
try:
|
|
||||||
os.rmdir(update_path)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
# 删除空的更新主目录
|
|
||||||
try:
|
|
||||||
os.rmdir(update_folder)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
# 如果直接运行此脚本
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sg_update_plugin()
|
|
@ -1,9 +0,0 @@
|
|||||||
from maya import cmds, mel, utils
|
|
||||||
|
|
||||||
def SuperRiggingInstallations():
|
|
||||||
if not cmds.about(batch=True):
|
|
||||||
mel.eval("SGUpdatePlugin;")
|
|
||||||
mel.eval("SGCreateMenuItem;")
|
|
||||||
mel.eval("SGEnableJointOrient;")
|
|
||||||
|
|
||||||
utils.executeDeferred(SuperRiggingInstallations)
|
|
@ -1,15 +1,10 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 清泉时代科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2024/09/16
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def sg_add_blend_shape(target_name):
|
def add_blend_shape(target_name):
|
||||||
"""
|
"""
|
||||||
为选中的模型添加混合变形目标
|
为选中的模型添加混合变形目标
|
||||||
|
|
||||||
@ -22,16 +17,16 @@ def sg_add_blend_shape(target_name):
|
|||||||
for sel in selection:
|
for sel in selection:
|
||||||
# 遍历50个可能的网格体
|
# 遍历50个可能的网格体
|
||||||
for j in range(50):
|
for j in range(50):
|
||||||
mesh = cmds.SGGetMeshes(m=j) # 假设SGGetMeshes是一个自定义命令
|
mesh = mfc.GetMeshes(m=j) # GetMeshes是一个自定义命令
|
||||||
|
|
||||||
if sel == mesh:
|
if sel == mesh:
|
||||||
if target_name:
|
if target_name:
|
||||||
# 获取混合变形节点名称
|
# 获取混合变形节点名称
|
||||||
blend_shape = cmds.SGGetBlendShape(mesh) # 假设SGGetBlendShape是一个自定义命令
|
blend_shape = mfc.GetBlendShape(mesh) # GetBlendShape是一个自定义命令
|
||||||
|
|
||||||
# 如果混合变形节点不存在,创建一个新的
|
# 如果混合变形节点不存在,创建一个新的
|
||||||
if not cmds.objExists(blend_shape):
|
if not cmds.objExists(blend_shape):
|
||||||
blend_shape = cmds.SGGetMeshes(i=j) + "_blendShapes"
|
blend_shape = mfc.GetMeshes(i=j) + "_blendShapes"
|
||||||
cmds.blendShape(mesh, automatic=True, name=blend_shape)
|
cmds.blendShape(mesh, automatic=True, name=blend_shape)
|
||||||
|
|
||||||
# 获取权重属性路径
|
# 获取权重属性路径
|
@ -1,13 +1,8 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 清泉时代科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2024/03/20
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def sg_automatic_grouping():
|
def sg_automatic_grouping():
|
||||||
"""
|
"""
|
||||||
@ -18,7 +13,7 @@ def sg_automatic_grouping():
|
|||||||
# 处理head模型的LOD分组
|
# 处理head模型的LOD分组
|
||||||
for i in range(8):
|
for i in range(8):
|
||||||
# 获取当前LOD级别的网格体索引列表
|
# 获取当前LOD级别的网格体索引列表
|
||||||
lod_mesh_indices = cmds.SGGetMeshes(lod=i)
|
lod_mesh_indices = mfc.GetMeshes(lod=i)
|
||||||
group_name = f"head_lod{i}_grp"
|
group_name = f"head_lod{i}_grp"
|
||||||
|
|
||||||
# 如果分组不存在则创建
|
# 如果分组不存在则创建
|
||||||
@ -32,7 +27,7 @@ def sg_automatic_grouping():
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# 获取网格体名称
|
# 获取网格体名称
|
||||||
mesh = cmds.SGGetMeshes(m=mesh_index)
|
mesh = mfc.GetMeshes(m=mesh_index)
|
||||||
|
|
||||||
# 如果网格体存在,将其放入对应分组
|
# 如果网格体存在,将其放入对应分组
|
||||||
if cmds.objExists(mesh):
|
if cmds.objExists(mesh):
|
||||||
@ -52,7 +47,7 @@ def sg_automatic_grouping():
|
|||||||
# 遍历处理body的4个LOD级别
|
# 遍历处理body的4个LOD级别
|
||||||
for i in range(4):
|
for i in range(4):
|
||||||
body_index = 50 + i
|
body_index = 50 + i
|
||||||
mesh = cmds.SGGetMeshes(m=body_index)
|
mesh = mfc.GetMeshes(m=body_index)
|
||||||
|
|
||||||
# 如果分组不存在则创建
|
# 如果分组不存在则创建
|
||||||
if not cmds.objExists(body_groups[i]):
|
if not cmds.objExists(body_groups[i]):
|
@ -1,14 +1,9 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 清泉时代科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2024/09/24
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
import re
|
import re
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def sg_batch_add_blend_shape(lod, meshes):
|
def sg_batch_add_blend_shape(lod, meshes):
|
||||||
"""
|
"""
|
||||||
@ -19,15 +14,15 @@ def sg_batch_add_blend_shape(lod, meshes):
|
|||||||
meshes (list): 要处理的网格体名称列表
|
meshes (list): 要处理的网格体名称列表
|
||||||
"""
|
"""
|
||||||
# 获取指定LOD级别的所有网格体索引
|
# 获取指定LOD级别的所有网格体索引
|
||||||
mesh_indices = cmds.SGGetMeshes(lod=lod)
|
mesh_indices = mfc.GetMeshes(lod=lod)
|
||||||
|
|
||||||
# 开始进度条
|
# 开始进度条
|
||||||
cmds.SGProgressBar(sp=True)
|
mfc.ProgressBar(sp=True)
|
||||||
|
|
||||||
for mesh_index in mesh_indices:
|
for mesh_index in mesh_indices:
|
||||||
mesh = cmds.SGGetMeshes(m=mesh_index)
|
mesh = mfc.GetMeshes(m=mesh_index)
|
||||||
if cmds.objExists(mesh):
|
if cmds.objExists(mesh):
|
||||||
lod_mesh = cmds.SGGetMeshes(i=mesh_index)
|
lod_mesh = mfc.GetMeshes(i=mesh_index)
|
||||||
# 使用正则表达式匹配第一个下划线前的内容
|
# 使用正则表达式匹配第一个下划线前的内容
|
||||||
head = re.match(r'[^_]+', lod_mesh).group(0)
|
head = re.match(r'[^_]+', lod_mesh).group(0)
|
||||||
|
|
||||||
@ -52,23 +47,23 @@ def sg_batch_add_blend_shape(lod, meshes):
|
|||||||
|
|
||||||
if head in target_count_map:
|
if head in target_count_map:
|
||||||
target_count = target_count_map[head]
|
target_count = target_count_map[head]
|
||||||
count = cmds.SGGetBlendShapes(tc=target_count)
|
count = mfc.GetBlendShapes(tc=target_count)
|
||||||
|
|
||||||
# 设置进度条
|
# 设置进度条
|
||||||
cmds.SGProgressBar(max=count)
|
mfc.ProgressBar(max=count)
|
||||||
cmds.SGProgressBar(t=f"[{blend_shape}] Creating Target Mesh...")
|
mfc.ProgressBar(t=f"[{blend_shape}] Creating Target Mesh...")
|
||||||
|
|
||||||
# 创建混合变形目标
|
# 创建混合变形目标
|
||||||
for index in range(count):
|
for index in range(count):
|
||||||
cmds.SGProgressBar(apr=1)
|
mfc.ProgressBar(apr=1)
|
||||||
bs_name = cmds.SGGetBlendShapes(bsn=target_count, index=index)
|
bs_name = mfc.GetBlendShapes(bsn=target_count, index=index)
|
||||||
|
|
||||||
# 复制网格体作为目标
|
# 复制网格体作为目标
|
||||||
cmds.duplicate(mesh, returnRootsOnly=True, name=bs_name)
|
cmds.duplicate(mesh, returnRootsOnly=True, name=bs_name)
|
||||||
|
|
||||||
# 对LOD0级别的特定模型设置混合变形目标
|
# 对LOD0级别的特定模型设置混合变形目标
|
||||||
if lod == 0 and (head in ["head", "teeth", "cartilage"]):
|
if lod == 0 and (head in ["head", "teeth", "cartilage"]):
|
||||||
cmds.SGSetBlendShapes(ct=mesh_index, index=index, target=bs_name)
|
mfc.SetBlendShapes(ct=mesh_index, index=index, target=bs_name)
|
||||||
|
|
||||||
# 添加混合变形目标
|
# 添加混合变形目标
|
||||||
cmds.blendShape(
|
cmds.blendShape(
|
||||||
@ -83,4 +78,4 @@ def sg_batch_add_blend_shape(lod, meshes):
|
|||||||
cmds.delete(bs_name)
|
cmds.delete(bs_name)
|
||||||
|
|
||||||
# 结束进度条
|
# 结束进度条
|
||||||
cmds.SGProgressBar(ep=True)
|
mfc.ProgressBar(ep=True)
|
@ -1,14 +1,9 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 清泉时代科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2024/09/24
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
import re
|
import re
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def sg_batch_del_blend_shape(lod, meshes):
|
def sg_batch_del_blend_shape(lod, meshes):
|
||||||
"""
|
"""
|
||||||
@ -19,15 +14,15 @@ def sg_batch_del_blend_shape(lod, meshes):
|
|||||||
meshes (list): 要处理的网格体名称列表
|
meshes (list): 要处理的网格体名称列表
|
||||||
"""
|
"""
|
||||||
# 获取指定LOD级别的所有网格体索引
|
# 获取指定LOD级别的所有网格体索引
|
||||||
mesh_indices = cmds.SGGetMeshes(lod=lod)
|
mesh_indices = mfc.GetMeshes(lod=lod)
|
||||||
|
|
||||||
for mesh_index in mesh_indices:
|
for mesh_index in mesh_indices:
|
||||||
# 获取网格体名称
|
# 获取网格体名称
|
||||||
mesh = cmds.SGGetMeshes(m=mesh_index)
|
mesh = mfc.GetMeshes(m=mesh_index)
|
||||||
|
|
||||||
if cmds.objExists(mesh):
|
if cmds.objExists(mesh):
|
||||||
# 获取LOD网格体名称
|
# 获取LOD网格体名称
|
||||||
lod_mesh = cmds.SGGetMeshes(i=mesh_index)
|
lod_mesh = mfc.GetMeshes(i=mesh_index)
|
||||||
|
|
||||||
# 使用正则表达式匹配第一个下划线前的内容
|
# 使用正则表达式匹配第一个下划线前的内容
|
||||||
head = re.match(r'[^_]+', lod_mesh).group(0)
|
head = re.match(r'[^_]+', lod_mesh).group(0)
|
@ -1,14 +1,9 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 清泉时代科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
import maya.mel as mel
|
import maya.mel as mel
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def sg_get_orig_name(geo):
|
def sg_get_orig_name(geo):
|
||||||
"""
|
"""
|
||||||
@ -60,20 +55,20 @@ def sg_bind_pose_reset(objs):
|
|||||||
objs (list): 要处理的模型列表
|
objs (list): 要处理的模型列表
|
||||||
"""
|
"""
|
||||||
# 开始进度条
|
# 开始进度条
|
||||||
cmds.SGProgressBar(sp=True)
|
mfc.ProgressBar(sp=True)
|
||||||
cmds.SGProgressBar(max=len(objs))
|
mfc.ProgressBar(max=len(objs))
|
||||||
|
|
||||||
for obj in objs:
|
for obj in objs:
|
||||||
# 更新进度条
|
# 更新进度条
|
||||||
cmds.SGProgressBar(t=f"[{obj}] Bind Pose Reset...")
|
mfc.ProgressBar(t=f"[{obj}] Bind Pose Reset...")
|
||||||
cmds.SGProgressBar(apr=1)
|
mfc.ProgressBar(apr=1)
|
||||||
|
|
||||||
# 获取蒙皮变形节点
|
# 获取蒙皮变形节点
|
||||||
skin_cluster = mel.eval(f'findRelatedSkinCluster("{obj}")')
|
skin_cluster = mel.eval(f'findRelatedSkinCluster("{obj}")')
|
||||||
|
|
||||||
if cmds.objExists(skin_cluster):
|
if cmds.objExists(skin_cluster):
|
||||||
# 获取混合变形节点
|
# 获取混合变形节点
|
||||||
blend_shape = cmds.SGGetBlendShape(obj)
|
blend_shape = mfc.GetBlendShape(obj)
|
||||||
|
|
||||||
# 创建临时复制模型
|
# 创建临时复制模型
|
||||||
copy_name = cmds.duplicate(obj, name=f"{obj}_CopyTarget", returnRootsOnly=True)
|
copy_name = cmds.duplicate(obj, name=f"{obj}_CopyTarget", returnRootsOnly=True)
|
||||||
@ -149,4 +144,4 @@ def sg_bind_pose_reset(objs):
|
|||||||
cmds.delete(copy_name[0])
|
cmds.delete(copy_name[0])
|
||||||
|
|
||||||
# 结束进度条
|
# 结束进度条
|
||||||
cmds.SGProgressBar(ep=True)
|
mfc.ProgressBar(ep=True)
|
@ -1,16 +1,11 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 清泉时代科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2024/03/26
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
import maya.mel as mel
|
import maya.mel as mel
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def sg_bind_skin_cluster():
|
def bind_skin_cluster():
|
||||||
"""
|
"""
|
||||||
为模型绑定蒙皮变形器
|
为模型绑定蒙皮变形器
|
||||||
- 处理LOD0到LOD7的所有模型
|
- 处理LOD0到LOD7的所有模型
|
||||||
@ -20,7 +15,7 @@ def sg_bind_skin_cluster():
|
|||||||
# 遍历8个LOD级别
|
# 遍历8个LOD级别
|
||||||
for i in range(8):
|
for i in range(8):
|
||||||
# 获取当前LOD级别的骨骼列表
|
# 获取当前LOD级别的骨骼列表
|
||||||
joint_lod = cmds.SGGetJoints(lod=i, type="string")
|
joint_lod = mfc.GetJoints(lod=i, type="string")
|
||||||
|
|
||||||
# 检查所有骨骼是否存在
|
# 检查所有骨骼是否存在
|
||||||
exists = True
|
exists = True
|
||||||
@ -32,12 +27,12 @@ def sg_bind_skin_cluster():
|
|||||||
# 如果所有骨骼都存在,处理当前LOD级别的模型
|
# 如果所有骨骼都存在,处理当前LOD级别的模型
|
||||||
if exists:
|
if exists:
|
||||||
# 获取当前LOD级别的模型索引列表
|
# 获取当前LOD级别的模型索引列表
|
||||||
lod_indices = cmds.SGGetMeshes(lod=i)
|
lod_indices = mfc.GetMeshes(lod=i)
|
||||||
|
|
||||||
# 遍历处理每个模型
|
# 遍历处理每个模型
|
||||||
for mesh_index in lod_indices:
|
for mesh_index in lod_indices:
|
||||||
# 获取模型名称
|
# 获取模型名称
|
||||||
mesh = cmds.SGGetMeshes(m=mesh_index)
|
mesh = mfc.GetMeshes(m=mesh_index)
|
||||||
|
|
||||||
if cmds.objExists(mesh):
|
if cmds.objExists(mesh):
|
||||||
# 检查是否已经有蒙皮变形器
|
# 检查是否已经有蒙皮变形器
|
||||||
@ -45,11 +40,11 @@ def sg_bind_skin_cluster():
|
|||||||
|
|
||||||
if not cmds.objExists(skin_cluster):
|
if not cmds.objExists(skin_cluster):
|
||||||
# 构建蒙皮变形器名称
|
# 构建蒙皮变形器名称
|
||||||
name = f"{cmds.SGGetMeshes(i=mesh_index)}_skinCluster"
|
name = f"{mfc.GetMeshes(i=mesh_index)}_skinCluster"
|
||||||
|
|
||||||
# 获取影响骨骼和最大影响数
|
# 获取影响骨骼和最大影响数
|
||||||
influences = cmds.SGGetJoints(inf=mesh_index)
|
influences = mfc.GetJoints(inf=mesh_index)
|
||||||
max_influences = cmds.SGGetJoints(mi=mesh_index)
|
max_influences = mfc.GetJoints(mi=mesh_index)
|
||||||
|
|
||||||
# 创建蒙皮变形器
|
# 创建蒙皮变形器
|
||||||
cmds.skinCluster(
|
cmds.skinCluster(
|
||||||
@ -61,4 +56,4 @@ def sg_bind_skin_cluster():
|
|||||||
)
|
)
|
||||||
|
|
||||||
# 执行权重绑定
|
# 执行权重绑定
|
||||||
mel.eval('SGBindSkinClusterWeights')
|
mel.eval('BindSkinClusterWeights')
|
@ -1,12 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 清泉时代科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
import maya.mel as mel
|
import maya.mel as mel
|
||||||
|
|
@ -1,12 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 清泉时代科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
import maya.mel as mel
|
import maya.mel as mel
|
||||||
|
|
@ -1,12 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 清泉时代科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
import maya.mel as mel
|
import maya.mel as mel
|
||||||
|
|
@ -1,14 +1,10 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 清泉时代科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/10/31
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
import maya.mel as mel
|
import maya.mel as mel
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
import CopySkin
|
||||||
|
|
||||||
def sg_clothing_weight():
|
def sg_clothing_weight():
|
||||||
"""
|
"""
|
||||||
@ -21,8 +17,8 @@ def sg_clothing_weight():
|
|||||||
selection = cmds.ls(selection=True)
|
selection = cmds.ls(selection=True)
|
||||||
|
|
||||||
# 获取头部和身体模型
|
# 获取头部和身体模型
|
||||||
head = cmds.SGGetMeshes(m=0)
|
head = mfc.GetMeshes(m=0)
|
||||||
body = cmds.SGGetMeshes(m=50)
|
body = mfc.GetMeshes(m=50)
|
||||||
|
|
||||||
# 清除选择并选择身体和目标模型
|
# 清除选择并选择身体和目标模型
|
||||||
cmds.select(clear=True)
|
cmds.select(clear=True)
|
||||||
@ -30,7 +26,7 @@ def sg_clothing_weight():
|
|||||||
cmds.select(selection, add=True)
|
cmds.select(selection, add=True)
|
||||||
|
|
||||||
# 执行蒙皮复制
|
# 执行蒙皮复制
|
||||||
mel.eval('SGCopySkin')
|
CopySkin.sg_copy_skin()
|
||||||
|
|
||||||
# 为每个选中的模型复制头部和身体的权重
|
# 为每个选中的模型复制头部和身体的权重
|
||||||
for obj in selection:
|
for obj in selection:
|
@ -1,12 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 清泉时代科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
import maya.mel as mel
|
import maya.mel as mel
|
||||||
|
|
@ -1,13 +1,8 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 清泉时代科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def sg_copy_meshes(name):
|
def sg_copy_meshes(name):
|
||||||
"""
|
"""
|
||||||
@ -17,7 +12,7 @@ def sg_copy_meshes(name):
|
|||||||
name (str): 组名称
|
name (str): 组名称
|
||||||
"""
|
"""
|
||||||
# 获取所有需要处理的网格体
|
# 获取所有需要处理的网格体
|
||||||
meshes = [cmds.SGGetMeshes(m=i) for i in range(9)]
|
meshes = [mfc.GetMeshes(m=i) for i in range(9)]
|
||||||
|
|
||||||
# 创建组
|
# 创建组
|
||||||
if not cmds.objExists(name):
|
if not cmds.objExists(name):
|
||||||
@ -40,7 +35,7 @@ def sg_merge_blend_shape(arkit_list):
|
|||||||
arkit_list (list): ARKit表情目标列表
|
arkit_list (list): ARKit表情目标列表
|
||||||
"""
|
"""
|
||||||
# 获取所有需要处理的网格体
|
# 获取所有需要处理的网格体
|
||||||
meshes = [cmds.SGGetMeshes(m=i) for i in range(9)]
|
meshes = [mfc.GetMeshes(m=i) for i in range(9)]
|
||||||
|
|
||||||
# 处理每个网格体
|
# 处理每个网格体
|
||||||
for mesh in meshes:
|
for mesh in meshes:
|
@ -1,13 +1,8 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 清泉时代科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def sg_create_blend_shape():
|
def sg_create_blend_shape():
|
||||||
"""
|
"""
|
||||||
@ -17,28 +12,28 @@ def sg_create_blend_shape():
|
|||||||
- 显示进度条指示创建进度
|
- 显示进度条指示创建进度
|
||||||
"""
|
"""
|
||||||
# 开始进度条
|
# 开始进度条
|
||||||
cmds.SGProgressBar(sp=True)
|
mfc.ProgressBar(sp=True)
|
||||||
|
|
||||||
# 遍历处理每个模型
|
# 遍历处理每个模型
|
||||||
for mesh_index in range(50):
|
for mesh_index in range(50):
|
||||||
# 获取模型名称
|
# 获取模型名称
|
||||||
mesh = cmds.SGGetMeshes(m=mesh_index)
|
mesh = mfc.GetMeshes(m=mesh_index)
|
||||||
|
|
||||||
if cmds.objExists(mesh):
|
if cmds.objExists(mesh):
|
||||||
# 获取混合变形节点名称
|
# 获取混合变形节点名称
|
||||||
blend_shape = cmds.SGGetBlendShape(mesh)
|
blend_shape = mfc.GetBlendShape(mesh)
|
||||||
|
|
||||||
# 获取目标数量
|
# 获取目标数量
|
||||||
count = cmds.SGGetBlendShapes(dr="r", tc=mesh_index)
|
count = mfc.GetBlendShapes(dr="r", tc=mesh_index)
|
||||||
|
|
||||||
# 如果没有混合变形节点且有目标需要创建
|
# 如果没有混合变形节点且有目标需要创建
|
||||||
if not cmds.objExists(blend_shape) and count > 0:
|
if not cmds.objExists(blend_shape) and count > 0:
|
||||||
# 构建混合变形节点名称
|
# 构建混合变形节点名称
|
||||||
blend_shape_name = f"{cmds.SGGetMeshes(i=mesh_index)}_blendShapes"
|
blend_shape_name = f"{mfc.GetMeshes(i=mesh_index)}_blendShapes"
|
||||||
|
|
||||||
# 设置进度条
|
# 设置进度条
|
||||||
cmds.SGProgressBar(max=count)
|
mfc.ProgressBar(max=count)
|
||||||
cmds.SGProgressBar(t=f"[{blend_shape_name}] Creating Target Mesh...")
|
mfc.ProgressBar(t=f"[{blend_shape_name}] Creating Target Mesh...")
|
||||||
|
|
||||||
# 创建混合变形节点
|
# 创建混合变形节点
|
||||||
cmds.blendShape(mesh, name=blend_shape_name)
|
cmds.blendShape(mesh, name=blend_shape_name)
|
||||||
@ -46,16 +41,16 @@ def sg_create_blend_shape():
|
|||||||
# 创建每个目标
|
# 创建每个目标
|
||||||
for index in range(count):
|
for index in range(count):
|
||||||
# 更新进度条
|
# 更新进度条
|
||||||
cmds.SGProgressBar(apr=1)
|
mfc.ProgressBar(apr=1)
|
||||||
|
|
||||||
# 获取目标名称
|
# 获取目标名称
|
||||||
bs_name = cmds.SGGetBlendShapes(dr="r", bsn=(mesh_index, index))
|
bs_name = mfc.GetBlendShapes(dr="r", bsn=(mesh_index, index))
|
||||||
|
|
||||||
# 复制模型作为目标
|
# 复制模型作为目标
|
||||||
cmds.duplicate(mesh, returnRootsOnly=True, name=bs_name)
|
cmds.duplicate(mesh, returnRootsOnly=True, name=bs_name)
|
||||||
|
|
||||||
# 设置混合变形目标
|
# 设置混合变形目标
|
||||||
cmds.SGSetBlendShapes(ct=mesh_index, index=index, target=bs_name)
|
mfc.SetBlendShapes(ct=mesh_index, index=index, target=bs_name)
|
||||||
|
|
||||||
# 添加到混合变形节点
|
# 添加到混合变形节点
|
||||||
cmds.blendShape(
|
cmds.blendShape(
|
||||||
@ -70,4 +65,4 @@ def sg_create_blend_shape():
|
|||||||
cmds.delete(bs_name)
|
cmds.delete(bs_name)
|
||||||
|
|
||||||
# 结束进度条
|
# 结束进度条
|
||||||
cmds.SGProgressBar(ep=True)
|
mfc.ProgressBar(ep=True)
|
@ -1,12 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 清泉时代科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import imp
|
import imp
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
@ -18,7 +12,7 @@ def sg_create_body_ctrl():
|
|||||||
- 动态加载身体控制器模块
|
- 动态加载身体控制器模块
|
||||||
"""
|
"""
|
||||||
# 获取环境变量中的路径
|
# 获取环境变量中的路径
|
||||||
path = os.environ.get('SG_PATH')
|
path = os.environ.get('PATH')
|
||||||
|
|
||||||
# 构建模块路径
|
# 构建模块路径
|
||||||
module_path = os.path.join(path, 'files/meta_body_ctrl/meta_body_ctrl.py')
|
module_path = os.path.join(path, 'files/meta_body_ctrl/meta_body_ctrl.py')
|
@ -1,13 +1,8 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 清泉时代科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def sg_create_lod(index):
|
def sg_create_lod(index):
|
||||||
"""
|
"""
|
||||||
@ -45,13 +40,13 @@ def sg_create_lod(index):
|
|||||||
|
|
||||||
if not cmds.objExists(head_mesh):
|
if not cmds.objExists(head_mesh):
|
||||||
# 创建LOD网格体
|
# 创建LOD网格体
|
||||||
cmds.SGGetMeshes(cml=index)
|
mfc.GetMeshes(cml=index)
|
||||||
head_lod = cmds.SGGetMeshes(lod=0)
|
head_lod = mfc.GetMeshes(lod=0)
|
||||||
create_lod = cmds.SGGetMeshes(lod=index)
|
create_lod = mfc.GetMeshes(lod=index)
|
||||||
|
|
||||||
# 处理每个创建的LOD模型
|
# 处理每个创建的LOD模型
|
||||||
for c in create_lod:
|
for c in create_lod:
|
||||||
create = cmds.SGGetMeshes(i=c)
|
create = mfc.GetMeshes(i=c)
|
||||||
|
|
||||||
# 跳过索引大于等于50的模型
|
# 跳过索引大于等于50的模型
|
||||||
if c >= 50:
|
if c >= 50:
|
||||||
@ -65,7 +60,7 @@ def sg_create_lod(index):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if any(create.startswith(mesh) for mesh in meshes[:h+1]):
|
if any(create.startswith(mesh) for mesh in meshes[:h+1]):
|
||||||
mesh = cmds.SGGetMeshes(m=h)
|
mesh = mfc.GetMeshes(m=h)
|
||||||
if cmds.objExists(mesh):
|
if cmds.objExists(mesh):
|
||||||
# 处理模型
|
# 处理模型
|
||||||
cmds.parent(create, head_grp)
|
cmds.parent(create, head_grp)
|
||||||
@ -103,10 +98,10 @@ def sg_create_lod(index):
|
|||||||
cmds.group(empty=True, name=body_grp)
|
cmds.group(empty=True, name=body_grp)
|
||||||
|
|
||||||
if not cmds.objExists(body_mesh):
|
if not cmds.objExists(body_mesh):
|
||||||
mesh = cmds.SGGetMeshes(m=50)
|
mesh = mfc.GetMeshes(m=50)
|
||||||
if cmds.objExists(mesh):
|
if cmds.objExists(mesh):
|
||||||
body_index = 50 + index
|
body_index = 50 + index
|
||||||
cmds.SGGetMeshes(cm=body_index)
|
mfc.GetMeshes(cm=body_index)
|
||||||
cmds.parent(body_mesh, body_grp)
|
cmds.parent(body_mesh, body_grp)
|
||||||
|
|
||||||
# 获取UV集
|
# 获取UV集
|
@ -1,12 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 清泉时代科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
import maya.mel as mel
|
import maya.mel as mel
|
||||||
|
|
||||||
@ -21,7 +15,7 @@ def sg_create_menu_item():
|
|||||||
|
|
||||||
# 创建主菜单
|
# 创建主菜单
|
||||||
cmds.menu(
|
cmds.menu(
|
||||||
"SG_MENU",
|
"MENU",
|
||||||
tearOff=True,
|
tearOff=True,
|
||||||
label="SuperRigging",
|
label="SuperRigging",
|
||||||
parent="MayaWindow"
|
parent="MayaWindow"
|
||||||
@ -29,7 +23,7 @@ def sg_create_menu_item():
|
|||||||
|
|
||||||
# 添加Super Rigging菜单项
|
# 添加Super Rigging菜单项
|
||||||
cmds.menuItem(
|
cmds.menuItem(
|
||||||
"SG_Editor",
|
"Editor",
|
||||||
label="Super Rigging",
|
label="Super Rigging",
|
||||||
image=logo,
|
image=logo,
|
||||||
command="execute_super_rigging()"
|
command="execute_super_rigging()"
|
||||||
@ -37,7 +31,7 @@ def sg_create_menu_item():
|
|||||||
|
|
||||||
# 添加Pose Wrangler菜单项
|
# 添加Pose Wrangler菜单项
|
||||||
cmds.menuItem(
|
cmds.menuItem(
|
||||||
"SG_PoseWrangler",
|
"PoseWrangler",
|
||||||
label="Pose Wrangler",
|
label="Pose Wrangler",
|
||||||
image=icon,
|
image=icon,
|
||||||
command="execute_pose_wrangler()"
|
command="execute_pose_wrangler()"
|
||||||
@ -45,16 +39,16 @@ def sg_create_menu_item():
|
|||||||
|
|
||||||
def execute_super_rigging():
|
def execute_super_rigging():
|
||||||
"""
|
"""
|
||||||
执行Super Rigging功能
|
执行MetaFusion功能
|
||||||
- 加载必要的插件
|
- 加载必要的插件
|
||||||
- 打开Super Rigging窗口
|
- 打开MetaFusion窗口
|
||||||
"""
|
"""
|
||||||
# 获取Maya版本
|
# 获取Maya版本
|
||||||
version = cmds.about(version=True)
|
version = cmds.about(version=True)
|
||||||
|
|
||||||
# 需要加载的插件列表
|
# 需要加载的插件列表
|
||||||
plugins = [
|
plugins = [
|
||||||
f"SuperRiggingEditor{version}",
|
f"MetaFusionEditor{version}",
|
||||||
f"MayaUE4RBFPlugin{version}",
|
f"MayaUE4RBFPlugin{version}",
|
||||||
"embeddedRL4",
|
"embeddedRL4",
|
||||||
"MayaUERBFPlugin",
|
"MayaUERBFPlugin",
|
||||||
@ -70,8 +64,8 @@ def execute_super_rigging():
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# 打开Super Rigging窗口
|
# 打开MetaFusion窗口
|
||||||
mel.eval("SuperRiggingWindow;")
|
mel.eval("MetaFusionWindow;")
|
||||||
|
|
||||||
def execute_pose_wrangler():
|
def execute_pose_wrangler():
|
||||||
"""
|
"""
|
@ -1,14 +1,9 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 清泉时代科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
import maya.mel as mel
|
import maya.mel as mel
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def sg_create_rl4_node(dna, name):
|
def sg_create_rl4_node(dna, name):
|
||||||
"""
|
"""
|
||||||
@ -19,17 +14,17 @@ def sg_create_rl4_node(dna, name):
|
|||||||
name (str): 节点名称
|
name (str): 节点名称
|
||||||
"""
|
"""
|
||||||
# 删除现有的RL4节点
|
# 删除现有的RL4节点
|
||||||
mel.eval('SGDeleteRL4Node')
|
mel.eval('DeleteRL4Node')
|
||||||
|
|
||||||
# 重置所有关节的颜色
|
# 重置所有关节的颜色
|
||||||
joints = cmds.SGGetJoints()
|
joints = mfc.GetJoints()
|
||||||
for joint in joints:
|
for joint in joints:
|
||||||
cmds.SGSetColor(joint, 0, 0, 0, 0, 0, 0)
|
mfc.SetColor(joint, 0, 0, 0, 0, 0, 0)
|
||||||
|
|
||||||
# 查找有效的LOD级别
|
# 查找有效的LOD级别
|
||||||
lod = None
|
lod = None
|
||||||
for i in range(8):
|
for i in range(8):
|
||||||
joint_lod = cmds.SGGetJoints(lod=i, type="string")
|
joint_lod = mfc.GetJoints(lod=i, type="string")
|
||||||
exists = True
|
exists = True
|
||||||
|
|
||||||
# 检查所有关节是否存在
|
# 检查所有关节是否存在
|
||||||
@ -43,7 +38,7 @@ def sg_create_rl4_node(dna, name):
|
|||||||
break
|
break
|
||||||
|
|
||||||
# 修复LOD 0的关节
|
# 修复LOD 0的关节
|
||||||
mel.eval('SGRepairJointForLOD 0')
|
mel.eval('RepairJointForLOD 0')
|
||||||
|
|
||||||
# 设置命名空间和属性路径
|
# 设置命名空间和属性路径
|
||||||
if cmds.namespace(exists="DHIhead"):
|
if cmds.namespace(exists="DHIhead"):
|
||||||
@ -67,4 +62,4 @@ def sg_create_rl4_node(dna, name):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# 删除指定LOD级别的关节
|
# 删除指定LOD级别的关节
|
||||||
mel.eval(f'SGDeleteJointForLOD {lod}')
|
mel.eval(f'DeleteJointForLOD {lod}')
|
@ -1,13 +1,8 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 清泉时代科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2024/03/04
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def sg_current_project_dna():
|
def sg_current_project_dna():
|
||||||
"""
|
"""
|
||||||
@ -24,7 +19,7 @@ def sg_current_project_dna():
|
|||||||
return
|
return
|
||||||
|
|
||||||
# 获取当前项目DNA路径
|
# 获取当前项目DNA路径
|
||||||
pre_path = cmds.SGDescriptor(gpd=True)
|
pre_path = mfc.Descriptor(gpd=True)
|
||||||
|
|
||||||
# 检查每个RL4节点
|
# 检查每个RL4节点
|
||||||
for node in rl4_nodes:
|
for node in rl4_nodes:
|
||||||
@ -33,4 +28,4 @@ def sg_current_project_dna():
|
|||||||
|
|
||||||
# 如果文件存在且与当前路径不同,则更新项目DNA路径
|
# 如果文件存在且与当前路径不同,则更新项目DNA路径
|
||||||
if cmds.file(rl4_path, query=True, exists=True) and rl4_path != pre_path:
|
if cmds.file(rl4_path, query=True, exists=True) and rl4_path != pre_path:
|
||||||
cmds.SGDescriptor(spd=rl4_path)
|
mfc.Descriptor(spd=rl4_path)
|
@ -1,14 +1,9 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 清泉时代科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2024/02/23
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
import maya.mel as mel
|
import maya.mel as mel
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def sg_define_joint_for_lod(lod):
|
def sg_define_joint_for_lod(lod):
|
||||||
"""
|
"""
|
||||||
@ -44,20 +39,20 @@ def sg_define_joint_for_lod(lod):
|
|||||||
cmds.delete(rl4_nodes)
|
cmds.delete(rl4_nodes)
|
||||||
|
|
||||||
# 修复LOD 0的关节
|
# 修复LOD 0的关节
|
||||||
mel.eval('SGRepairJointForLOD 0')
|
mel.eval('RepairJointForLOD 0')
|
||||||
|
|
||||||
# 如果存在RL4节点,重新创建
|
# 如果存在RL4节点,重新创建
|
||||||
if exists:
|
if exists:
|
||||||
dna = cmds.SGDescriptor(wd=True)
|
dna = mfc.Descriptor(wd=True)
|
||||||
if cmds.file(dna, query=True, exists=True):
|
if cmds.file(dna, query=True, exists=True):
|
||||||
name = f"rl4Embedded_{cmds.SGDescriptor(n=True)}_rl"
|
name = f"rl4Embedded_{mfc.Descriptor(n=True)}_rl"
|
||||||
mel.eval(f'SGCreateRL4Node "{dna}" "{name}"')
|
mel.eval(f'CreateRL4Node "{dna}" "{name}"')
|
||||||
|
|
||||||
# 处理蒙皮和关节
|
# 处理蒙皮和关节
|
||||||
mel.eval('SGFastUnbindSkinCluster')
|
mel.eval('FastUnbindSkinCluster')
|
||||||
mel.eval(f'SGRepairJointForLOD {lod}')
|
mel.eval(f'RepairJointForLOD {lod}')
|
||||||
mel.eval(f'SGDeleteJointForLOD {lod}')
|
mel.eval(f'DeleteJointForLOD {lod}')
|
||||||
mel.eval('SGFastBindSkinCluster')
|
mel.eval('FastBindSkinCluster')
|
||||||
|
|
||||||
def _get_control_list():
|
def _get_control_list():
|
||||||
"""
|
"""
|
@ -1,13 +1,8 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 清泉时代科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2024/09/16
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def sg_del_blend_shape(mesh_index, in_tgt_grp):
|
def sg_del_blend_shape(mesh_index, in_tgt_grp):
|
||||||
"""
|
"""
|
||||||
@ -18,7 +13,7 @@ def sg_del_blend_shape(mesh_index, in_tgt_grp):
|
|||||||
in_tgt_grp (int): 目标组索引
|
in_tgt_grp (int): 目标组索引
|
||||||
"""
|
"""
|
||||||
# 获取混合变形节点名称
|
# 获取混合变形节点名称
|
||||||
bsn = f"{cmds.SGGetMeshes(i=mesh_index)}_blendShapes"
|
bsn = f"{mfc.GetMeshes(i=mesh_index)}_blendShapes"
|
||||||
|
|
||||||
# 检查节点是否存在
|
# 检查节点是否存在
|
||||||
if not cmds.objExists(bsn):
|
if not cmds.objExists(bsn):
|
@ -1,13 +1,8 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 清泉时代科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2024/02/23
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def sg_delete_joint_for_lod(lod):
|
def sg_delete_joint_for_lod(lod):
|
||||||
"""
|
"""
|
||||||
@ -17,8 +12,8 @@ def sg_delete_joint_for_lod(lod):
|
|||||||
lod (int): LOD级别
|
lod (int): LOD级别
|
||||||
"""
|
"""
|
||||||
# 获取所有关节和指定LOD级别的关节
|
# 获取所有关节和指定LOD级别的关节
|
||||||
joint_all = cmds.SGGetJoints(lod=0, type="string")
|
joint_all = mfc.GetJoints(lod=0, type="string")
|
||||||
joint_lod = cmds.SGGetJoints(lod=lod, type="string")
|
joint_lod = mfc.GetJoints(lod=lod, type="string")
|
||||||
|
|
||||||
# 找出需要删除的关节(在所有关节中但不在指定LOD级别中的关节)
|
# 找出需要删除的关节(在所有关节中但不在指定LOD级别中的关节)
|
||||||
joint_del = list(set(joint_all) - set(joint_lod))
|
joint_del = list(set(joint_all) - set(joint_lod))
|
@ -1,12 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 清泉时代科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
|
||||||
def sg_delete_rl4_node():
|
def sg_delete_rl4_node():
|
@ -1,12 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 清泉时代科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
|
||||||
@ -28,7 +22,7 @@ def sg_demo_help(help_name):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# 获取环境变量中的路径
|
# 获取环境变量中的路径
|
||||||
path = os.environ.get('SG_PATH')
|
path = os.environ.get('PATH')
|
||||||
image_path = os.path.join(path, 'images', 'ARKit', f'{help_name}.png')
|
image_path = os.path.join(path, 'images', 'ARKit', f'{help_name}.png')
|
||||||
|
|
||||||
# 创建布局
|
# 创建布局
|
@ -1,13 +1,8 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 清泉时代科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def sg_duplicate_target(target, index):
|
def sg_duplicate_target(target, index):
|
||||||
"""
|
"""
|
||||||
@ -18,7 +13,7 @@ def sg_duplicate_target(target, index):
|
|||||||
index (int): 目标索引,用于确定位置
|
index (int): 目标索引,用于确定位置
|
||||||
"""
|
"""
|
||||||
# 获取头部模型
|
# 获取头部模型
|
||||||
head = cmds.SGGetMeshes(m=0)
|
head = mfc.GetMeshes(m=0)
|
||||||
|
|
||||||
# 创建根目标组
|
# 创建根目标组
|
||||||
root_targets_grp = "root_targets_grp"
|
root_targets_grp = "root_targets_grp"
|
||||||
@ -28,7 +23,7 @@ def sg_duplicate_target(target, index):
|
|||||||
# 处理每个网格
|
# 处理每个网格
|
||||||
for i in range(9):
|
for i in range(9):
|
||||||
# 获取部署网格名称
|
# 获取部署网格名称
|
||||||
meshe_deploy = cmds.SGGetMeshes(i=i)
|
meshe_deploy = mfc.GetMeshes(i=i)
|
||||||
|
|
||||||
# 获取混合变形节点名称
|
# 获取混合变形节点名称
|
||||||
blend_shape = f"{meshe_deploy}_blendShapes"
|
blend_shape = f"{meshe_deploy}_blendShapes"
|
||||||
@ -49,7 +44,7 @@ def sg_duplicate_target(target, index):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# 获取网格和目标名称
|
# 获取网格和目标名称
|
||||||
meshe = cmds.SGGetMeshes(m=i)
|
meshe = mfc.GetMeshes(m=i)
|
||||||
meshe_target = f"{meshe_deploy}_{target}"
|
meshe_target = f"{meshe_deploy}_{target}"
|
||||||
|
|
||||||
# 复制网格
|
# 复制网格
|
@ -1,12 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 清泉时代科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
|
||||||
def sg_edit_blend_shape(index, blend_shape):
|
def sg_edit_blend_shape(index, blend_shape):
|
@ -1,15 +1,10 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 清泉时代科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
import maya.mel as mel
|
import maya.mel as mel
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
# 配置常量
|
# 配置常量
|
||||||
JOINT_ORIENT_CONFIG = {
|
JOINT_ORIENT_CONFIG = {
|
||||||
@ -265,7 +260,7 @@ def get_ui_labels():
|
|||||||
"""
|
"""
|
||||||
根据语言设置获取UI标签
|
根据语言设置获取UI标签
|
||||||
"""
|
"""
|
||||||
is_chinese = cmds.SGDescriptor(l=True) == "ZH"
|
is_chinese = mfc.Descriptor(l=True) == "ZH"
|
||||||
|
|
||||||
if is_chinese:
|
if is_chinese:
|
||||||
return {
|
return {
|
||||||
@ -311,16 +306,16 @@ def sg_main_amend_axis():
|
|||||||
joints = sg_body_joints()
|
joints = sg_body_joints()
|
||||||
|
|
||||||
# 创建进度条
|
# 创建进度条
|
||||||
cmds.SGProgressBar(sp=True)
|
mfc.ProgressBar(sp=True)
|
||||||
cmds.SGProgressBar(max=len(joints))
|
mfc.ProgressBar(max=len(joints))
|
||||||
cmds.SGProgressBar(t="Amend Joint Axis...")
|
mfc.ProgressBar(t="Amend Joint Axis...")
|
||||||
|
|
||||||
# 处理每个关节
|
# 处理每个关节
|
||||||
for joint in joints:
|
for joint in joints:
|
||||||
cmds.SGProgressBar(apr=1)
|
mfc.ProgressBar(apr=1)
|
||||||
|
|
||||||
# 获取关节类型
|
# 获取关节类型
|
||||||
joint_type = cmds.SGReadJson(d=joint, k="type", t="string")
|
joint_type = mfc.ReadJson(d=joint, k="type", t="string")
|
||||||
|
|
||||||
# 获取关节名称
|
# 获取关节名称
|
||||||
joint_drv = f"{joint}_drv"
|
joint_drv = f"{joint}_drv"
|
||||||
@ -354,7 +349,7 @@ def sg_main_amend_axis():
|
|||||||
cmds.setAttr(f"{joint_body}.jo", *drv_rot)
|
cmds.setAttr(f"{joint_body}.jo", *drv_rot)
|
||||||
|
|
||||||
# 结束进度条
|
# 结束进度条
|
||||||
cmds.SGProgressBar(ep=True)
|
mfc.ProgressBar(ep=True)
|
||||||
|
|
||||||
def sg_skin_amend_axis():
|
def sg_skin_amend_axis():
|
||||||
"""
|
"""
|
||||||
@ -364,13 +359,13 @@ def sg_skin_amend_axis():
|
|||||||
joints = sg_body_joints()
|
joints = sg_body_joints()
|
||||||
|
|
||||||
# 创建进度条
|
# 创建进度条
|
||||||
cmds.SGProgressBar(sp=True)
|
mfc.ProgressBar(sp=True)
|
||||||
cmds.SGProgressBar(max=len(joints))
|
mfc.ProgressBar(max=len(joints))
|
||||||
cmds.SGProgressBar(t="Amend Skin Joint Axis...")
|
mfc.ProgressBar(t="Amend Skin Joint Axis...")
|
||||||
|
|
||||||
# 处理每个关节
|
# 处理每个关节
|
||||||
for joint in joints:
|
for joint in joints:
|
||||||
cmds.SGProgressBar(apr=1)
|
mfc.ProgressBar(apr=1)
|
||||||
|
|
||||||
# 获取关节名称
|
# 获取关节名称
|
||||||
joint_drv = f"{joint}_drv"
|
joint_drv = f"{joint}_drv"
|
||||||
@ -390,7 +385,7 @@ def sg_skin_amend_axis():
|
|||||||
cmds.joint(joint_head, edit=True, orientJoint="none")
|
cmds.joint(joint_head, edit=True, orientJoint="none")
|
||||||
|
|
||||||
# 结束进度条
|
# 结束进度条
|
||||||
cmds.SGProgressBar(ep=True)
|
mfc.ProgressBar(ep=True)
|
||||||
|
|
||||||
def sg_other_amend_axis(joints):
|
def sg_other_amend_axis(joints):
|
||||||
"""
|
"""
|
||||||
@ -518,29 +513,29 @@ def sg_orient(joints, aim_axis, up_axis, up_dir, do_auto):
|
|||||||
up_dir (list): 向上方向
|
up_dir (list): 向上方向
|
||||||
do_auto (bool): 是否自动处理
|
do_auto (bool): 是否自动处理
|
||||||
"""
|
"""
|
||||||
# 这个函数的具体实现需要根据原MEL脚本中的SGOrient函数来完成
|
# 这个函数的具体实现需要根据原MEL脚本中的Orient函数来完成
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def sg_body_joints():
|
def sg_body_joints():
|
||||||
"""
|
"""
|
||||||
获取身体关节列表
|
获取身体关节列表
|
||||||
"""
|
"""
|
||||||
return cmds.SGGetJoints(bj=True)
|
return mfc.GetJoints(bj=True)
|
||||||
|
|
||||||
def sg_body_joints_locator():
|
def sg_body_joints_locator():
|
||||||
"""
|
"""
|
||||||
创建身体关节定位器
|
创建身体关节定位器
|
||||||
"""
|
"""
|
||||||
# 获取JSON文件路径
|
# 获取JSON文件路径
|
||||||
json_path = os.path.join(os.environ.get('SG_PATH'), "files/data/BodyJoints.json")
|
json_path = os.path.join(os.environ.get('PATH'), "files/data/BodyJoints.json")
|
||||||
|
|
||||||
# 读取对象数据
|
# 读取对象数据
|
||||||
objects = cmds.SGReadJson(f=json_path, t="object")
|
objects = mfc.ReadJson(f=json_path, t="object")
|
||||||
if not objects:
|
if not objects:
|
||||||
return
|
return
|
||||||
|
|
||||||
# 创建进度条
|
# 创建进度条
|
||||||
cmds.SGProgressBar(sp=True)
|
mfc.ProgressBar(sp=True)
|
||||||
|
|
||||||
# 创建临时定位器
|
# 创建临时定位器
|
||||||
locator = "MetaHumanLocatorTemp"
|
locator = "MetaHumanLocatorTemp"
|
||||||
@ -548,11 +543,11 @@ def sg_body_joints_locator():
|
|||||||
cmds.spaceLocator(name=locator)
|
cmds.spaceLocator(name=locator)
|
||||||
|
|
||||||
# 设置进度条最大值
|
# 设置进度条最大值
|
||||||
cmds.SGProgressBar(max=len(objects))
|
mfc.ProgressBar(max=len(objects))
|
||||||
cmds.SGProgressBar(t="Set Body Joint Translation...")
|
mfc.ProgressBar(t="Set Body Joint Translation...")
|
||||||
|
|
||||||
# 获取中性关节位置
|
# 获取中性关节位置
|
||||||
positions = cmds.SGGetNeutralJointTranslations(b=True)
|
positions = mfc.GetNeutralJointTranslations(b=True)
|
||||||
|
|
||||||
# 检查数据数量
|
# 检查数据数量
|
||||||
if len(objects) != len(positions) // 3:
|
if len(objects) != len(positions) // 3:
|
||||||
@ -561,15 +556,15 @@ def sg_body_joints_locator():
|
|||||||
|
|
||||||
# 处理每个关节
|
# 处理每个关节
|
||||||
for i, obj in enumerate(objects):
|
for i, obj in enumerate(objects):
|
||||||
cmds.SGProgressBar(apr=1)
|
mfc.ProgressBar(apr=1)
|
||||||
|
|
||||||
# 获取关节和类型信息
|
# 获取关节和类型信息
|
||||||
joints = cmds.SGReadJson(d=obj, k="joint", t="string")
|
joints = mfc.ReadJson(d=obj, k="joint", t="string")
|
||||||
joint_type = cmds.SGReadJson(d=obj, k="type", t="string")
|
joint_type = mfc.ReadJson(d=obj, k="type", t="string")
|
||||||
joint_drv = f"{joints[0]}_drv"
|
joint_drv = f"{joints[0]}_drv"
|
||||||
|
|
||||||
# 检查是否需要定位
|
# 检查是否需要定位
|
||||||
locate = cmds.SGReadJson(d=obj, k="locate", t="bool")
|
locate = mfc.ReadJson(d=obj, k="locate", t="bool")
|
||||||
if locate[0] and cmds.objExists(joint_drv):
|
if locate[0] and cmds.objExists(joint_drv):
|
||||||
# 设置位置
|
# 设置位置
|
||||||
x = 0.0 if joint_type[0] == "middle" else positions[i*3]
|
x = 0.0 if joint_type[0] == "middle" else positions[i*3]
|
||||||
@ -580,8 +575,8 @@ def sg_body_joints_locator():
|
|||||||
cmds.delete(cmds.pointConstraint(locator, joint_drv, weight=1))
|
cmds.delete(cmds.pointConstraint(locator, joint_drv, weight=1))
|
||||||
|
|
||||||
# 重置进度条
|
# 重置进度条
|
||||||
cmds.SGProgressBar(pr=0)
|
mfc.ProgressBar(pr=0)
|
||||||
cmds.SGProgressBar(ep=True)
|
mfc.ProgressBar(ep=True)
|
||||||
|
|
||||||
# 删除临时定位器
|
# 删除临时定位器
|
||||||
cmds.delete(locator)
|
cmds.delete(locator)
|
@ -1,15 +1,10 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 清泉时代科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2024/03/01
|
|
||||||
"""
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
import maya.mel as mel
|
import maya.mel as mel
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def sg_export_fbx_window():
|
def sg_export_fbx_window():
|
||||||
"""
|
"""
|
||||||
@ -120,7 +115,7 @@ def sg_export_fbx_window():
|
|||||||
|
|
||||||
def get_ui_labels():
|
def get_ui_labels():
|
||||||
"""获取UI标签"""
|
"""获取UI标签"""
|
||||||
is_chinese = cmds.SGDescriptor(l=True) == "ZH"
|
is_chinese = mfc.Descriptor(l=True) == "ZH"
|
||||||
|
|
||||||
if is_chinese:
|
if is_chinese:
|
||||||
return {
|
return {
|
||||||
@ -192,7 +187,7 @@ def sg_export_head_command():
|
|||||||
return
|
return
|
||||||
|
|
||||||
# 重命名混合变形
|
# 重命名混合变形
|
||||||
mel.eval('SGRenameBlendShapes')
|
mel.eval('RenameBlendShapes')
|
||||||
|
|
||||||
# 获取LOD选择状态
|
# 获取LOD选择状态
|
||||||
lods = []
|
lods = []
|
||||||
@ -206,8 +201,8 @@ def sg_export_head_command():
|
|||||||
if is_selected:
|
if is_selected:
|
||||||
export_grp = f"head_lod{i}_grp"
|
export_grp = f"head_lod{i}_grp"
|
||||||
if cmds.ls(export_grp, dag=True, geometry=True):
|
if cmds.ls(export_grp, dag=True, geometry=True):
|
||||||
path = cmds.SGDescriptor(p=True)
|
path = mfc.Descriptor(p=True)
|
||||||
name = cmds.SGDescriptor(n=True)
|
name = mfc.Descriptor(n=True)
|
||||||
file_path = f"{path}/{name}_lod{i}_head.fbx"
|
file_path = f"{path}/{name}_lod{i}_head.fbx"
|
||||||
|
|
||||||
cmds.select(clear=True)
|
cmds.select(clear=True)
|
||||||
@ -218,10 +213,10 @@ def sg_export_head_command():
|
|||||||
cmds.error(f'"{export_grp}" No geometry found within the group...')
|
cmds.error(f'"{export_grp}" No geometry found within the group...')
|
||||||
|
|
||||||
# 重置混合变形
|
# 重置混合变形
|
||||||
mel.eval('SGResetBlendShapes')
|
mel.eval('ResetBlendShapes')
|
||||||
|
|
||||||
# 打开输出文件夹
|
# 打开输出文件夹
|
||||||
folder_path = cmds.SGDescriptor(p=True).replace('/', '\\')
|
folder_path = mfc.Descriptor(p=True).replace('/', '\\')
|
||||||
os.system(f'explorer "{folder_path}"')
|
os.system(f'explorer "{folder_path}"')
|
||||||
|
|
||||||
def sg_export_select_head_command():
|
def sg_export_select_head_command():
|
||||||
@ -242,23 +237,23 @@ def sg_export_select_head_command():
|
|||||||
return
|
return
|
||||||
|
|
||||||
# 重命名混合变形
|
# 重命名混合变形
|
||||||
mel.eval('SGRenameBlendShapes')
|
mel.eval('RenameBlendShapes')
|
||||||
|
|
||||||
# 导出选中物体
|
# 导出选中物体
|
||||||
cmds.select(clear=True)
|
cmds.select(clear=True)
|
||||||
cmds.select(selection, replace=True)
|
cmds.select(selection, replace=True)
|
||||||
cmds.select('DHIhead:root', add=True)
|
cmds.select('DHIhead:root', add=True)
|
||||||
|
|
||||||
path = cmds.SGDescriptor(p=True)
|
path = mfc.Descriptor(p=True)
|
||||||
name = cmds.SGDescriptor(n=True)
|
name = mfc.Descriptor(n=True)
|
||||||
file_path = f"{path}/{name}_lod_head.fbx"
|
file_path = f"{path}/{name}_lod_head.fbx"
|
||||||
sg_export_fbx(file_path)
|
sg_export_fbx(file_path)
|
||||||
|
|
||||||
# 重置混合变形
|
# 重置混合变形
|
||||||
mel.eval('SGResetBlendShapes')
|
mel.eval('ResetBlendShapes')
|
||||||
|
|
||||||
# 打开输出文件夹
|
# 打开输出文件夹
|
||||||
folder_path = cmds.SGDescriptor(p=True).replace('/', '\\')
|
folder_path = mfc.Descriptor(p=True).replace('/', '\\')
|
||||||
os.system(f'explorer "{folder_path}"')
|
os.system(f'explorer "{folder_path}"')
|
||||||
|
|
||||||
def sg_export_body_command():
|
def sg_export_body_command():
|
||||||
@ -282,8 +277,8 @@ def sg_export_body_command():
|
|||||||
if is_selected:
|
if is_selected:
|
||||||
export_grp = f"body_lod{i}_grp"
|
export_grp = f"body_lod{i}_grp"
|
||||||
if cmds.ls(export_grp, dag=True, geometry=True):
|
if cmds.ls(export_grp, dag=True, geometry=True):
|
||||||
path = cmds.SGDescriptor(p=True)
|
path = mfc.Descriptor(p=True)
|
||||||
name = cmds.SGDescriptor(n=True)
|
name = mfc.Descriptor(n=True)
|
||||||
file_path = f"{path}/{name}_lod{i}_body.fbx"
|
file_path = f"{path}/{name}_lod{i}_body.fbx"
|
||||||
|
|
||||||
cmds.select(clear=True)
|
cmds.select(clear=True)
|
||||||
@ -294,7 +289,7 @@ def sg_export_body_command():
|
|||||||
cmds.error(f'"{export_grp}" No geometry found within the group...')
|
cmds.error(f'"{export_grp}" No geometry found within the group...')
|
||||||
|
|
||||||
# 打开输出文件夹
|
# 打开输出文件夹
|
||||||
folder_path = cmds.SGDescriptor(p=True).replace('/', '\\')
|
folder_path = mfc.Descriptor(p=True).replace('/', '\\')
|
||||||
os.system(f'explorer "{folder_path}"')
|
os.system(f'explorer "{folder_path}"')
|
||||||
|
|
||||||
def sg_export_select_body_command():
|
def sg_export_select_body_command():
|
||||||
@ -319,11 +314,11 @@ def sg_export_select_body_command():
|
|||||||
cmds.select(selection, replace=True)
|
cmds.select(selection, replace=True)
|
||||||
cmds.select('DHIbody:root', add=True)
|
cmds.select('DHIbody:root', add=True)
|
||||||
|
|
||||||
path = cmds.SGDescriptor(p=True)
|
path = mfc.Descriptor(p=True)
|
||||||
name = cmds.SGDescriptor(n=True)
|
name = mfc.Descriptor(n=True)
|
||||||
file_path = f"{path}/{name}_lod_body.fbx"
|
file_path = f"{path}/{name}_lod_body.fbx"
|
||||||
sg_export_fbx(file_path)
|
sg_export_fbx(file_path)
|
||||||
|
|
||||||
# 打开输出文件夹
|
# 打开输出文件夹
|
||||||
folder_path = cmds.SGDescriptor(p=True).replace('/', '\\')
|
folder_path = mfc.Descriptor(p=True).replace('/', '\\')
|
||||||
os.system(f'explorer "{folder_path}"')
|
os.system(f'explorer "{folder_path}"')
|
@ -1,13 +1,8 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 清泉时代科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def sg_export_skin_cluster():
|
def sg_export_skin_cluster():
|
||||||
"""
|
"""
|
||||||
@ -34,4 +29,5 @@ def sg_export_skin_cluster():
|
|||||||
# 构建保存路径
|
# 构建保存路径
|
||||||
save_path = f"{directory[0]}/{obj}{suffix}"
|
save_path = f"{directory[0]}/{obj}{suffix}"
|
||||||
# 导出权重
|
# 导出权重
|
||||||
cmds.SGSkinCluster(ef=obj, export_file=save_path)
|
mfc.SkinCluster(ef=obj, export_file=save_path)
|
||||||
|
|
@ -1,14 +1,9 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 清泉时代科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2024/03/26
|
|
||||||
"""
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def sg_fast_bind_skin_cluster():
|
def sg_fast_bind_skin_cluster():
|
||||||
"""
|
"""
|
||||||
@ -20,14 +15,14 @@ def sg_fast_bind_skin_cluster():
|
|||||||
# 遍历所有网格(0-53)
|
# 遍历所有网格(0-53)
|
||||||
for i in range(54):
|
for i in range(54):
|
||||||
# 获取网格名称
|
# 获取网格名称
|
||||||
mesh = cmds.SGGetMeshes(m=i)
|
mesh = mfc.GetMeshes(m=i)
|
||||||
|
|
||||||
# 检查网格是否存在
|
# 检查网格是否存在
|
||||||
if not cmds.objExists(mesh):
|
if not cmds.objExists(mesh):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# 获取蒙皮权重文件路径
|
# 获取蒙皮权重文件路径
|
||||||
path = os.path.join(cmds.SGDescriptor(p=True), "skin_buffer")
|
path = os.path.join(mfc.Descriptor(p=True), "skin_buffer")
|
||||||
|
|
||||||
# 检查路径是否存在
|
# 检查路径是否存在
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
@ -52,6 +47,6 @@ def sg_fast_bind_skin_cluster():
|
|||||||
|
|
||||||
# 导入蒙皮权重
|
# 导入蒙皮权重
|
||||||
try:
|
try:
|
||||||
cmds.SGSkinCluster(mesh, import_file=skin_file_path)
|
mfc.SkinCluster(mesh, import_file=skin_file_path)
|
||||||
except:
|
except:
|
||||||
pass # 忽略导入错误
|
pass # 忽略导入错误
|
@ -1,14 +1,9 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 清泉时代科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2024/03/26
|
|
||||||
"""
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def sg_fast_unbind_skin_cluster():
|
def sg_fast_unbind_skin_cluster():
|
||||||
"""
|
"""
|
||||||
@ -20,7 +15,7 @@ def sg_fast_unbind_skin_cluster():
|
|||||||
# 遍历所有网格(0-53)
|
# 遍历所有网格(0-53)
|
||||||
for i in range(54):
|
for i in range(54):
|
||||||
# 获取网格名称
|
# 获取网格名称
|
||||||
mesh = cmds.SGGetMeshes(m=i)
|
mesh = mfc.GetMeshes(m=i)
|
||||||
|
|
||||||
# 检查网格是否存在
|
# 检查网格是否存在
|
||||||
if not cmds.objExists(mesh):
|
if not cmds.objExists(mesh):
|
||||||
@ -32,7 +27,7 @@ def sg_fast_unbind_skin_cluster():
|
|||||||
# 如果存在蒙皮变形器
|
# 如果存在蒙皮变形器
|
||||||
if cmds.objExists(skin_cluster):
|
if cmds.objExists(skin_cluster):
|
||||||
# 构建保存路径
|
# 构建保存路径
|
||||||
path = os.path.join(cmds.SGDescriptor(p=True), "skin_buffer")
|
path = os.path.join(mfc.Descriptor(p=True), "skin_buffer")
|
||||||
skin_file = os.path.join(path, f"{mesh}.skin")
|
skin_file = os.path.join(path, f"{mesh}.skin")
|
||||||
|
|
||||||
# 如果目录不存在则创建
|
# 如果目录不存在则创建
|
||||||
@ -40,7 +35,7 @@ def sg_fast_unbind_skin_cluster():
|
|||||||
os.makedirs(path)
|
os.makedirs(path)
|
||||||
|
|
||||||
# 导出蒙皮权重
|
# 导出蒙皮权重
|
||||||
cmds.SGSkinCluster(ef=mesh, export_file=skin_file)
|
mfc.SkinCluster(ef=mesh, export_file=skin_file)
|
||||||
|
|
||||||
# 解除蒙皮绑定
|
# 解除蒙皮绑定
|
||||||
cmds.skinCluster(mesh, edit=True, unbind=True)
|
cmds.skinCluster(mesh, edit=True, unbind=True)
|
@ -1,12 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 清泉时代科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
|
||||||
def sg_get_blend_shape(mesh):
|
def sg_get_blend_shape(mesh):
|
@ -1,12 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 清泉时代科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
|
||||||
@ -28,7 +22,7 @@ def sg_help(help_name):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# 获取环境变量中的路径
|
# 获取环境变量中的路径
|
||||||
path = os.environ.get('SG_PATH')
|
path = os.environ.get('PATH')
|
||||||
image_path = os.path.join(path, 'images', 'help', f'{help_name}.jpg')
|
image_path = os.path.join(path, 'images', 'help', f'{help_name}.jpg')
|
||||||
|
|
||||||
# 创建布局
|
# 创建布局
|
@ -1,12 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 深圳时光科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import imp
|
import imp
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
@ -15,7 +9,7 @@ def sg_import_body_anim():
|
|||||||
"""
|
"""
|
||||||
导入身体动画数据
|
导入身体动画数据
|
||||||
"""
|
"""
|
||||||
path = os.getenv('SG_PATH')
|
path = os.getenv('PATH')
|
||||||
meta_anim_path = os.path.join(path, 'files/meta_anim/meta_body_anim.py')
|
meta_anim_path = os.path.join(path, 'files/meta_anim/meta_body_anim.py')
|
||||||
|
|
||||||
# 使用imp模块导入动画脚本
|
# 使用imp模块导入动画脚本
|
@ -1,12 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 深圳时光科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import imp
|
import imp
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
@ -15,7 +9,7 @@ def sg_import_face_anim():
|
|||||||
"""
|
"""
|
||||||
导入面部动画数据
|
导入面部动画数据
|
||||||
"""
|
"""
|
||||||
path = os.getenv('SG_PATH')
|
path = os.getenv('PATH')
|
||||||
meta_anim_path = os.path.join(path, 'files/meta_anim/meta_face_anim.py')
|
meta_anim_path = os.path.join(path, 'files/meta_anim/meta_face_anim.py')
|
||||||
|
|
||||||
# 使用imp模块导入动画脚本
|
# 使用imp模块导入动画脚本
|
@ -1,14 +1,9 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 深圳时光科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def sg_import_skin_cluster():
|
def sg_import_skin_cluster():
|
||||||
"""
|
"""
|
||||||
@ -34,7 +29,7 @@ def sg_import_skin_cluster():
|
|||||||
|
|
||||||
# 处理单个选中物体的情况
|
# 处理单个选中物体的情况
|
||||||
if len(selection) == 1:
|
if len(selection) == 1:
|
||||||
cmds.SGSkinCluster(selection[0], skin_files[0], if_=True)
|
mfc.SkinCluster(selection[0], skin_files[0], if_=True)
|
||||||
else:
|
else:
|
||||||
# 处理多个文件的情况
|
# 处理多个文件的情况
|
||||||
for skin_file in skin_files:
|
for skin_file in skin_files:
|
||||||
@ -48,7 +43,7 @@ def sg_import_skin_cluster():
|
|||||||
skin_cluster = cmds.findRelatedSkinCluster(mesh_name)
|
skin_cluster = cmds.findRelatedSkinCluster(mesh_name)
|
||||||
if not skin_cluster:
|
if not skin_cluster:
|
||||||
# 导入权重数据
|
# 导入权重数据
|
||||||
cmds.SGSkinCluster(mesh_name, skin_file, if_=True)
|
mfc.SkinCluster(mesh_name, skin_file, if_=True)
|
||||||
|
|
||||||
# 如果直接运行此脚本
|
# 如果直接运行此脚本
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
@ -1,12 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 深圳时光科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
|
||||||
def sg_meshe_detach(topology):
|
def sg_meshe_detach(topology):
|
16
scripts/SG/MetaFusionCore.py
Normal file
16
scripts/SG/MetaFusionCore.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import maya.cmds as cmds
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,12 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 深圳时光科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import imp
|
import imp
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
@ -15,7 +9,7 @@ def sg_motion_apply():
|
|||||||
"""
|
"""
|
||||||
导入动作应用模块
|
导入动作应用模块
|
||||||
"""
|
"""
|
||||||
path = os.getenv('SG_PATH')
|
path = os.getenv('PATH')
|
||||||
meta_motion_path = os.path.join(path, 'files/meta_motion_apply/meta_motion_apply.py')
|
meta_motion_path = os.path.join(path, 'files/meta_motion_apply/meta_motion_apply.py')
|
||||||
|
|
||||||
# 使用imp模块导入动作应用脚本
|
# 使用imp模块导入动作应用脚本
|
@ -1,14 +1,9 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 深圳时光科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2024/04/17
|
|
||||||
"""
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def sg_pose(pose):
|
def sg_pose(pose):
|
||||||
"""
|
"""
|
||||||
@ -50,13 +45,13 @@ def sg_pose(pose):
|
|||||||
cmds.parent(locator, locator_grp)
|
cmds.parent(locator, locator_grp)
|
||||||
|
|
||||||
# 读取关节数据
|
# 读取关节数据
|
||||||
json_file = os.path.join(os.getenv("SG_PATH"), "files/data/BodyJoints.json")
|
json_file = os.path.join(os.getenv("PATH"), "files/data/BodyJoints.json")
|
||||||
objects = cmds.SGReadJson(f=json_file, t="object")
|
objects = mfc.ReadJson(f=json_file, t="object")
|
||||||
|
|
||||||
for obj in objects:
|
for obj in objects:
|
||||||
joint_name = cmds.SGReadJson(d=obj, k="joint", t="string")[0]
|
joint_name = mfc.ReadJson(d=obj, k="joint", t="string")[0]
|
||||||
if joint_name in pose_joints:
|
if joint_name in pose_joints:
|
||||||
pos = cmds.SGReadJson(d=obj, k=pose, t="double")
|
pos = mfc.ReadJson(d=obj, k=pose, t="double")
|
||||||
joint_drv = f"{joint_name}_drv"
|
joint_drv = f"{joint_name}_drv"
|
||||||
|
|
||||||
# 创建并删除父约束以获取位置
|
# 创建并删除父约束以获取位置
|
||||||
@ -99,13 +94,13 @@ def sg_pose(pose):
|
|||||||
meshes = []
|
meshes = []
|
||||||
|
|
||||||
for index in mesh_indices:
|
for index in mesh_indices:
|
||||||
mesh = cmds.SGGetMeshes(m=index)
|
mesh = mfc.GetMeshes(m=index)
|
||||||
if cmds.objExists(mesh):
|
if cmds.objExists(mesh):
|
||||||
meshes.append(mesh)
|
meshes.append(mesh)
|
||||||
|
|
||||||
# 执行轴向修正和重置绑定姿势
|
# 执行轴向修正和重置绑定姿势
|
||||||
cmds.SGSkinAmendAxis()
|
mfc.SkinAmendAxis()
|
||||||
cmds.SGBindPoseReset(meshes)
|
mfc.BindPoseReset(meshes)
|
||||||
|
|
||||||
# 如果直接运行此脚本
|
# 如果直接运行此脚本
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
@ -1,14 +1,9 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 深圳时光科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2024/04/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
import math
|
import math
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def sg_presets_settings():
|
def sg_presets_settings():
|
||||||
"""
|
"""
|
||||||
@ -23,7 +18,7 @@ def sg_presets_settings():
|
|||||||
cmds.deleteUI('presetsSettingsWin')
|
cmds.deleteUI('presetsSettingsWin')
|
||||||
|
|
||||||
# 获取关节信息文件路径
|
# 获取关节信息文件路径
|
||||||
json_file = cmds.SGDescriptor(ti="jointsInfo")
|
json_file = mfc.Descriptor(ti="jointsInfo")
|
||||||
|
|
||||||
# 创建窗口
|
# 创建窗口
|
||||||
window = cmds.window('presetsSettingsWin',
|
window = cmds.window('presetsSettingsWin',
|
||||||
@ -50,27 +45,27 @@ def sg_presets_settings():
|
|||||||
|
|
||||||
# 左侧按钮
|
# 左侧按钮
|
||||||
cmds.button(label="Select Head Vertexs", align="center",
|
cmds.button(label="Select Head Vertexs", align="center",
|
||||||
command="cmds.SGSelectVertexs(0, 'head')")
|
command="mfc.SelectVertexs(0, 'head')")
|
||||||
cmds.button(label="Save Head Vertexs", align="center",
|
cmds.button(label="Save Head Vertexs", align="center",
|
||||||
command="cmds.SGSaveVertexs(0, 'head')")
|
command="mfc.SaveVertexs(0, 'head')")
|
||||||
cmds.separator(height=10, style="in")
|
cmds.separator(height=10, style="in")
|
||||||
|
|
||||||
cmds.button(label="Select Teeth Vertexs", align="center",
|
cmds.button(label="Select Teeth Vertexs", align="center",
|
||||||
command="cmds.SGSelectVertexs(1, 'teeth')")
|
command="mfc.SelectVertexs(1, 'teeth')")
|
||||||
cmds.button(label="Save Teeth Vertexs", align="center",
|
cmds.button(label="Save Teeth Vertexs", align="center",
|
||||||
command="cmds.SGSaveVertexs(1, 'teeth')")
|
command="mfc.SaveVertexs(1, 'teeth')")
|
||||||
cmds.separator(height=10, style="in")
|
cmds.separator(height=10, style="in")
|
||||||
|
|
||||||
cmds.button(label="Select EyeLeft Vertexs", align="center",
|
cmds.button(label="Select EyeLeft Vertexs", align="center",
|
||||||
command="cmds.SGSelectVertexs(3, 'eyeLeft')")
|
command="mfc.SelectVertexs(3, 'eyeLeft')")
|
||||||
cmds.button(label="Save EyeLeft Vertexs", align="center",
|
cmds.button(label="Save EyeLeft Vertexs", align="center",
|
||||||
command="cmds.SGSaveVertexs(3, 'eyeLeft')")
|
command="mfc.SaveVertexs(3, 'eyeLeft')")
|
||||||
cmds.separator(height=10, style="in")
|
cmds.separator(height=10, style="in")
|
||||||
|
|
||||||
cmds.button(label="Select EyeRight Vertexs", align="center",
|
cmds.button(label="Select EyeRight Vertexs", align="center",
|
||||||
command="cmds.SGSelectVertexs(4, 'eyeRight')")
|
command="mfc.SelectVertexs(4, 'eyeRight')")
|
||||||
cmds.button(label="Save EyeRight Vertexs", align="center",
|
cmds.button(label="Save EyeRight Vertexs", align="center",
|
||||||
command="cmds.SGSaveVertexs(4, 'eyeRight')")
|
command="mfc.SaveVertexs(4, 'eyeRight')")
|
||||||
cmds.setParent('..')
|
cmds.setParent('..')
|
||||||
|
|
||||||
# 右侧列布局
|
# 右侧列布局
|
||||||
@ -82,27 +77,27 @@ def sg_presets_settings():
|
|||||||
|
|
||||||
# 右侧按钮
|
# 右侧按钮
|
||||||
cmds.button(label="Select Body Vertexs", align="center",
|
cmds.button(label="Select Body Vertexs", align="center",
|
||||||
command="cmds.SGSelectVertexs(50, 'body')")
|
command="mfc.SelectVertexs(50, 'body')")
|
||||||
cmds.button(label="Save Body Vertexs", align="center",
|
cmds.button(label="Save Body Vertexs", align="center",
|
||||||
command="cmds.SGSaveVertexs(50, 'body')")
|
command="mfc.SaveVertexs(50, 'body')")
|
||||||
cmds.separator(height=10, style="in")
|
cmds.separator(height=10, style="in")
|
||||||
|
|
||||||
cmds.button(label="Select Neck Vertexs", align="center",
|
cmds.button(label="Select Neck Vertexs", align="center",
|
||||||
command="cmds.SGSelectVertexs(0, 'neck')")
|
command="mfc.SelectVertexs(0, 'neck')")
|
||||||
cmds.button(label="Save Neck Vertexs", align="center",
|
cmds.button(label="Save Neck Vertexs", align="center",
|
||||||
command="cmds.SGSaveVertexs(0, 'neck')")
|
command="mfc.SaveVertexs(0, 'neck')")
|
||||||
cmds.separator(height=10, style="in")
|
cmds.separator(height=10, style="in")
|
||||||
|
|
||||||
cmds.button(label="Select HeadEye Vertexs", align="center",
|
cmds.button(label="Select HeadEye Vertexs", align="center",
|
||||||
command="cmds.SGSelectVertexs(0, 'headEye')")
|
command="mfc.SelectVertexs(0, 'headEye')")
|
||||||
cmds.button(label="Save HeadEye Vertexs", align="center",
|
cmds.button(label="Save HeadEye Vertexs", align="center",
|
||||||
command="cmds.SGSaveVertexs(0, 'headEye')")
|
command="mfc.SaveVertexs(0, 'headEye')")
|
||||||
cmds.separator(height=10, style="in")
|
cmds.separator(height=10, style="in")
|
||||||
|
|
||||||
cmds.button(label="Select HeadMouth Vertexs", align="center",
|
cmds.button(label="Select HeadMouth Vertexs", align="center",
|
||||||
command="cmds.SGSelectVertexs(0, 'headMouth')")
|
command="mfc.SelectVertexs(0, 'headMouth')")
|
||||||
cmds.button(label="Save HeadMouth Vertexs", align="center",
|
cmds.button(label="Save HeadMouth Vertexs", align="center",
|
||||||
command="cmds.SGSaveVertexs(0, 'headMouth')")
|
command="mfc.SaveVertexs(0, 'headMouth')")
|
||||||
cmds.setParent('..')
|
cmds.setParent('..')
|
||||||
|
|
||||||
# 底部列布局
|
# 底部列布局
|
||||||
@ -114,14 +109,14 @@ def sg_presets_settings():
|
|||||||
|
|
||||||
cmds.separator(height=10, style="in")
|
cmds.separator(height=10, style="in")
|
||||||
cmds.button(label="The Closest Point Of The Head", align="center",
|
cmds.button(label="The Closest Point Of The Head", align="center",
|
||||||
command="cmds.SGGetClosestPointOnMesh(0)")
|
command="mfc.GetClosestPointOnMesh(0)")
|
||||||
cmds.button(label="The Closest Point Of The Body", align="center",
|
cmds.button(label="The Closest Point Of The Body", align="center",
|
||||||
command="cmds.SGGetClosestPointOnMesh(50)")
|
command="mfc.GetClosestPointOnMesh(50)")
|
||||||
cmds.button(label="The Closest Point Of The Teeth", align="center",
|
cmds.button(label="The Closest Point Of The Teeth", align="center",
|
||||||
command="cmds.SGGetClosestPointOnMesh(1)")
|
command="mfc.GetClosestPointOnMesh(1)")
|
||||||
cmds.separator(height=10, style="in")
|
cmds.separator(height=10, style="in")
|
||||||
cmds.button(label="Write Joints Default Position", align="center",
|
cmds.button(label="Write Joints Default Position", align="center",
|
||||||
command="cmds.SGWriteJointsDefaultPosition()")
|
command="mfc.WriteJointsDefaultPosition()")
|
||||||
cmds.separator(height=10, style="in")
|
cmds.separator(height=10, style="in")
|
||||||
cmds.setParent('..')
|
cmds.setParent('..')
|
||||||
|
|
||||||
@ -152,9 +147,9 @@ def sg_select_vertexs(mesh_index, region):
|
|||||||
mesh_index: 网格索引
|
mesh_index: 网格索引
|
||||||
region: 区域名称
|
region: 区域名称
|
||||||
"""
|
"""
|
||||||
open_file = cmds.SGDescriptor(ti="vertexsInfo")
|
open_file = mfc.Descriptor(ti="vertexsInfo")
|
||||||
mesh = cmds.SGGetMeshes(m=mesh_index)
|
mesh = mfc.GetMeshes(m=mesh_index)
|
||||||
vertexs = cmds.SGReadJson(f=open_file, k=region, t="int")
|
vertexs = mfc.ReadJson(f=open_file, k=region, t="int")
|
||||||
|
|
||||||
cmds.select(cl=True)
|
cmds.select(cl=True)
|
||||||
for vertex in vertexs:
|
for vertex in vertexs:
|
||||||
@ -167,8 +162,8 @@ def sg_save_vertexs(mesh_index, region):
|
|||||||
mesh_index: 网格索引
|
mesh_index: 网格索引
|
||||||
region: 区域名称
|
region: 区域名称
|
||||||
"""
|
"""
|
||||||
json_file = cmds.SGDescriptor(ti="vertexsInfo")
|
json_file = mfc.Descriptor(ti="vertexsInfo")
|
||||||
mesh = cmds.SGGetMeshes(m=mesh_index)
|
mesh = mfc.GetMeshes(m=mesh_index)
|
||||||
selection = cmds.ls(sl=True, fl=True)
|
selection = cmds.ls(sl=True, fl=True)
|
||||||
|
|
||||||
indices = []
|
indices = []
|
||||||
@ -179,7 +174,7 @@ def sg_save_vertexs(mesh_index, region):
|
|||||||
return
|
return
|
||||||
indices.append(int(vertex_id.strip('vtx[]')))
|
indices.append(int(vertex_id.strip('vtx[]')))
|
||||||
|
|
||||||
cmds.SGWriteJson(of=json_file, sf=json_file, k=region, t="int", value=indices)
|
mfc.WriteJson(of=json_file, sf=json_file, k=region, t="int", value=indices)
|
||||||
|
|
||||||
def sg_get_closest_point_on_mesh(mesh_index):
|
def sg_get_closest_point_on_mesh(mesh_index):
|
||||||
"""
|
"""
|
||||||
@ -187,22 +182,22 @@ def sg_get_closest_point_on_mesh(mesh_index):
|
|||||||
Args:
|
Args:
|
||||||
mesh_index: 网格索引
|
mesh_index: 网格索引
|
||||||
"""
|
"""
|
||||||
open_file = cmds.SGDescriptor(ti="jointsInfo")
|
open_file = mfc.Descriptor(ti="jointsInfo")
|
||||||
mesh = cmds.SGGetMeshes(m=mesh_index)
|
mesh = mfc.GetMeshes(m=mesh_index)
|
||||||
closest_point_node = cmds.createNode('closestPointOnMesh')
|
closest_point_node = cmds.createNode('closestPointOnMesh')
|
||||||
cmds.connectAttr(f"{mesh}.worldMesh[0]", f"{closest_point_node}.inMesh", f=True)
|
cmds.connectAttr(f"{mesh}.worldMesh[0]", f"{closest_point_node}.inMesh", f=True)
|
||||||
|
|
||||||
key = "head" if mesh_index != 50 else "body"
|
key = "head" if mesh_index != 50 else "body"
|
||||||
cmds.select(cl=True)
|
cmds.select(cl=True)
|
||||||
|
|
||||||
objects = cmds.SGReadJson(f=open_file, k=key, t="object")
|
objects = mfc.ReadJson(f=open_file, k=key, t="object")
|
||||||
|
|
||||||
for obj in objects:
|
for obj in objects:
|
||||||
joint_name = cmds.SGReadJson(d=obj, k="joint", t="string")[0]
|
joint_name = mfc.ReadJson(d=obj, k="joint", t="string")[0]
|
||||||
|
|
||||||
if mesh_index in [0, 1]:
|
if mesh_index in [0, 1]:
|
||||||
joint = f"DHIhead:{joint_name}"
|
joint = f"DHIhead:{joint_name}"
|
||||||
index = cmds.SGReadJson(d=obj, k="mesh", t="int")[0]
|
index = mfc.ReadJson(d=obj, k="mesh", t="int")[0]
|
||||||
if index == mesh_index:
|
if index == mesh_index:
|
||||||
point_position = cmds.xform(joint, q=True, ws=True, t=True)
|
point_position = cmds.xform(joint, q=True, ws=True, t=True)
|
||||||
cmds.setAttr(f"{closest_point_node}.inPosition", *point_position)
|
cmds.setAttr(f"{closest_point_node}.inPosition", *point_position)
|
||||||
@ -210,7 +205,7 @@ def sg_get_closest_point_on_mesh(mesh_index):
|
|||||||
cmds.select(f"{mesh}.vtx[{closest_vertex_index}]", add=True)
|
cmds.select(f"{mesh}.vtx[{closest_vertex_index}]", add=True)
|
||||||
else:
|
else:
|
||||||
joint = f"{joint_name}_drv"
|
joint = f"{joint_name}_drv"
|
||||||
enable = cmds.SGReadJson(d=obj, k="enable", t="bool")[0]
|
enable = mfc.ReadJson(d=obj, k="enable", t="bool")[0]
|
||||||
if enable:
|
if enable:
|
||||||
point_position = cmds.xform(joint, q=True, ws=True, t=True)
|
point_position = cmds.xform(joint, q=True, ws=True, t=True)
|
||||||
cmds.setAttr(f"{closest_point_node}.inPosition", *point_position)
|
cmds.setAttr(f"{closest_point_node}.inPosition", *point_position)
|
||||||
@ -223,37 +218,37 @@ def sg_write_joints_default_position():
|
|||||||
"""
|
"""
|
||||||
写入关节默认位置
|
写入关节默认位置
|
||||||
"""
|
"""
|
||||||
json_file = cmds.SGDescriptor(ti="jointsInfo")
|
json_file = mfc.Descriptor(ti="jointsInfo")
|
||||||
|
|
||||||
# 处理身体关节
|
# 处理身体关节
|
||||||
object_body = cmds.SGReadJson(f=json_file, k="body", t="object")
|
object_body = mfc.ReadJson(f=json_file, k="body", t="object")
|
||||||
for i, obj in enumerate(object_body):
|
for i, obj in enumerate(object_body):
|
||||||
joint_name = cmds.SGReadJson(d=obj, k="joint", t="string")[0]
|
joint_name = mfc.ReadJson(d=obj, k="joint", t="string")[0]
|
||||||
joint = f"{joint_name}_drv"
|
joint = f"{joint_name}_drv"
|
||||||
pos = cmds.xform(joint, q=True, ws=True, t=True)
|
pos = cmds.xform(joint, q=True, ws=True, t=True)
|
||||||
|
|
||||||
# 四舍五入到小数点后4位
|
# 四舍五入到小数点后4位
|
||||||
pos = [round(x * 10000) / 10000 for x in pos]
|
pos = [round(x * 10000) / 10000 for x in pos]
|
||||||
|
|
||||||
data = cmds.SGWriteJson(d=obj, sf="data", k="translate", t="double", value=pos)
|
data = mfc.WriteJson(d=obj, sf="data", k="translate", t="double", value=pos)
|
||||||
object_body[i] = data
|
object_body[i] = data
|
||||||
|
|
||||||
cmds.SGWriteJson(of=json_file, sf=json_file, k="body", t="object", value=object_body)
|
mfc.WriteJson(of=json_file, sf=json_file, k="body", t="object", value=object_body)
|
||||||
|
|
||||||
# 处理头部关节
|
# 处理头部关节
|
||||||
object_head = cmds.SGReadJson(f=json_file, k="head", t="object")
|
object_head = mfc.ReadJson(f=json_file, k="head", t="object")
|
||||||
for i, obj in enumerate(object_head):
|
for i, obj in enumerate(object_head):
|
||||||
joint_name = cmds.SGReadJson(d=obj, k="joint", t="string")[0]
|
joint_name = mfc.ReadJson(d=obj, k="joint", t="string")[0]
|
||||||
joint = f"DHIhead:{joint_name}"
|
joint = f"DHIhead:{joint_name}"
|
||||||
pos = cmds.xform(joint, q=True, ws=True, t=True)
|
pos = cmds.xform(joint, q=True, ws=True, t=True)
|
||||||
|
|
||||||
# 四舍五入到小数点后4位
|
# 四舍五入到小数点后4位
|
||||||
pos = [round(x * 10000) / 10000 for x in pos]
|
pos = [round(x * 10000) / 10000 for x in pos]
|
||||||
|
|
||||||
data = cmds.SGWriteJson(d=obj, sf="data", k="translate", t="double", value=pos)
|
data = mfc.WriteJson(d=obj, sf="data", k="translate", t="double", value=pos)
|
||||||
object_head[i] = data
|
object_head[i] = data
|
||||||
|
|
||||||
cmds.SGWriteJson(of=json_file, sf=json_file, k="head", t="object", value=object_head)
|
mfc.WriteJson(of=json_file, sf=json_file, k="head", t="object", value=object_head)
|
||||||
|
|
||||||
# 如果直接运行此脚本
|
# 如果直接运行此脚本
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
@ -1,13 +1,8 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 深圳时光科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2024/11/18
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def sg_rbf_deformer_window():
|
def sg_rbf_deformer_window():
|
||||||
"""
|
"""
|
||||||
@ -31,7 +26,7 @@ def sg_rbf_deformer_window():
|
|||||||
'Execute': 'Execute'
|
'Execute': 'Execute'
|
||||||
}
|
}
|
||||||
|
|
||||||
if cmds.SGDescriptor(l=True) == "ZH":
|
if mfc.Descriptor(l=True) == "ZH":
|
||||||
texts.update({
|
texts.update({
|
||||||
'Load': '加载...',
|
'Load': '加载...',
|
||||||
'Original': '原始模型:',
|
'Original': '原始模型:',
|
||||||
@ -148,7 +143,7 @@ def sg_rbf_deformer_execute(*args):
|
|||||||
selection = cmds.ls(selection=True)
|
selection = cmds.ls(selection=True)
|
||||||
|
|
||||||
# 执行RBF变形
|
# 执行RBF变形
|
||||||
cmds.SGRBFDeformer(r=radius, np=points, rbf=1, m=[original, deformed], t=selection)
|
mfc.RBFDeformer(r=radius, np=points, rbf=1, m=[original, deformed], t=selection)
|
||||||
|
|
||||||
def sg_rbf_deformer_load_original(*args):
|
def sg_rbf_deformer_load_original(*args):
|
||||||
"""
|
"""
|
@ -1,13 +1,8 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 深圳时光科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def sg_range_blend_shape_all(range_value):
|
def sg_range_blend_shape_all(range_value):
|
||||||
"""
|
"""
|
||||||
@ -18,11 +13,11 @@ def sg_range_blend_shape_all(range_value):
|
|||||||
# 遍历前50个网格
|
# 遍历前50个网格
|
||||||
for i in range(50):
|
for i in range(50):
|
||||||
# 获取当前索引的网格
|
# 获取当前索引的网格
|
||||||
mesh = cmds.SGGetMeshes(m=i)
|
mesh = mfc.GetMeshes(m=i)
|
||||||
|
|
||||||
if cmds.objExists(mesh):
|
if cmds.objExists(mesh):
|
||||||
# 获取网格的混合变形器
|
# 获取网格的混合变形器
|
||||||
blend_shape = cmds.SGGetBlendShape(mesh)
|
blend_shape = mfc.GetBlendShape(mesh)
|
||||||
|
|
||||||
if cmds.objExists(blend_shape):
|
if cmds.objExists(blend_shape):
|
||||||
# 获取所有权重属性
|
# 获取所有权重属性
|
||||||
@ -51,7 +46,7 @@ def sg_range_blend_shape_all(range_value):
|
|||||||
target=j
|
target=j
|
||||||
)
|
)
|
||||||
|
|
||||||
cmds.SGSetBlendShapes(r=range_value, value=bs_name[0])
|
mfc.SetBlendShapes(r=range_value, value=bs_name[0])
|
||||||
cmds.delete(bs_name)
|
cmds.delete(bs_name)
|
||||||
|
|
||||||
# 更新进度窗口
|
# 更新进度窗口
|
@ -1,13 +1,8 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 深圳时光科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def sg_range_blend_shape_select(mesh_indices, target_indices, range_value):
|
def sg_range_blend_shape_select(mesh_indices, target_indices, range_value):
|
||||||
"""
|
"""
|
||||||
@ -20,8 +15,8 @@ def sg_range_blend_shape_select(mesh_indices, target_indices, range_value):
|
|||||||
count = len(mesh_indices)
|
count = len(mesh_indices)
|
||||||
|
|
||||||
# 初始化进度条
|
# 初始化进度条
|
||||||
cmds.SGProgressBar(sp=True)
|
mfc.ProgressBar(sp=True)
|
||||||
cmds.SGProgressBar(max=count)
|
mfc.ProgressBar(max=count)
|
||||||
|
|
||||||
# 处理每个网格和目标
|
# 处理每个网格和目标
|
||||||
for i in range(count):
|
for i in range(count):
|
||||||
@ -29,11 +24,11 @@ def sg_range_blend_shape_select(mesh_indices, target_indices, range_value):
|
|||||||
target_index = target_indices[i]
|
target_index = target_indices[i]
|
||||||
|
|
||||||
# 获取网格
|
# 获取网格
|
||||||
mesh = cmds.SGGetMeshes(m=mesh_index)
|
mesh = mfc.GetMeshes(m=mesh_index)
|
||||||
|
|
||||||
if cmds.objExists(mesh):
|
if cmds.objExists(mesh):
|
||||||
# 获取混合变形器
|
# 获取混合变形器
|
||||||
blend_shape = cmds.SGGetBlendShape(mesh)
|
blend_shape = mfc.GetBlendShape(mesh)
|
||||||
|
|
||||||
if cmds.objExists(blend_shape):
|
if cmds.objExists(blend_shape):
|
||||||
# 重新生成目标并设置范围
|
# 重新生成目标并设置范围
|
||||||
@ -44,16 +39,16 @@ def sg_range_blend_shape_select(mesh_indices, target_indices, range_value):
|
|||||||
target=target_index
|
target=target_index
|
||||||
)
|
)
|
||||||
|
|
||||||
cmds.SGSetBlendShapes(r=range_value, value=bs_name[0])
|
mfc.SetBlendShapes(r=range_value, value=bs_name[0])
|
||||||
cmds.delete(bs_name)
|
cmds.delete(bs_name)
|
||||||
|
|
||||||
# 更新进度条
|
# 更新进度条
|
||||||
title = f"[{i+1}/{count}]Select Target Mesh..."
|
title = f"[{i+1}/{count}]Select Target Mesh..."
|
||||||
cmds.SGProgressBar(t=title)
|
mfc.ProgressBar(t=title)
|
||||||
cmds.SGProgressBar(apr=1)
|
mfc.ProgressBar(apr=1)
|
||||||
|
|
||||||
# 结束进度条
|
# 结束进度条
|
||||||
cmds.SGProgressBar(ep=True)
|
mfc.ProgressBar(ep=True)
|
||||||
|
|
||||||
# 如果直接运行此脚本
|
# 如果直接运行此脚本
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
@ -1,12 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 深圳时光科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
|
||||||
def sg_rebuild_target(target_ids, blend_shape):
|
def sg_rebuild_target(target_ids, blend_shape):
|
@ -1,13 +1,8 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 深圳时光科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def sg_meshes_list():
|
def sg_meshes_list():
|
||||||
"""
|
"""
|
||||||
@ -16,16 +11,16 @@ def sg_meshes_list():
|
|||||||
list: 网格名称列表
|
list: 网格名称列表
|
||||||
"""
|
"""
|
||||||
meshes = []
|
meshes = []
|
||||||
edition = cmds.SGDescriptor(ed=True)
|
edition = mfc.Descriptor(ed=True)
|
||||||
|
|
||||||
if edition >= 2:
|
if edition >= 2:
|
||||||
# 获取LOD0的网格索引
|
# 获取LOD0的网格索引
|
||||||
mesh_indices = cmds.SGGetMeshes(lod=0)
|
mesh_indices = mfc.GetMeshes(lod=0)
|
||||||
for index in mesh_indices:
|
for index in mesh_indices:
|
||||||
meshes.append(cmds.SGGetMeshes(i=index))
|
meshes.append(mfc.GetMeshes(i=index))
|
||||||
else:
|
else:
|
||||||
# 获取所有网格
|
# 获取所有网格
|
||||||
meshes = cmds.SGGetMeshes()
|
meshes = mfc.GetMeshes()
|
||||||
|
|
||||||
return meshes
|
return meshes
|
||||||
|
|
||||||
@ -36,7 +31,7 @@ def sg_set_mesh_line_edit(index, mesh):
|
|||||||
index (int): 网格索引
|
index (int): 网格索引
|
||||||
mesh (str): 网格名称
|
mesh (str): 网格名称
|
||||||
"""
|
"""
|
||||||
meshes = cmds.SGGetMeshes()
|
meshes = mfc.GetMeshes()
|
||||||
|
|
||||||
if mesh:
|
if mesh:
|
||||||
# 设置选项变量
|
# 设置选项变量
|
||||||
@ -58,9 +53,9 @@ def sg_refresh_geo_line_edit():
|
|||||||
if cmds.objExists(mesh):
|
if cmds.objExists(mesh):
|
||||||
# 如果对象存在,设置网格
|
# 如果对象存在,设置网格
|
||||||
if mesh_name == "body_lod0_mesh":
|
if mesh_name == "body_lod0_mesh":
|
||||||
cmds.SGSetMeshes(m=50, value=mesh)
|
mfc.SetMeshes(m=50, value=mesh)
|
||||||
else:
|
else:
|
||||||
cmds.SGSetMeshes(m=i, value=mesh)
|
mfc.SetMeshes(m=i, value=mesh)
|
||||||
else:
|
else:
|
||||||
# 如果对象不存在,尝试通过名称模式查找
|
# 如果对象不存在,尝试通过名称模式查找
|
||||||
selection = cmds.ls(f"*{mesh_name}*", type="transform")
|
selection = cmds.ls(f"*{mesh_name}*", type="transform")
|
||||||
@ -68,13 +63,13 @@ def sg_refresh_geo_line_edit():
|
|||||||
for sel in selection:
|
for sel in selection:
|
||||||
if cmds.objectType(sel) == "transform":
|
if cmds.objectType(sel) == "transform":
|
||||||
if mesh_name == "body_lod0_mesh":
|
if mesh_name == "body_lod0_mesh":
|
||||||
cmds.SGSetMeshes(m=50, value=sel)
|
mfc.SetMeshes(m=50, value=sel)
|
||||||
else:
|
else:
|
||||||
cmds.SGSetMeshes(m=i, value=sel)
|
mfc.SetMeshes(m=i, value=sel)
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
# 如果找不到匹配的对象,清除设置
|
# 如果找不到匹配的对象,清除设置
|
||||||
cmds.SGSetMeshes(m=i, value="")
|
mfc.SetMeshes(m=i, value="")
|
||||||
else:
|
else:
|
||||||
# 如果不存在选项变量,尝试通过名称模式查找
|
# 如果不存在选项变量,尝试通过名称模式查找
|
||||||
selection = cmds.ls(f"*{mesh_name}*", type="transform")
|
selection = cmds.ls(f"*{mesh_name}*", type="transform")
|
||||||
@ -82,13 +77,13 @@ def sg_refresh_geo_line_edit():
|
|||||||
for sel in selection:
|
for sel in selection:
|
||||||
if cmds.objectType(sel) == "transform":
|
if cmds.objectType(sel) == "transform":
|
||||||
if mesh_name == "body_lod0_mesh":
|
if mesh_name == "body_lod0_mesh":
|
||||||
cmds.SGSetMeshes(m=50, value=sel)
|
mfc.SetMeshes(m=50, value=sel)
|
||||||
else:
|
else:
|
||||||
cmds.SGSetMeshes(m=i, value=sel)
|
mfc.SetMeshes(m=i, value=sel)
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
# 如果找不到匹配的对象,清除设置
|
# 如果找不到匹配的对象,清除设置
|
||||||
cmds.SGSetMeshes(m=i, value="")
|
mfc.SetMeshes(m=i, value="")
|
||||||
|
|
||||||
# 如果直接运行此脚本
|
# 如果直接运行此脚本
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
@ -1,20 +1,15 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 深圳时光科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def sg_refresh_neutral_joint_translation():
|
def sg_refresh_neutral_joint_translation():
|
||||||
"""
|
"""
|
||||||
刷新关节的中性位置平移值
|
刷新关节的中性位置平移值
|
||||||
"""
|
"""
|
||||||
# 获取所有关节
|
# 获取所有关节
|
||||||
joints = cmds.SGGetJoints()
|
joints = mfc.GetJoints()
|
||||||
|
|
||||||
# 遍历每个关节
|
# 遍历每个关节
|
||||||
for i, joint in enumerate(joints):
|
for i, joint in enumerate(joints):
|
||||||
@ -22,7 +17,7 @@ def sg_refresh_neutral_joint_translation():
|
|||||||
pos = cmds.getAttr(f"{joint}.t")[0]
|
pos = cmds.getAttr(f"{joint}.t")[0]
|
||||||
|
|
||||||
# 设置关节的中性位置
|
# 设置关节的中性位置
|
||||||
cmds.SGSetNeutralJointTranslations(i, pos[0], pos[1], pos[2])
|
mfc.SetNeutralJointTranslations(i, pos[0], pos[1], pos[2])
|
||||||
|
|
||||||
# 如果直接运行此脚本
|
# 如果直接运行此脚本
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
@ -1,13 +1,8 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 深圳时光科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def sg_rename_blend_shapes():
|
def sg_rename_blend_shapes():
|
||||||
"""
|
"""
|
||||||
@ -17,7 +12,7 @@ def sg_rename_blend_shapes():
|
|||||||
# 遍历前50个网格
|
# 遍历前50个网格
|
||||||
for j in range(50):
|
for j in range(50):
|
||||||
# 获取网格名称
|
# 获取网格名称
|
||||||
mesh = cmds.SGGetMeshes(i=j)
|
mesh = mfc.GetMeshes(i=j)
|
||||||
blend_shape = f"{mesh}_blendShapes"
|
blend_shape = f"{mesh}_blendShapes"
|
||||||
|
|
||||||
# 检查混合变形器是否存在
|
# 检查混合变形器是否存在
|
@ -1,13 +1,8 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 深圳时光科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2024/09/16
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def is_sorted(array):
|
def is_sorted(array):
|
||||||
"""
|
"""
|
||||||
@ -49,10 +44,10 @@ def sg_reorder_blend_shapes():
|
|||||||
"""
|
"""
|
||||||
# 遍历前50个网格
|
# 遍历前50个网格
|
||||||
for mesh_index in range(50):
|
for mesh_index in range(50):
|
||||||
mesh = cmds.SGGetMeshes(m=mesh_index)
|
mesh = mfc.GetMeshes(m=mesh_index)
|
||||||
|
|
||||||
if cmds.objExists(mesh):
|
if cmds.objExists(mesh):
|
||||||
blend_shape = cmds.SGGetBlendShape(mesh)
|
blend_shape = mfc.GetBlendShape(mesh)
|
||||||
|
|
||||||
if cmds.objExists(blend_shape):
|
if cmds.objExists(blend_shape):
|
||||||
attr_weight = f"{blend_shape}.weight"
|
attr_weight = f"{blend_shape}.weight"
|
||||||
@ -63,7 +58,7 @@ def sg_reorder_blend_shapes():
|
|||||||
|
|
||||||
# 获取当前和预期的混合变形目标列表
|
# 获取当前和预期的混合变形目标列表
|
||||||
current_blend_shape_list = cmds.listAttr(attr_weight, m=True)
|
current_blend_shape_list = cmds.listAttr(attr_weight, m=True)
|
||||||
blend_shape_list = cmds.SGGetBlendShapes()
|
blend_shape_list = mfc.GetBlendShapes()
|
||||||
|
|
||||||
# 检查是否需要重新排序
|
# 检查是否需要重新排序
|
||||||
needs_reorder = (
|
needs_reorder = (
|
@ -1,13 +1,8 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 深圳时光科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2024/02/23
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def sg_repair_joint_for_lod(lod):
|
def sg_repair_joint_for_lod(lod):
|
||||||
"""
|
"""
|
||||||
@ -16,12 +11,12 @@ def sg_repair_joint_for_lod(lod):
|
|||||||
lod (int): LOD级别
|
lod (int): LOD级别
|
||||||
"""
|
"""
|
||||||
# 获取指定LOD级别的关节索引列表
|
# 获取指定LOD级别的关节索引列表
|
||||||
joints = cmds.SGGetJoints(lod=lod, t="int")
|
joints = mfc.GetJoints(lod=lod, t="int")
|
||||||
|
|
||||||
# 遍历每个关节索引
|
# 遍历每个关节索引
|
||||||
for i, index in enumerate(joints):
|
for i, index in enumerate(joints):
|
||||||
# 获取关节名称
|
# 获取关节名称
|
||||||
joint = cmds.SGGetJoints(i=index)
|
joint = mfc.GetJoints(i=index)
|
||||||
|
|
||||||
# 如果关节不存在,则创建并设置
|
# 如果关节不存在,则创建并设置
|
||||||
if not cmds.objExists(joint):
|
if not cmds.objExists(joint):
|
||||||
@ -29,14 +24,14 @@ def sg_repair_joint_for_lod(lod):
|
|||||||
cmds.joint(p=(0, 0, 0), name=joint)
|
cmds.joint(p=(0, 0, 0), name=joint)
|
||||||
|
|
||||||
# 获取并设置父关节
|
# 获取并设置父关节
|
||||||
parent = cmds.SGGetJoints(p=index)
|
parent = mfc.GetJoints(p=index)
|
||||||
try:
|
try:
|
||||||
cmds.parent(joint, parent)
|
cmds.parent(joint, parent)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# 获取并设置关节的中性位置
|
# 获取并设置关节的中性位置
|
||||||
pos = cmds.SGGetNeutralJointTranslations(i=index)
|
pos = mfc.GetNeutralJointTranslations(i=index)
|
||||||
|
|
||||||
# 设置平移和旋转
|
# 设置平移和旋转
|
||||||
cmds.setAttr(f"{joint}.t", pos[0], pos[1], pos[2], type="float3")
|
cmds.setAttr(f"{joint}.t", pos[0], pos[1], pos[2], type="float3")
|
@ -1,13 +1,8 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 深圳时光科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2024/03/01
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def sg_meta_human_normals():
|
def sg_meta_human_normals():
|
||||||
"""
|
"""
|
||||||
@ -53,21 +48,21 @@ def sg_repair_normals(index):
|
|||||||
vtxs = sg_meta_human_normals()
|
vtxs = sg_meta_human_normals()
|
||||||
|
|
||||||
# 获取头部和身体模型
|
# 获取头部和身体模型
|
||||||
head = cmds.SGGetMeshes(m=0)
|
head = mfc.GetMeshes(m=0)
|
||||||
body = cmds.SGGetMeshes(m=50)
|
body = mfc.GetMeshes(m=50)
|
||||||
|
|
||||||
# 计算需要处理的顶点对数量
|
# 计算需要处理的顶点对数量
|
||||||
count = len(vtxs) // 2
|
count = len(vtxs) // 2
|
||||||
|
|
||||||
# 初始化进度条
|
# 初始化进度条
|
||||||
cmds.SGProgressBar(sp=True)
|
mfc.ProgressBar(sp=True)
|
||||||
cmds.SGProgressBar(max=count)
|
mfc.ProgressBar(max=count)
|
||||||
cmds.SGProgressBar(t="Repair Normals...")
|
mfc.ProgressBar(t="Repair Normals...")
|
||||||
|
|
||||||
# 处理每对对应的顶点
|
# 处理每对对应的顶点
|
||||||
for i in range(count):
|
for i in range(count):
|
||||||
# 更新进度条
|
# 更新进度条
|
||||||
cmds.SGProgressBar(apr=1)
|
mfc.ProgressBar(apr=1)
|
||||||
|
|
||||||
# 获取头部和身体对应的顶点索引
|
# 获取头部和身体对应的顶点索引
|
||||||
h = vtxs[i*2]
|
h = vtxs[i*2]
|
||||||
@ -84,7 +79,7 @@ def sg_repair_normals(index):
|
|||||||
cmds.polyNormalPerVertex(body_vtx, xyz=(pos[0], pos[1], pos[2]))
|
cmds.polyNormalPerVertex(body_vtx, xyz=(pos[0], pos[1], pos[2]))
|
||||||
|
|
||||||
# 结束进度条
|
# 结束进度条
|
||||||
cmds.SGProgressBar(ep=True)
|
mfc.ProgressBar(ep=True)
|
||||||
|
|
||||||
# 清除选择并选择身体模型
|
# 清除选择并选择身体模型
|
||||||
cmds.select(clear=True)
|
cmds.select(clear=True)
|
@ -1,13 +1,8 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 深圳时光科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2024/10/21
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def sg_meta_human_normals():
|
def sg_meta_human_normals():
|
||||||
"""
|
"""
|
||||||
@ -60,8 +55,8 @@ def sg_repair_seams():
|
|||||||
vtxs = sg_meta_human_normals()
|
vtxs = sg_meta_human_normals()
|
||||||
|
|
||||||
# 获取头部和身体模型
|
# 获取头部和身体模型
|
||||||
head = cmds.SGGetMeshes(m=0)
|
head = mfc.GetMeshes(m=0)
|
||||||
body = cmds.SGGetMeshes(m=50)
|
body = mfc.GetMeshes(m=50)
|
||||||
|
|
||||||
# 复制头部模型
|
# 复制头部模型
|
||||||
head_copy = cmds.duplicate(head, rr=True)[0]
|
head_copy = cmds.duplicate(head, rr=True)[0]
|
||||||
@ -87,7 +82,7 @@ def sg_repair_seams():
|
|||||||
head_vtxs.extend(neck_vtxs)
|
head_vtxs.extend(neck_vtxs)
|
||||||
|
|
||||||
# 应用RBF变形器
|
# 应用RBF变形器
|
||||||
cmds.SGRBFDeformer(
|
mfc.RBFDeformer(
|
||||||
rbf=1,
|
rbf=1,
|
||||||
m=[head, head_copy],
|
m=[head, head_copy],
|
||||||
t=[head],
|
t=[head],
|
@ -1,13 +1,8 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 深圳时光科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2024/03/23
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def sg_repair_vertex_order():
|
def sg_repair_vertex_order():
|
||||||
"""
|
"""
|
||||||
@ -17,7 +12,7 @@ def sg_repair_vertex_order():
|
|||||||
# 遍历所有网格
|
# 遍历所有网格
|
||||||
for i in range(54):
|
for i in range(54):
|
||||||
# 获取目标模型
|
# 获取目标模型
|
||||||
target = cmds.SGGetMeshes(m=i)
|
target = mfc.GetMeshes(m=i)
|
||||||
|
|
||||||
if cmds.objExists(target):
|
if cmds.objExists(target):
|
||||||
# 清除历史记录
|
# 清除历史记录
|
||||||
@ -25,13 +20,13 @@ def sg_repair_vertex_order():
|
|||||||
cmds.DeleteAllHistory()
|
cmds.DeleteAllHistory()
|
||||||
|
|
||||||
# 获取源模型并重命名
|
# 获取源模型并重命名
|
||||||
source = cmds.SGGetMeshes(cm=i)
|
source = mfc.GetMeshes(cm=i)
|
||||||
source_buffer = f"{source}_buffer"
|
source_buffer = f"{source}_buffer"
|
||||||
source_buffer = source_buffer[1:] # 移除第一个字符
|
source_buffer = source_buffer[1:] # 移除第一个字符
|
||||||
source_buffer = cmds.rename(source, source_buffer)
|
source_buffer = cmds.rename(source, source_buffer)
|
||||||
|
|
||||||
# 应用顶点顺序
|
# 应用顶点顺序
|
||||||
cmds.SGSetMeshes(tvo=source_buffer, value=target)
|
mfc.SetMeshes(tvo=source_buffer, value=target)
|
||||||
|
|
||||||
# 删除临时模型
|
# 删除临时模型
|
||||||
cmds.delete(source_buffer)
|
cmds.delete(source_buffer)
|
@ -1,13 +1,8 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 深圳时光科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def sg_reset_blend_shapes():
|
def sg_reset_blend_shapes():
|
||||||
"""
|
"""
|
||||||
@ -17,7 +12,7 @@ def sg_reset_blend_shapes():
|
|||||||
# 遍历前50个网格
|
# 遍历前50个网格
|
||||||
for j in range(50):
|
for j in range(50):
|
||||||
# 获取网格名称
|
# 获取网格名称
|
||||||
mesh = cmds.SGGetMeshes(i=j)
|
mesh = mfc.GetMeshes(i=j)
|
||||||
blend_shape = f"{mesh}_blendShapes"
|
blend_shape = f"{mesh}_blendShapes"
|
||||||
|
|
||||||
# 检查混合变形器是否存在
|
# 检查混合变形器是否存在
|
@ -1,12 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 深圳时光科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
|
||||||
def sg_reset_target(target_ids, blend_shape):
|
def sg_reset_target(target_ids, blend_shape):
|
@ -1,32 +1,27 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 深圳时光科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def sg_save_blend_shape():
|
def sg_save_blend_shape():
|
||||||
"""
|
"""
|
||||||
保存所有网格的混合变形目标
|
保存所有网格的混合变形目标
|
||||||
"""
|
"""
|
||||||
# 保存混合变形映射
|
# 保存混合变形映射
|
||||||
cmds.SGSaveBlendShapeMappings(0)
|
mfc.SaveBlendShapeMappings(0)
|
||||||
|
|
||||||
# 初始化进度条
|
# 初始化进度条
|
||||||
cmds.SGProgressBar(sp=True)
|
mfc.ProgressBar(sp=True)
|
||||||
|
|
||||||
# 遍历前50个网格
|
# 遍历前50个网格
|
||||||
for mesh_index in range(50):
|
for mesh_index in range(50):
|
||||||
# 获取网格
|
# 获取网格
|
||||||
mesh = cmds.SGGetMeshes(m=mesh_index)
|
mesh = mfc.GetMeshes(m=mesh_index)
|
||||||
|
|
||||||
if cmds.objExists(mesh):
|
if cmds.objExists(mesh):
|
||||||
# 获取混合变形器
|
# 获取混合变形器
|
||||||
blend_shape = cmds.SGGetBlendShape(mesh)
|
blend_shape = mfc.GetBlendShape(mesh)
|
||||||
|
|
||||||
if cmds.objExists(blend_shape):
|
if cmds.objExists(blend_shape):
|
||||||
# 获取混合变形目标数量
|
# 获取混合变形目标数量
|
||||||
@ -34,13 +29,13 @@ def sg_save_blend_shape():
|
|||||||
|
|
||||||
if count:
|
if count:
|
||||||
# 设置进度条
|
# 设置进度条
|
||||||
cmds.SGProgressBar(max=count)
|
mfc.ProgressBar(max=count)
|
||||||
cmds.SGProgressBar(t=f"[{blend_shape}] Save Target Mesh...")
|
mfc.ProgressBar(t=f"[{blend_shape}] Save Target Mesh...")
|
||||||
|
|
||||||
# 处理每个混合变形目标
|
# 处理每个混合变形目标
|
||||||
for index in range(count):
|
for index in range(count):
|
||||||
# 更新进度条
|
# 更新进度条
|
||||||
cmds.SGProgressBar(apr=1)
|
mfc.ProgressBar(apr=1)
|
||||||
|
|
||||||
# 重新生成目标并保存
|
# 重新生成目标并保存
|
||||||
bs_name = cmds.sculptTarget(
|
bs_name = cmds.sculptTarget(
|
||||||
@ -50,13 +45,13 @@ def sg_save_blend_shape():
|
|||||||
target=index
|
target=index
|
||||||
)
|
)
|
||||||
|
|
||||||
cmds.SGSaveBlendShapes(bs=mesh_index, i=index, value=bs_name[0])
|
mfc.SaveBlendShapes(bs=mesh_index, i=index, value=bs_name[0])
|
||||||
|
|
||||||
# 删除临时目标
|
# 删除临时目标
|
||||||
cmds.delete(bs_name)
|
cmds.delete(bs_name)
|
||||||
|
|
||||||
# 结束进度条
|
# 结束进度条
|
||||||
cmds.SGProgressBar(ep=True)
|
mfc.ProgressBar(ep=True)
|
||||||
|
|
||||||
# 如果直接运行此脚本
|
# 如果直接运行此脚本
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
@ -1,13 +1,8 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 深圳时光科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2024/06/12
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def sg_save_blend_shape_mappings(reset_mappings):
|
def sg_save_blend_shape_mappings(reset_mappings):
|
||||||
"""
|
"""
|
||||||
@ -16,25 +11,25 @@ def sg_save_blend_shape_mappings(reset_mappings):
|
|||||||
reset_mappings (int): 是否重置映射
|
reset_mappings (int): 是否重置映射
|
||||||
"""
|
"""
|
||||||
# 初始化进度条
|
# 初始化进度条
|
||||||
cmds.SGProgressBar(sp=True)
|
mfc.ProgressBar(sp=True)
|
||||||
|
|
||||||
# 初始化映射索引
|
# 初始化映射索引
|
||||||
mapping = 0
|
mapping = 0
|
||||||
|
|
||||||
# 获取所有混合变形目标名称
|
# 获取所有混合变形目标名称
|
||||||
blend_shape_names = cmds.SGGetBlendShapes()
|
blend_shape_names = mfc.GetBlendShapes()
|
||||||
|
|
||||||
# 设置进度条
|
# 设置进度条
|
||||||
cmds.SGProgressBar(max=len(blend_shape_names))
|
mfc.ProgressBar(max=len(blend_shape_names))
|
||||||
cmds.SGProgressBar(t="Update BlendShape Mappings...")
|
mfc.ProgressBar(t="Update BlendShape Mappings...")
|
||||||
cmds.SGProgressBar(pr=0)
|
mfc.ProgressBar(pr=0)
|
||||||
|
|
||||||
# 获取所有存在的混合变形器和对应的网格索引
|
# 获取所有存在的混合变形器和对应的网格索引
|
||||||
blend_shapes = []
|
blend_shapes = []
|
||||||
mesh_indices = []
|
mesh_indices = []
|
||||||
|
|
||||||
for mesh_index in range(50):
|
for mesh_index in range(50):
|
||||||
blend_shape = f"{cmds.SGGetMeshes(i=mesh_index)}_blendShapes"
|
blend_shape = f"{mfc.GetMeshes(i=mesh_index)}_blendShapes"
|
||||||
if cmds.objExists(blend_shape):
|
if cmds.objExists(blend_shape):
|
||||||
blend_shapes.append(blend_shape)
|
blend_shapes.append(blend_shape)
|
||||||
mesh_indices.append(mesh_index)
|
mesh_indices.append(mesh_index)
|
||||||
@ -42,7 +37,7 @@ def sg_save_blend_shape_mappings(reset_mappings):
|
|||||||
# 处理每个混合变形目标名称
|
# 处理每个混合变形目标名称
|
||||||
for blend_shape_name in blend_shape_names:
|
for blend_shape_name in blend_shape_names:
|
||||||
# 更新进度条
|
# 更新进度条
|
||||||
cmds.SGProgressBar(apr=1)
|
mfc.ProgressBar(apr=1)
|
||||||
|
|
||||||
# 检查每个混合变形器
|
# 检查每个混合变形器
|
||||||
for i, blend_shape in enumerate(blend_shapes):
|
for i, blend_shape in enumerate(blend_shapes):
|
||||||
@ -52,7 +47,7 @@ def sg_save_blend_shape_mappings(reset_mappings):
|
|||||||
# 如果找到匹配的目标名称
|
# 如果找到匹配的目标名称
|
||||||
if bs_node and blend_shape_name in bs_node:
|
if bs_node and blend_shape_name in bs_node:
|
||||||
# 保存映射关系
|
# 保存映射关系
|
||||||
cmds.SGSaveBlendShapes(
|
mfc.SaveBlendShapes(
|
||||||
rm=reset_mappings,
|
rm=reset_mappings,
|
||||||
ma=mapping,
|
ma=mapping,
|
||||||
m=mesh_indices[i],
|
m=mesh_indices[i],
|
||||||
@ -61,7 +56,7 @@ def sg_save_blend_shape_mappings(reset_mappings):
|
|||||||
mapping += 1
|
mapping += 1
|
||||||
|
|
||||||
# 结束进度条
|
# 结束进度条
|
||||||
cmds.SGProgressBar(ep=True)
|
mfc.ProgressBar(ep=True)
|
||||||
|
|
||||||
# 如果直接运行此脚本
|
# 如果直接运行此脚本
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
@ -1,33 +1,28 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 深圳时光科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
import MetaFusionCore as mfc
|
||||||
|
|
||||||
def sg_set_body_neutral_joint_translation():
|
def sg_set_body_neutral_joint_translation():
|
||||||
"""
|
"""
|
||||||
设置身体模型的关节中性位置
|
设置身体模型的关节中性位置
|
||||||
"""
|
"""
|
||||||
# 获取身体模型
|
# 获取身体模型
|
||||||
body_mesh = cmds.SGGetMeshes(m=50)
|
body_mesh = mfc.GetMeshes(m=50)
|
||||||
|
|
||||||
# 如果身体模型不存在,直接返回
|
# 如果身体模型不存在,直接返回
|
||||||
if not cmds.objExists(body_mesh):
|
if not cmds.objExists(body_mesh):
|
||||||
return
|
return
|
||||||
|
|
||||||
# 执行身体关节定位
|
# 执行身体关节定位
|
||||||
cmds.SGBodyJointsLocator()
|
mfc.BodyJointsLocator()
|
||||||
|
|
||||||
# 执行主要轴向修正
|
# 执行主要轴向修正
|
||||||
cmds.SGMainAmendAxis()
|
mfc.MainAmendAxis()
|
||||||
|
|
||||||
# 执行蒙皮轴向修正
|
# 执行蒙皮轴向修正
|
||||||
cmds.SGSkinAmendAxis()
|
mfc.SkinAmendAxis()
|
||||||
|
|
||||||
# 如果直接运行此脚本
|
# 如果直接运行此脚本
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
@ -1,12 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 深圳时光科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2024/03/01
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
|
||||||
def sg_set_color(object_name, rgb, r, g, b, index, enabled):
|
def sg_set_color(object_name, rgb, r, g, b, index, enabled):
|
@ -1,12 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 深圳时光科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
|
||||||
def sg_set_head_neutral_joint_translation():
|
def sg_set_head_neutral_joint_translation():
|
||||||
@ -14,18 +8,18 @@ def sg_set_head_neutral_joint_translation():
|
|||||||
设置头部模型的关节中性位置
|
设置头部模型的关节中性位置
|
||||||
"""
|
"""
|
||||||
# 获取所需的网格模型
|
# 获取所需的网格模型
|
||||||
head_mesh = cmds.SGGetMeshes(m=0)
|
head_mesh = cmds.GetMeshes(m=0)
|
||||||
teeth_mesh = cmds.SGGetMeshes(m=1)
|
teeth_mesh = cmds.GetMeshes(m=1)
|
||||||
eye_left_mesh = cmds.SGGetMeshes(m=3)
|
eye_left_mesh = cmds.GetMeshes(m=3)
|
||||||
eye_right_mesh = cmds.SGGetMeshes(m=4)
|
eye_right_mesh = cmds.GetMeshes(m=4)
|
||||||
|
|
||||||
# 检查必要的模型是否都存在
|
# 检查必要的模型是否都存在
|
||||||
if not all(cmds.objExists(mesh) for mesh in [head_mesh, teeth_mesh, eye_left_mesh, eye_right_mesh]):
|
if not all(cmds.objExists(mesh) for mesh in [head_mesh, teeth_mesh, eye_left_mesh, eye_right_mesh]):
|
||||||
return
|
return
|
||||||
|
|
||||||
# 获取关节信息
|
# 获取关节信息
|
||||||
json_file = cmds.SGDescriptor(ti="jointsInfo")
|
json_file = cmds.Descriptor(ti="jointsInfo")
|
||||||
object_list = cmds.SGReadJson(f=json_file, k="head", t="object")
|
object_list = cmds.ReadJson(f=json_file, k="head", t="object")
|
||||||
|
|
||||||
namespace = "DHIhead:"
|
namespace = "DHIhead:"
|
||||||
|
|
||||||
@ -34,7 +28,7 @@ def sg_set_head_neutral_joint_translation():
|
|||||||
count = len(object_list)
|
count = len(object_list)
|
||||||
|
|
||||||
# 初始化进度条
|
# 初始化进度条
|
||||||
cmds.SGProgressBar(sp=True)
|
cmds.ProgressBar(sp=True)
|
||||||
|
|
||||||
# 创建临时定位器
|
# 创建临时定位器
|
||||||
locator = "MetaHumanLocatorTemp"
|
locator = "MetaHumanLocatorTemp"
|
||||||
@ -42,11 +36,11 @@ def sg_set_head_neutral_joint_translation():
|
|||||||
cmds.spaceLocator(n=locator)
|
cmds.spaceLocator(n=locator)
|
||||||
|
|
||||||
# 设置进度条
|
# 设置进度条
|
||||||
cmds.SGProgressBar(max=count)
|
cmds.ProgressBar(max=count)
|
||||||
cmds.SGProgressBar(t="Set Head Joint Translation...")
|
cmds.ProgressBar(t="Set Head Joint Translation...")
|
||||||
|
|
||||||
# 获取中性关节位置
|
# 获取中性关节位置
|
||||||
pos = cmds.SGGetNeutralJointTranslations(h=True)
|
pos = cmds.GetNeutralJointTranslations(h=True)
|
||||||
|
|
||||||
# 检查数据一致性
|
# 检查数据一致性
|
||||||
if count != len(pos) // 3:
|
if count != len(pos) // 3:
|
||||||
@ -55,16 +49,16 @@ def sg_set_head_neutral_joint_translation():
|
|||||||
# 处理每个关节
|
# 处理每个关节
|
||||||
for i in range(count):
|
for i in range(count):
|
||||||
# 更新进度条
|
# 更新进度条
|
||||||
cmds.SGProgressBar(apr=1)
|
cmds.ProgressBar(apr=1)
|
||||||
|
|
||||||
# 获取关节信息
|
# 获取关节信息
|
||||||
joints = cmds.SGReadJson(d=object_list[i], k="joint", t="string")
|
joints = cmds.ReadJson(d=object_list[i], k="joint", t="string")
|
||||||
|
|
||||||
# 处理命名空间
|
# 处理命名空间
|
||||||
joint = f"{namespace}{joints[0]}" if cmds.namespace(exists=namespace) else joints[0]
|
joint = f"{namespace}{joints[0]}" if cmds.namespace(exists=namespace) else joints[0]
|
||||||
|
|
||||||
# 检查是否需要定位
|
# 检查是否需要定位
|
||||||
enable = cmds.SGReadJson(d=object_list[i], k="locate", t="bool")[0]
|
enable = cmds.ReadJson(d=object_list[i], k="locate", t="bool")[0]
|
||||||
|
|
||||||
if enable:
|
if enable:
|
||||||
# 设置定位器位置
|
# 设置定位器位置
|
||||||
@ -79,8 +73,8 @@ def sg_set_head_neutral_joint_translation():
|
|||||||
|
|
||||||
# 清理和刷新
|
# 清理和刷新
|
||||||
cmds.delete(locator)
|
cmds.delete(locator)
|
||||||
cmds.SGRefreshNeutralJointTranslation()
|
cmds.RefreshNeutralJointTranslation()
|
||||||
cmds.SGProgressBar(ep=True)
|
cmds.ProgressBar(ep=True)
|
||||||
cmds.refresh()
|
cmds.refresh()
|
||||||
|
|
||||||
# 如果直接运行此脚本
|
# 如果直接运行此脚本
|
@ -1,12 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 深圳时光科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2024/03/20
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
|
||||||
def sg_standardized_naming():
|
def sg_standardized_naming():
|
||||||
@ -15,18 +9,18 @@ def sg_standardized_naming():
|
|||||||
将所有网格重命名为标准名称
|
将所有网格重命名为标准名称
|
||||||
"""
|
"""
|
||||||
# 获取所有标准网格名称
|
# 获取所有标准网格名称
|
||||||
meshes = cmds.SGGetMeshes()
|
meshes = cmds.GetMeshes()
|
||||||
|
|
||||||
# 遍历每个网格索引
|
# 遍历每个网格索引
|
||||||
for i in range(len(meshes)):
|
for i in range(len(meshes)):
|
||||||
# 获取当前网格
|
# 获取当前网格
|
||||||
mesh = cmds.SGGetMeshes(m=i)
|
mesh = cmds.GetMeshes(m=i)
|
||||||
|
|
||||||
# 如果网格存在,进行重命名
|
# 如果网格存在,进行重命名
|
||||||
if cmds.objExists(mesh):
|
if cmds.objExists(mesh):
|
||||||
# 重命名网格并更新引用
|
# 重命名网格并更新引用
|
||||||
new_name = cmds.rename(mesh, meshes[i])
|
new_name = cmds.rename(mesh, meshes[i])
|
||||||
cmds.SGSetMeshes(m=i, value=new_name)
|
cmds.SetMeshes(m=i, value=new_name)
|
||||||
|
|
||||||
# 如果直接运行此脚本
|
# 如果直接运行此脚本
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
@ -1,12 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 深圳时光科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2024/04/01
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
|
||||||
def sg_supplement_meshes():
|
def sg_supplement_meshes():
|
||||||
@ -16,25 +10,25 @@ def sg_supplement_meshes():
|
|||||||
# 遍历8个LOD级别
|
# 遍历8个LOD级别
|
||||||
for i in range(8):
|
for i in range(8):
|
||||||
# 获取当前LOD级别的网格列表
|
# 获取当前LOD级别的网格列表
|
||||||
lod_list = cmds.SGGetMeshes(lod=i)
|
lod_list = cmds.GetMeshes(lod=i)
|
||||||
head = cmds.SGGetMeshes(m=lod_list[0])
|
head = cmds.GetMeshes(m=lod_list[0])
|
||||||
deformed = cmds.SGGetMeshes(m=0)
|
deformed = cmds.GetMeshes(m=0)
|
||||||
|
|
||||||
if cmds.objExists(head):
|
if cmds.objExists(head):
|
||||||
# 准备源模型
|
# 准备源模型
|
||||||
source = cmds.SGGetMeshes(cm=0)
|
source = cmds.GetMeshes(cm=0)
|
||||||
source_buffer = f"{source}_buffer"
|
source_buffer = f"{source}_buffer"
|
||||||
source_buffer = source_buffer[1:] # 移除第一个字符
|
source_buffer = source_buffer[1:] # 移除第一个字符
|
||||||
source_buffer = cmds.rename(source, source_buffer)
|
source_buffer = cmds.rename(source, source_buffer)
|
||||||
|
|
||||||
# 设置进度条标题
|
# 设置进度条标题
|
||||||
title = f"[LOD{i}] Please be patient and wait..."
|
title = f"[LOD{i}] Please be patient and wait..."
|
||||||
if cmds.SGDescriptor(l=True) == "ZH":
|
if cmds.Descriptor(l=True) == "ZH":
|
||||||
title = f"[LOD{i}] 请耐心等待..."
|
title = f"[LOD{i}] 请耐心等待..."
|
||||||
|
|
||||||
# 初始化进度条
|
# 初始化进度条
|
||||||
cmds.SGProgressBar(sp=True)
|
cmds.ProgressBar(sp=True)
|
||||||
cmds.SGProgressBar(t=title)
|
cmds.ProgressBar(t=title)
|
||||||
|
|
||||||
# 初始化网格列表
|
# 初始化网格列表
|
||||||
eye_mesh = []
|
eye_mesh = []
|
||||||
@ -42,16 +36,16 @@ def sg_supplement_meshes():
|
|||||||
mouth_mesh = []
|
mouth_mesh = []
|
||||||
|
|
||||||
# 读取顶点信息
|
# 读取顶点信息
|
||||||
json_file = cmds.SGDescriptor(ti="vertexsInfo")
|
json_file = cmds.Descriptor(ti="vertexsInfo")
|
||||||
eye_indices = cmds.SGReadJson(f=json_file, k="headEye", t="int")
|
eye_indices = cmds.ReadJson(f=json_file, k="headEye", t="int")
|
||||||
mouth_indices = cmds.SGReadJson(f=json_file, k="headMouth", t="int")
|
mouth_indices = cmds.ReadJson(f=json_file, k="headMouth", t="int")
|
||||||
|
|
||||||
# 处理每个网格
|
# 处理每个网格
|
||||||
for j in range(1, len(lod_list)):
|
for j in range(1, len(lod_list)):
|
||||||
if lod_list[j] < 50:
|
if lod_list[j] < 50:
|
||||||
mesh = cmds.SGGetMeshes(m=lod_list[j])
|
mesh = cmds.GetMeshes(m=lod_list[j])
|
||||||
if not cmds.objExists(mesh):
|
if not cmds.objExists(mesh):
|
||||||
new_mesh = cmds.SGGetMeshes(cm=lod_list[j])
|
new_mesh = cmds.GetMeshes(cm=lod_list[j])
|
||||||
if cmds.objExists(new_mesh):
|
if cmds.objExists(new_mesh):
|
||||||
# 根据名称分类网格
|
# 根据名称分类网格
|
||||||
if any(x in new_mesh for x in ["eyeshell", "eyelashes", "eyeEdge", "cartilage"]):
|
if any(x in new_mesh for x in ["eyeshell", "eyelashes", "eyeEdge", "cartilage"]):
|
||||||
@ -62,12 +56,12 @@ def sg_supplement_meshes():
|
|||||||
mouth_mesh.append(new_mesh)
|
mouth_mesh.append(new_mesh)
|
||||||
|
|
||||||
# 设置进度条
|
# 设置进度条
|
||||||
cmds.SGProgressBar(max=3)
|
cmds.ProgressBar(max=3)
|
||||||
|
|
||||||
# 应用RBF变形器
|
# 应用RBF变形器
|
||||||
cmds.SGProgressBar(apr=1)
|
cmds.ProgressBar(apr=1)
|
||||||
if eye_mesh:
|
if eye_mesh:
|
||||||
cmds.SGRBFDeformer(
|
cmds.RBFDeformer(
|
||||||
r=0.01,
|
r=0.01,
|
||||||
rbf=1,
|
rbf=1,
|
||||||
m=[source_buffer, deformed],
|
m=[source_buffer, deformed],
|
||||||
@ -75,9 +69,9 @@ def sg_supplement_meshes():
|
|||||||
t=eye_mesh
|
t=eye_mesh
|
||||||
)
|
)
|
||||||
|
|
||||||
cmds.SGProgressBar(apr=1)
|
cmds.ProgressBar(apr=1)
|
||||||
if eye:
|
if eye:
|
||||||
cmds.SGRBFDeformer(
|
cmds.RBFDeformer(
|
||||||
r=0.01,
|
r=0.01,
|
||||||
rbf=1,
|
rbf=1,
|
||||||
d="off",
|
d="off",
|
||||||
@ -86,9 +80,9 @@ def sg_supplement_meshes():
|
|||||||
t=eye
|
t=eye
|
||||||
)
|
)
|
||||||
|
|
||||||
cmds.SGProgressBar(apr=1)
|
cmds.ProgressBar(apr=1)
|
||||||
if mouth_mesh:
|
if mouth_mesh:
|
||||||
cmds.SGRBFDeformer(
|
cmds.RBFDeformer(
|
||||||
r=0.01,
|
r=0.01,
|
||||||
rbf=1,
|
rbf=1,
|
||||||
d="off",
|
d="off",
|
||||||
@ -99,7 +93,7 @@ def sg_supplement_meshes():
|
|||||||
|
|
||||||
# 清理和结束
|
# 清理和结束
|
||||||
cmds.delete(source_buffer)
|
cmds.delete(source_buffer)
|
||||||
cmds.SGProgressBar(ep=True)
|
cmds.ProgressBar(ep=True)
|
||||||
|
|
||||||
# 如果直接运行此脚本
|
# 如果直接运行此脚本
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
@ -1,12 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 深圳时光科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
|
||||||
def sg_transfer_maps():
|
def sg_transfer_maps():
|
||||||
@ -16,20 +10,20 @@ def sg_transfer_maps():
|
|||||||
# 处理头部相关网格的LOD级别
|
# 处理头部相关网格的LOD级别
|
||||||
for i in range(1, 8):
|
for i in range(1, 8):
|
||||||
# 获取当前LOD级别的网格索引列表
|
# 获取当前LOD级别的网格索引列表
|
||||||
mesh_indices = cmds.SGGetMeshes(lod=i)
|
mesh_indices = cmds.GetMeshes(lod=i)
|
||||||
|
|
||||||
# 处理前9个网格
|
# 处理前9个网格
|
||||||
for j in range(9):
|
for j in range(9):
|
||||||
mesh = cmds.SGGetMeshes(m=j)
|
mesh = cmds.GetMeshes(m=j)
|
||||||
if cmds.objExists(mesh):
|
if cmds.objExists(mesh):
|
||||||
# 获取网格类型前缀
|
# 获取网格类型前缀
|
||||||
mesh_type = mesh.split('_')[0]
|
mesh_type = mesh.split('_')[0]
|
||||||
|
|
||||||
# 查找相同类型的LOD网格
|
# 查找相同类型的LOD网格
|
||||||
for m in mesh_indices:
|
for m in mesh_indices:
|
||||||
lod_mesh = cmds.SGGetMeshes(i=m)
|
lod_mesh = cmds.GetMeshes(i=m)
|
||||||
if lod_mesh.startswith(mesh_type):
|
if lod_mesh.startswith(mesh_type):
|
||||||
lod = cmds.SGGetMeshes(m=m)
|
lod = cmds.GetMeshes(m=m)
|
||||||
# 传递材质
|
# 传递材质
|
||||||
cmds.transferShadingSets(
|
cmds.transferShadingSets(
|
||||||
mesh,
|
mesh,
|
||||||
@ -39,12 +33,12 @@ def sg_transfer_maps():
|
|||||||
)
|
)
|
||||||
|
|
||||||
# 处理身体网格的LOD级别
|
# 处理身体网格的LOD级别
|
||||||
body = cmds.SGGetMeshes(m=50)
|
body = cmds.GetMeshes(m=50)
|
||||||
if cmds.objExists(body):
|
if cmds.objExists(body):
|
||||||
# 处理身体的3个LOD级别
|
# 处理身体的3个LOD级别
|
||||||
for i in range(1, 4):
|
for i in range(1, 4):
|
||||||
body_index = 50 + i
|
body_index = 50 + i
|
||||||
lod = cmds.SGGetMeshes(m=body_index)
|
lod = cmds.GetMeshes(m=body_index)
|
||||||
# 传递材质
|
# 传递材质
|
||||||
cmds.transferShadingSets(
|
cmds.transferShadingSets(
|
||||||
body,
|
body,
|
@ -1,15 +1,9 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 深圳时光科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2024/04/02
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
|
||||||
def sg_uv_transfer_vertex_order():
|
def uv_transfer_vertex_order():
|
||||||
"""
|
"""
|
||||||
传递UV顶点顺序
|
传递UV顶点顺序
|
||||||
在两个选中的对象之间传递UV顶点顺序
|
在两个选中的对象之间传递UV顶点顺序
|
||||||
@ -23,8 +17,10 @@ def sg_uv_transfer_vertex_order():
|
|||||||
return
|
return
|
||||||
|
|
||||||
# 传递顶点顺序
|
# 传递顶点顺序
|
||||||
cmds.SGSetMeshes(tvo=sel[0], value=sel[1])
|
cmds.SetMeshes(tvo=sel[0], value=sel[1])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# 如果直接运行此脚本
|
# 如果直接运行此脚本
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
sg_uv_transfer_vertex_order()
|
uv_transfer_vertex_order()
|
@ -1,12 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 深圳时光科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2023/08/08
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
import maya.mel as mel
|
import maya.mel as mel
|
||||||
|
|
||||||
@ -18,7 +12,7 @@ def sg_unbind_skin_cluster():
|
|||||||
# 遍历所有网格
|
# 遍历所有网格
|
||||||
for i in range(54):
|
for i in range(54):
|
||||||
# 获取网格
|
# 获取网格
|
||||||
mesh = cmds.SGGetMeshes(m=i)
|
mesh = cmds.GetMeshes(m=i)
|
||||||
|
|
||||||
if cmds.objExists(mesh):
|
if cmds.objExists(mesh):
|
||||||
# 查找关联的蒙皮变形器
|
# 查找关联的蒙皮变形器
|
@ -1,15 +1,9 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
|
||||||
版权所有: 深圳时光科技有限公司
|
|
||||||
联系方式: q.100@qq.com
|
|
||||||
创建日期: 2024/10/28
|
|
||||||
"""
|
|
||||||
|
|
||||||
import maya.cmds as cmds
|
import maya.cmds as cmds
|
||||||
|
|
||||||
def sg_update_ctrl(json_file, index):
|
def update_ctrl(json_file, index):
|
||||||
"""
|
"""
|
||||||
更新控制器的属性到JSON文件
|
更新控制器的属性到JSON文件
|
||||||
Args:
|
Args:
|
||||||
@ -20,7 +14,7 @@ def sg_update_ctrl(json_file, index):
|
|||||||
sel_list = cmds.ls(selection=True)
|
sel_list = cmds.ls(selection=True)
|
||||||
|
|
||||||
# 读取JSON文件中的对象列表
|
# 读取JSON文件中的对象列表
|
||||||
object_list = cmds.SGReadJson(f=json_file, t="object")
|
object_list = cmds.ReadJson(f=json_file, t="object")
|
||||||
|
|
||||||
# 检查JSON对象数量是否足够
|
# 检查JSON对象数量是否足够
|
||||||
if len(object_list) < 61:
|
if len(object_list) < 61:
|
||||||
@ -50,7 +44,7 @@ def sg_update_ctrl(json_file, index):
|
|||||||
|
|
||||||
# 如果值超过阈值,记录到数据中
|
# 如果值超过阈值,记录到数据中
|
||||||
if value > 0.001 or value < -0.001:
|
if value > 0.001 or value < -0.001:
|
||||||
data = cmds.SGWriteJson(
|
data = cmds.WriteJson(
|
||||||
d=data,
|
d=data,
|
||||||
k=attribute,
|
k=attribute,
|
||||||
t="double",
|
t="double",
|
||||||
@ -61,7 +55,7 @@ def sg_update_ctrl(json_file, index):
|
|||||||
object_list[index] = data
|
object_list[index] = data
|
||||||
|
|
||||||
# 将更新后的数据写回JSON文件
|
# 将更新后的数据写回JSON文件
|
||||||
cmds.SGWriteJson(
|
cmds.WriteJson(
|
||||||
of=json_file,
|
of=json_file,
|
||||||
sf=json_file,
|
sf=json_file,
|
||||||
t="object",
|
t="object",
|
Loading…
Reference in New Issue
Block a user