-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_fun.py
More file actions
55 lines (55 loc) · 2.32 KB
/
Copy pathcheck_fun.py
File metadata and controls
55 lines (55 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/python
# -*- coding: utf-8 -*-
import unicodedata
import re
import maya.cmds as cmds
def duplicated_transform_nodes_check():
d_list=[]
tr_nodes = cmds.ls( tr=True)
filter(None, tr_nodes) #remove NoneType
maj_set = set(tr_nodes)
duplicates = [f for f in maj_set if '|' in f]
duplicates.sort(key=lambda obj:obj.count('|'), reverse = True)
if duplicates:
for name in duplicates:
# extract the base name
m = re.compile("[^|]*$").search(name)
short_name=m.group(0)
d_list.append(short_name)
d_set = set(d_list)
warning=""
for d_name in d_set:
warning += str(d_list.count(d_name))+u'个叫' + d_name + u'在场景中'+"\n"+"\n"
#warning += str(d_list.count(d_name))+" objects named "+d_name +"in the scene!"+"\n"
if warning:
cmds.confirmDialog( title=u'重名检查', message=warning, button = u"确认")
else:
cmds.confirmDialog( title=u'重名检查', message="Scene is cleaned", button = u"确认")
def init_blendshape_check():
bs_nodes = cmds.ls(type = "blendShape")
warning=""
for bs in bs_nodes:
bs_names = cmds.listAttr(bs, multi=1, string = "weight")
for bs_name in bs_names:
bs_weight = bs+"."+bs_name
if cmds.getAttr(bs_weight):
warning += bs_weight + u"为非零值"+"\n"
#cmds.setKeyframe(bs+"."+bs_name, t=0)
if warning:
cmds.confirmDialog( title=u'blendshapeCheck', message=warning, button = u"确认")
else:
cmds.confirmDialog( title=u'blendshapeCheck', message=u"所有blendshape初始值为0", button = u"确认")
def bindpose_check():
#!/usr/bin/python
# -*- coding: utf-8 -*-
import unicodedata
import maya.cmds as cmds
def bindpose_check():
warning=""
bindpose_nodes = cmds.ls(type = "dagPose")
if (len(bindpose_nodes) > 1) :
cmds.confirmDialog( title=u'blendshapeCheck', message=u"有多个bindpose,请检检查bindpose是否正确!", button = u"确认")
if (len(bindpose_nodes) == 1) :
cmds.confirmDialog( title=u'blendshapeCheck', message=u"有1个bindpose,请使用goToBindPose命令检查初始姿势!", button = u"确认")
else:
cmds.confirmDialog( title=u'blendshapeCheck', message="场景中没有蒙皮信息", button = u"确认")