自动检查部分(顶点色、2U、ID、坐标轴)的测试
1 global CPVobj = #()
2 global UV2obj = #()
3 global CPVobj1 = #()
4 global UV2obj1 = #()
5 global PTobj = #()
6 global IDobj = #()
7 global PTobj1 = #()
8 global IDobj1 = #()
9 --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
10 fn checkpoly = --**定义检查是否为poly物体的函数,对skin物体还是有bug**
11 (
12 sel = getCurrentSelection()
13 ------------------------------------
14 for a=1 to sel.count do
15 (
16 if sel[a].modifiers[#skin] != undefined and classof sel[a].baseobject != editable_poly then
17 --判断是否有加了skin修改器,原始层次是否为poly
18 (
19 pasteS = copy sel[a].modifiers[#skin]
20 --定义一个变量,复制skin修改器
21 skinOps.SaveEnvelope sel[a].modifiers[#Skin]
22 --保存skin文件
23 ConvertToPoly sel[a]
24 --转为poly
25 --粘贴上之前复制的skin修改器
26 skinOps.LoadEnvelope sel[a].modifiers[#Skin]
27 --加载skin文件
28 )
29 )
30 --------------------------
31 for a=1 to sel.count do
32 (
33 if sel[a].modifiers[#skin] != undefined and classof sel[a].baseobject == editable_poly then print sel[a].name
34 )
35 ------------------------------
36 for a=1 to sel.count do
37 (
38 if sel[a].modifiers[#skin] == undefined and classof sel[a].baseobject == editable_poly then print sel[a].name
39 )
40 --------------------------------
41 for a=1 to sel.count do
42 (
43 if sel[a].modifiers[#skin] == undefined and classof sel[a].baseobject != editable_poly then ConvertToPoly sel[a]
44 )
45 )
46 -----------------------------------------------------
47 fn getCPVobj = --定义函数,收集有顶点色的物体
48 (
49 sel = getCurrentSelection()
50 for a=1 to sel.count do
51 (
52 if sel[a].modifiers[#skin] != undefined and classof sel[a].baseobject != editable_poly then
53 (
54 --if getnumCPVverts sel[a] != 0 then append CPVobj sel[a].name
55 --**getnumVPCverts只能针对mesh类操作**
56 --if getnumCPVverts sel[a] != 0 then append CPVobj1 sel[a]
57 if sel[a].GetMapChannelActive 0 == true then append CPVobj sel[a].name
58
59 --**$.GetMapChannelActive 0 == true 判断通道信息里的0通道是否为真,真表示存在顶点色**
60 if sel[a].GetMapChannelActive 0 == true then append CPVobj1 sel[a]
61 print CPVobj
62 )
63 )
64 for a=1 to sel.count do
65 (
66 if sel[a].modifiers[#skin] != undefined and classof sel[a].baseobject == editable_poly then
67 (
68 if sel[a].GetMapChannelActive 0 == true then append CPVobj sel[a].name
69 if sel[a].GetMapChannelActive 0 == true then append CPVobj1 sel[a]
70 print CPVobj
71 )
72 )
73 for a=1 to sel.count do
74 (
75 if sel[a].modifiers[#skin] == undefined and classof sel[a].baseobject == editable_poly then
76 (
77 if sel[a].GetMapChannelActive 0 == true then append CPVobj sel[a].name
78 if sel[a].GetMapChannelActive 0 == true then append CPVobj1 sel[a]
79 print CPVobj
80 )
81
82 )
83 for a=1 to sel.count do
84 (
85 if sel[a].modifiers[#skin] == undefined and classof sel[a].baseobject != editable_poly then
86 (
87 if sel[a].GetMapChannelActive 0 == true then append CPVobj sel[a].name
88 if sel[a].GetMapChannelActive 0 == true then append CPVobj1 sel[a]
89 print CPVobj
90 )
91
92 )
93 )
94
95 --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
96 fn getUV2obj = --定义函数,收集有2U的物体
97 (
98 sel = getCurrentSelection()
99 for a=1 to sel.count do
100 (
101 if sel[a].modifiers[#skin] != undefined and classof sel[a].baseobject != editable_poly then
102 (
103 if meshop.GetMapSupport sel[a] 2 == true then append UV2obj sel[a].name
104 --**GetMapSupport可以有meshop和polyop两种,分别针对mesh物体和poly物体**
105 if meshop.GetMapSupport sel[a] 2 == true then append UV2obj1 sel[a]
106 print UV2obj
107 )
108 )
109 for a=1 to sel.count do
110 (
111 if sel[a].modifiers[#skin] != undefined and classof sel[a].baseobject == editable_poly then
112 (
113 if polyop.GetMapSupport sel[a] 2 == true then append UV2obj sel[a].name
114 if polyop.GetMapSupport sel[a] 2 == true then append UV2obj1 sel[a]
115 print UV2obj
116 )
117 )
118 for a=1 to sel.count do
119 (
120 if sel[a].modifiers[#skin] == undefined and classof sel[a].baseobject != editable_poly then
121 (
122 if meshop.GetMapSupport sel[a] 2 == true then append UV2obj sel[a].name
123 if meshop.GetMapSupport sel[a] 2 == true then append UV2obj1 sel[a]
124 print UV2obj
125 )
126 )
127 for a=1 to sel.count do
128 (
129 if sel[a].modifiers[#skin] == undefined and classof sel[a].baseobject == editable_poly then
130 (
131 if polyop.GetMapSupport sel[a] 2 == true then append UV2obj sel[a].name
132 if polyop.GetMapSupport sel[a] 2 == true then append UV2obj1 sel[a]
133 print UV2obj
134 )
135 )
136 )
137 --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
138 fn getPTobj = --定义函数,收集物体坐标为归零的物体
139 (
140 sel = getCurrentSelection()
141 for a=1 to sel.count do
142 (
143 if sel[a].pivot != [0,0,0] then append PTobj sel[a].name
144 if sel[a].pivot != [0,0,0] then append PTobj1 sel[a]
145 print PTobj
146 )
147 )
148 --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
149 fn getIDobj = --定义函数,收集ID不为一的物体
150 (
151 sel = getCurrentSelection()
152
153 for a=1 to sel.count do
154 (
155 if sel[a].modifiers[#skin] != undefined and classof sel[a].baseobject != editable_poly then
156 (
157 Faceid = getFaceMatID sel[a] 1
158 --**mesh物体直接用 getFaceMatID $ 1;poly物体用polyop.getFaceMatID $ 1**
159 if Faceid != 1 then append IDobj sel[a].name
160 if Faceid != 1 then append IDobj1 sel[a]
161 print IDobj
162 )
163 )
164
165 for a=1 to sel.count do
166 (
167 if sel[a].modifiers[#skin] != undefined and classof sel[a].baseobject == editable_poly then
168 (
169 Faceid = polyop.getFaceMatID sel[a] 1
170 if Faceid != 1 then append IDobj sel[a].name
171 if Faceid != 1 then append IDobj1 sel[a]
172 print IDobj
173 )
174 )
175 for a=1 to sel.count do
176 (
177 if sel[a].modifiers[#skin] == undefined and classof sel[a].baseobject == editable_poly then
178 (
179 Faceid = polyop.getFaceMatID sel[a] 1
180 if Faceid != 1 then append IDobj sel[a].name
181 if Faceid != 1 then append IDobj1 sel[a]
182 print IDobj
183 )
184 )
185 for a=1 to sel.count do
186 (
187 if sel[a].modifiers[#skin] == undefined and classof sel[a].baseobject != editable_poly then
188 (
189 Faceid = getFaceMatID sel[a] 1
190 if Faceid != 1 then append IDobj sel[a].name
191 if Faceid != 1 then append IDobj1 sel[a]
192 print IDobj
193 )
194 )
195 )
196 fn checkSel = --定义一个函数,检查是否选择了物体
197 (
198 sel = getCurrentSelection()
199 sel1 = #()
200 if sel.count == 0 then messagebox "请先选择要操作的物体!"
201 for i in sel do
202 (
203 if classof i == editable_poly do join sel1 i
204 )
205 return sel1
206 )
207
208 --=======================================================
209 --checkpoly()
210 getCPVobj()
211 getUV2obj()
212 getPTobj()
213 getIDobj()
214 print CPVobj
215 print UV2obj
216 print CPVobj1
217 print UV2obj1
218 print PTobj
219 print IDobj
220 print PTobj1
221 print IDobj1