simplex-solver 3.0.18__37-abi3-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. pysimplex.pyd +0 -0
  2. simplex_solver-3.0.18.dist-info/METADATA +87 -0
  3. simplex_solver-3.0.18.dist-info/RECORD +81 -0
  4. simplex_solver-3.0.18.dist-info/WHEEL +5 -0
  5. simplex_solver-3.0.18.dist-info/licenses/LICENSE +165 -0
  6. simplexui/__init__.py +54 -0
  7. simplexui/channelBox.py +862 -0
  8. simplexui/comboCheckDialog.py +335 -0
  9. simplexui/commands/__init__.py +16 -0
  10. simplexui/commands/alembicCommon.py +1045 -0
  11. simplexui/commands/applyCorrectives.py +455 -0
  12. simplexui/commands/buildIceXML.py +443 -0
  13. simplexui/commands/correctiveInterface.py +271 -0
  14. simplexui/commands/expandedExport.py +435 -0
  15. simplexui/commands/hdf5Convert.py +62 -0
  16. simplexui/commands/mayaCorrectiveInterface.py +164 -0
  17. simplexui/commands/mesh.py +1086 -0
  18. simplexui/commands/reorderSimplexPoints.py +103 -0
  19. simplexui/commands/rigidAlign.py +103 -0
  20. simplexui/commands/setDelta.xsicompound +60 -0
  21. simplexui/commands/smpxBlend.py +634 -0
  22. simplexui/commands/unsubdivide.py +1232 -0
  23. simplexui/commands/uvTransfer.py +986 -0
  24. simplexui/commands/xsiCorrectiveInterface.py +136 -0
  25. simplexui/dragFilter.py +299 -0
  26. simplexui/falloffDialog.py +476 -0
  27. simplexui/img/ChefHead.png +0 -0
  28. simplexui/img/frozen.png +0 -0
  29. simplexui/interface/__init__.py +30 -0
  30. simplexui/interface/dummyInterface.py +1564 -0
  31. simplexui/interface/mayaInterface.py +3197 -0
  32. simplexui/interface/xsiInterface.py +2944 -0
  33. simplexui/interfaceModel.py +1040 -0
  34. simplexui/interfaceModelTrees.py +439 -0
  35. simplexui/interfaceModel_Test.py +259 -0
  36. simplexui/items/__init__.py +26 -0
  37. simplexui/items/accessor.py +217 -0
  38. simplexui/items/combo.py +855 -0
  39. simplexui/items/falloff.py +780 -0
  40. simplexui/items/group.py +295 -0
  41. simplexui/items/progression.py +745 -0
  42. simplexui/items/shape.py +444 -0
  43. simplexui/items/simplex.py +1747 -0
  44. simplexui/items/slider.py +741 -0
  45. simplexui/items/stack.py +156 -0
  46. simplexui/items/traversal.py +969 -0
  47. simplexui/main.pyw +22 -0
  48. simplexui/menu/__init__.py +73 -0
  49. simplexui/menu/dummyPlugins/__init__.py +16 -0
  50. simplexui/menu/genericPlugins/__init__.py +16 -0
  51. simplexui/menu/genericPlugins/_builtins.py +260 -0
  52. simplexui/menu/genericPlugins/checkPossibleCombos.py +47 -0
  53. simplexui/menu/genericPlugins/exportSplit.py +61 -0
  54. simplexui/menu/genericPlugins/showFalloffs.py +24 -0
  55. simplexui/menu/genericPlugins/showTraversals.py +24 -0
  56. simplexui/menu/genericPlugins/simplexUvTransfer.py +109 -0
  57. simplexui/menu/genericPlugins/unsubdivide.py +71 -0
  58. simplexui/menu/mayaPlugins/__init__.py +16 -0
  59. simplexui/menu/mayaPlugins/exportOther.py +45 -0
  60. simplexui/menu/mayaPlugins/extractProgressives.py +67 -0
  61. simplexui/menu/mayaPlugins/freezeCombo.py +251 -0
  62. simplexui/menu/mayaPlugins/generateShapeIncrementals.py +100 -0
  63. simplexui/menu/mayaPlugins/importObjs.py +196 -0
  64. simplexui/menu/mayaPlugins/linearizeTraversal.py +49 -0
  65. simplexui/menu/mayaPlugins/makeShelfBtn.py +69 -0
  66. simplexui/menu/mayaPlugins/relaxToSelection.py +77 -0
  67. simplexui/menu/mayaPlugins/reloadDefinition.py +34 -0
  68. simplexui/menu/mayaPlugins/snapToNeutral.py +74 -0
  69. simplexui/menu/mayaPlugins/softSelectToCluster.py +204 -0
  70. simplexui/menu/mayaPlugins/tweakMix.py +138 -0
  71. simplexui/menu/mayaPlugins/updateRestShape.py +107 -0
  72. simplexui/menu/xsiPlugins/__init__.py +16 -0
  73. simplexui/simplexDialog.py +1391 -0
  74. simplexui/travCheckDialog.py +393 -0
  75. simplexui/traversalDialog.py +277 -0
  76. simplexui/ui/comboCheckDialog.ui +475 -0
  77. simplexui/ui/falloffDialog.ui +243 -0
  78. simplexui/ui/simplexDialog.ui +1458 -0
  79. simplexui/ui/travCheckDialog.ui +488 -0
  80. simplexui/ui/traversalDialog.ui +532 -0
  81. simplexui/utils.py +320 -0
@@ -0,0 +1,1232 @@
1
+ # Copyright 2016, Blur Studio
2
+ #
3
+ # This file is part of Simplex.
4
+ #
5
+ # Simplex is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU Lesser General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+ #
10
+ # Simplex is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public License
16
+ # along with Simplex. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ # pylint: disable=unused-argument, too-many-locals
19
+ # pylint:disable=E0611,E0401
20
+
21
+ from __future__ import absolute_import, print_function
22
+
23
+ import json
24
+ from itertools import chain
25
+
26
+ import six
27
+ from six.moves import map, range, zip, zip_longest
28
+
29
+ from Qt.QtWidgets import QApplication
30
+ from .alembicCommon import buildSmpx, pbPrint, readSmpx
31
+
32
+ try:
33
+ import numpy as np
34
+ except ImportError:
35
+ np = None
36
+
37
+
38
+ def mergeCycles(groups):
39
+ """Take a list of ordered items, and sort them so the last item of each list matches the first of the next list
40
+
41
+ Then return the groups of lists mashed together
42
+ For instance, with two cycles:
43
+ +---------+------------------------------------------------------------+
44
+ | input | [(1, 2), (11, 12), (3, 1), (10, 11), (2, 3), (12, 10)] |
45
+ +---------+------------------------------------------------------------+
46
+ | reorder | [[(1, 2), (2, 3), (3, 1)], [(10, 11), (11, 12), (12, 13)]] |
47
+ +---------+------------------------------------------------------------+
48
+ | output | [[1, 2, 3], [10, 11, 12, 13]] |
49
+ +---------+------------------------------------------------------------+
50
+
51
+ Also, return whether the cycles merged form a single closed group
52
+
53
+ Parameters
54
+ ----------
55
+ groups : [(int, int), ...]
56
+ A list of pairs of integers
57
+
58
+ Returns
59
+ -------
60
+ : [[int, ...], ...]
61
+ The ordered cycles
62
+ """
63
+ groups = [list(g) for g in groups]
64
+ heads = {g[0]: g for g in groups}
65
+ tails = {g[-1]: g for g in groups}
66
+
67
+ headGetter = lambda x: heads.get(x[-1])
68
+ headSetter = lambda x, y: x + y[1:]
69
+
70
+ tailGetter = lambda x: tails.get(x[0])
71
+ tailSetter = lambda x, y: y + x[1:]
72
+
73
+ searches = ((headGetter, headSetter), (tailGetter, tailSetter))
74
+
75
+ out = []
76
+ cycles = []
77
+ while groups:
78
+ g = groups.pop()
79
+ del heads[g[0]]
80
+ del tails[g[-1]]
81
+
82
+ for getter, setter in searches:
83
+ while True:
84
+ adder = getter(g)
85
+ if adder is None:
86
+ break
87
+ g = setter(g, adder)
88
+ del heads[adder[0]]
89
+ del tails[adder[-1]]
90
+ adder[:] = []
91
+ groups = [x for x in groups if x]
92
+
93
+ cycle = False
94
+ if g[0] == g[-1]:
95
+ g.pop()
96
+ cycle = True
97
+ cycles.append(cycle)
98
+ out.append(g)
99
+ return out, cycles
100
+
101
+
102
+ def grow(neigh, verts, exclude):
103
+ """Grow the vertex set, also keeping track of which vertices to ignore for the next iteration
104
+
105
+ Parameters
106
+ ----------
107
+ neigh : {int: [int, ...]}
108
+ A dict mapping a vert index to a list of neighbor vert indices
109
+ verts : set(int)
110
+ A set of vert indices to grow
111
+ exclude : set(int)
112
+ A set of vert indices to ignore
113
+
114
+ Returns
115
+ -------
116
+ : set(int)
117
+ The newly grown vertices
118
+ : set(int)
119
+ ``exclude`` combined with ``verts``
120
+
121
+ """
122
+ grown = set()
123
+ growSet = verts - exclude
124
+ for v in growSet:
125
+ grown.update(neigh[v])
126
+ newGrown = grown - exclude
127
+ newExclude = exclude | growSet
128
+ return newGrown, newExclude
129
+
130
+
131
+ def buildHint(island, neigh, borders):
132
+ """Find star points that are an even number of grows from an edge
133
+
134
+ Parameters
135
+ ----------
136
+ island : [int, ...]
137
+ A list of vertices as part of a mesh island
138
+ neigh : {int: [int, ...]}
139
+ The dictionary of vertex neighbors
140
+ borders : set(int)
141
+ A set of border vertices
142
+
143
+ Returns
144
+ -------
145
+ : int
146
+ The first star point encountered at an even grow from the given borders
147
+ """
148
+ borders = borders & island
149
+ if not borders:
150
+ # Well ... we don't have any good way of dealing with this
151
+ # Best thing I can do is search for a point with the least
152
+ # number of similar valences, and return that
153
+ d = {}
154
+ for v in island:
155
+ d.setdefault(len(neigh[v]), []).append(v)
156
+
157
+ dd = {}
158
+ for k, v in six.iteritems(d):
159
+ dd.setdefault(len(v), []).append(k)
160
+
161
+ mkey = min(dd.keys())
162
+ return d[dd[mkey][0]][0]
163
+
164
+ exclude = set()
165
+ while borders:
166
+ borders, exclude = grow(neigh, borders, exclude)
167
+ borders, exclude = grow(neigh, borders, exclude)
168
+ for b in borders:
169
+ if len(neigh[b]) != 4:
170
+ return b
171
+ return None
172
+
173
+
174
+ def partitionIslands(faces, neigh, pBar=None):
175
+ """Find all groups of connected verts
176
+
177
+ Parameters
178
+ ----------
179
+ faces : [[int, ...], ...]
180
+ The list of lists of vertex indices making up faces
181
+ neigh : {int: [int, ...]}
182
+ The dict of vertex neighbors
183
+ pBar : QProgressDialog or None
184
+ An optional progress bar
185
+
186
+ Returns
187
+ -------
188
+ : [set(int), ...]
189
+ A list of sets of non-connected vertex islands
190
+ """
191
+ allVerts = set(chain.from_iterable(faces))
192
+ islands = []
193
+ count = float(len(allVerts))
194
+
195
+ if pBar is not None:
196
+ pBar.setValue(0)
197
+ pBar.setMaximum(count)
198
+ QApplication.processEvents()
199
+
200
+ while allVerts:
201
+ verts = set([allVerts.pop()])
202
+ exclude = set()
203
+ while verts:
204
+ verts, exclude = grow(neigh, verts, exclude)
205
+ islands.append(exclude)
206
+ allVerts.difference_update(exclude)
207
+
208
+ if pBar is not None:
209
+ pBar.setValue(count - len(allVerts))
210
+ QApplication.processEvents()
211
+
212
+ return islands
213
+
214
+
215
+ def buildUnsubdivideHints(faces, neigh, borders, pBar=None):
216
+ """Get one vertex per island that was part of the original mesh
217
+
218
+ Parameters
219
+ ----------
220
+ faces : [[int, ...], ...]
221
+ The list of lists of vertex indices making up faces
222
+ neigh : {int: [int, ...]}
223
+ The dict of vertex neighbors
224
+ borders : set(int)
225
+ A set of border vertices
226
+ pBar : QProgressDialog or None
227
+ An optional progress bar
228
+
229
+ Returns
230
+ -------
231
+ : [int, ...]
232
+ A list of star-points (one per island) to un-subdivide from
233
+ """
234
+ islands = partitionIslands(faces, neigh, pBar=pBar)
235
+ hints = []
236
+
237
+ if pBar is not None:
238
+ pBar.setValue(0)
239
+ pBar.setMaximum(len(islands))
240
+ QApplication.processEvents()
241
+
242
+ for i, isle in enumerate(islands):
243
+ if pBar is not None:
244
+ pBar.setValue(i)
245
+ QApplication.processEvents()
246
+ hints.append(buildHint(isle, neigh, borders))
247
+
248
+ hints = [h for h in hints if h is not None]
249
+ return hints
250
+
251
+
252
+ def getFaceCenterDel(faces, eNeigh, hints, pBar=None):
253
+ """Given a list of hint "keeper" points
254
+
255
+ Parameters
256
+ ----------
257
+ faces : [[int, ...], ...]
258
+ The list of lists of vertex indices making up faces
259
+ eNeigh : {int: [int, ...]}
260
+ The dict of vertex neighbors
261
+ hints : [int, ...]
262
+ A list of star-points (one per island) to un-subdivide from
263
+ pBar : QProgressDialog or None
264
+ An optional progress bar
265
+
266
+ Returns
267
+ -------
268
+ : set(int)
269
+ Centers of the original faces during a subdivision
270
+ : bool
271
+ Whether the operation failed(True) or not(False)
272
+ """
273
+ vertToFaces = {}
274
+ vc = set()
275
+ for i, face in enumerate(faces):
276
+ for f in face:
277
+ vertToFaces.setdefault(f, []).append(i)
278
+ vc.add(f)
279
+
280
+ count = len(vc)
281
+ centers = set()
282
+ midpoints = set()
283
+ originals = set(hints)
284
+ queue = set(hints)
285
+
286
+ if pBar is not None:
287
+ pBar.setValue(0)
288
+ pBar.setMaximum(count)
289
+ QApplication.processEvents()
290
+
291
+ i = 0
292
+ fail = False
293
+ while queue:
294
+ cur = queue.pop()
295
+ if cur in midpoints:
296
+ continue
297
+
298
+ if pBar is not None:
299
+ pBar.setValue(i)
300
+ QApplication.processEvents()
301
+ i += 2 # Add 2 because I *shouldn't* get any midpoints
302
+
303
+ midpoints.update(eNeigh[cur])
304
+ t = centers if cur in originals else originals
305
+
306
+ for f in vertToFaces[cur]:
307
+ nVerts = faces[f]
308
+
309
+ if len(nVerts) != 4:
310
+ fail = True
311
+ continue
312
+
313
+ curFaceIndex = nVerts.index(cur)
314
+
315
+ half = int(len(nVerts) / 2)
316
+ diag = nVerts[curFaceIndex - half]
317
+
318
+ isOrig = diag in originals
319
+ isCtr = diag in centers
320
+ if not isOrig and not isCtr:
321
+ t.add(diag)
322
+ queue.add(diag)
323
+ elif (
324
+ (isCtr and t is originals)
325
+ or (isOrig and t is centers)
326
+ or (diag in midpoints)
327
+ ):
328
+ fail = True
329
+
330
+ return centers, fail
331
+
332
+
333
+ def getBorders(faces):
334
+ """Get the indices of verts along the borders of a mesh
335
+
336
+ Parameters
337
+ ----------
338
+ faces : [[int, ...], ...]
339
+ The list of lists of vertex indices making up faces
340
+
341
+ Returns
342
+ -------
343
+ : set(int)
344
+ A set of border vertices
345
+ """
346
+ edgePairs = set()
347
+ for face in faces:
348
+ for f in range(len(face)):
349
+ edgePairs.add((face[f], face[f - 1]))
350
+ borders = set()
351
+ for ep in edgePairs:
352
+ if (ep[1], ep[0]) not in edgePairs:
353
+ borders.update(ep)
354
+ return borders
355
+
356
+
357
+ def buildEdgeDict(faces):
358
+ """Build a dictionary of un-ordered neighboring vertices along edges
359
+
360
+ Parameters
361
+ ----------
362
+ faces : [[int, ...], ...]
363
+ The list of lists of vertex indices making up faces
364
+
365
+ Returns
366
+ -------
367
+ : {int: set(int)}
368
+ A dictionary of neighboring vertices along edges
369
+ """
370
+ edgeDict = {}
371
+ for face in faces:
372
+ for f in range(len(face)):
373
+ ff = edgeDict.setdefault(face[f - 1], set())
374
+ ff.add(face[f])
375
+ ff.add(face[f - 2])
376
+ return edgeDict
377
+
378
+
379
+ def buildNeighborDict(faces):
380
+ """Build a structure to ask for edge and face neighboring vertices
381
+ The returned neighbor list starts with an edge neighbor, and
382
+ proceeds counter clockwise, alternating between edge and face neighbors
383
+ Also, while I'm here, grab the border verts
384
+
385
+ Parameters
386
+ ----------
387
+ faces : [[int, ...], ...]
388
+ The list of lists of vertex indices making up faces
389
+
390
+ Returns
391
+ -------
392
+ : {int: [[int, ...], ...]}
393
+ A dictionary keyed from a vert index whose
394
+ values are ordered cycles or fans
395
+ : set(int)
396
+ A set of vertices that are on the border
397
+ """
398
+ fanDict = {}
399
+ edgeDict = {}
400
+ for face in faces:
401
+ for i in range(len(face)):
402
+ fanDict.setdefault(face[i], []).append(face[i + 1 :] + face[:i])
403
+ ff = edgeDict.setdefault(face[i - 1], set())
404
+ ff.add(face[i])
405
+ ff.add(face[i - 2])
406
+
407
+ borders = set()
408
+ out = {}
409
+ for k, v in six.iteritems(fanDict):
410
+ fans, cycles = mergeCycles(v)
411
+ for f, c in zip(fans, cycles):
412
+ if not c:
413
+ borders.update((f[0], f[-1], k))
414
+ out[k] = fans
415
+ return out, edgeDict, borders
416
+
417
+
418
+ def _fanMatch(fan, uFan, dWings):
419
+ """Twist a single fan so it matches the uFan if it can"""
420
+ uIdx = uFan[0]
421
+ for f, fIdx in enumerate(fan):
422
+ dw = dWings.get(fIdx, [])
423
+ if uIdx in dw:
424
+ return fan[f:] + fan[:f]
425
+ return None
426
+
427
+
428
+ def _align(neigh, uNeigh, dWings):
429
+ """Twist all the neighs so they match the uNeigh"""
430
+ out = []
431
+ for uFan in uNeigh:
432
+ for fan in neigh:
433
+ fm = _fanMatch(fan, uFan, dWings)
434
+ if fm is not None:
435
+ out.append(fm)
436
+ break
437
+ return out
438
+
439
+
440
+ def buildLayeredNeighborDicts(faces, uFaces, dWings):
441
+ """Build and align two neighbor dicts for both faces and uFaces
442
+ This guarantees that the neighbors at the same index are analogous
443
+ (ie. they go in the same direction)
444
+
445
+ Parameters
446
+ ----------
447
+ faces : [[int, ...], ...]
448
+ The list of lists of vertex indices making up faces
449
+ uFaces : [[int, ...], ...]
450
+ The list of lists of vertex indices making up un-subdivided faces
451
+ dWings : ???
452
+ ???
453
+
454
+ Returns
455
+ -------
456
+
457
+ """
458
+ neighDict, edgeDict, borders = buildNeighborDict(faces)
459
+ uNeighDict, uEdgeDict, uBorders = buildNeighborDict(uFaces)
460
+
461
+ assert (
462
+ borders >= uBorders
463
+ ), "Somehow the unsubdivided borders contain different vIdxs"
464
+
465
+ for i, (k, uNeigh) in enumerate(six.iteritems(uNeighDict)):
466
+ neighDict[k] = _align(neighDict[k], uNeigh, dWings)
467
+
468
+ return neighDict, uNeighDict, edgeDict, uEdgeDict, borders
469
+
470
+
471
+ def _findOldPositionBorder(
472
+ faces,
473
+ uFaces,
474
+ verts,
475
+ uVerts,
476
+ neighDict,
477
+ uNeighDict,
478
+ edgeDict,
479
+ uEdgeDict,
480
+ borders,
481
+ vIdx,
482
+ computed,
483
+ ):
484
+ """Find the position of the un-subdivided mesh if the vertex was on the border"""
485
+ nei = neighDict[vIdx][0]
486
+ nei = [i for i in nei if i in borders]
487
+ assert len(nei) == 2, "Found multi border, {}".format(nei)
488
+ uVerts[vIdx] = 2 * verts[vIdx] - ((verts[nei[0]] + verts[nei[1]]) / 2)
489
+ computed.add(vIdx)
490
+
491
+
492
+ def _findOldPositionSimple(
493
+ faces,
494
+ uFaces,
495
+ verts,
496
+ uVerts,
497
+ neighDict,
498
+ uNeighDict,
499
+ edgeDict,
500
+ uEdgeDict,
501
+ vIdx,
502
+ computed,
503
+ ):
504
+ """Find the position of the un-subdivided mesh if the vertex has at least 4 neighbors.
505
+ Updates uVerts in-place
506
+ """
507
+ neigh = neighDict[vIdx][0]
508
+
509
+ eTest = edgeDict[vIdx]
510
+ e = [p for p in neigh if p in eTest]
511
+ f = [p for p in neigh if p not in eTest]
512
+
513
+ es = verts[e].sum(axis=0)
514
+ fs = verts[f].sum(axis=0)
515
+
516
+ n = len(e)
517
+ term1 = verts[vIdx] * (n / (n - 3.0))
518
+ term2 = es * (4 / (n * (n - 3.0)))
519
+ term3 = fs * (1 / (n * (n - 3.0)))
520
+ vk = term1 - term2 + term3
521
+
522
+ uVerts[vIdx] = vk
523
+ computed.add(vIdx)
524
+
525
+
526
+ def _findOldPosition3Valence(
527
+ faces,
528
+ uFaces,
529
+ verts,
530
+ uVerts,
531
+ neighDict,
532
+ uNeighDict,
533
+ edgeDict,
534
+ uEdgeDict,
535
+ vIdx,
536
+ computed,
537
+ ):
538
+ """Find the position of the un-subdivided mesh if the vertex has exactly 3 neighbors
539
+ Updates uVerts in-place. It is possible for this to fail.
540
+
541
+ Returns
542
+ -------
543
+ : bool
544
+ Whether an update happened
545
+ """
546
+ neigh = neighDict[vIdx][0]
547
+ uNeigh = uNeighDict[vIdx][0]
548
+
549
+ eTest = edgeDict[vIdx]
550
+ eNeigh = [n for n in neigh if n in eTest]
551
+ fNeigh = [n for n in neigh if n not in eTest]
552
+
553
+ ueTest = uEdgeDict[vIdx]
554
+ ueNeigh = [n for n in uNeigh if n in ueTest]
555
+ # ufNeigh = [n for n in uNeigh if n not in ueTest]
556
+
557
+ intr = computed.intersection(ueNeigh)
558
+ if intr:
559
+ # Easy valence 3 case. I only need
560
+ # The computed new neighbor
561
+ # The midpoint on the edge to that neighbor
562
+ # The "face" verts neighboring the midpoint
563
+
564
+ # Get the matching subbed an unsubbed neighbor indexes
565
+ uNIdx = intr.pop()
566
+ nIdx = eNeigh[ueNeigh.index(uNIdx)]
567
+
568
+ # Get the "face" verts next to the subbed neighbor
569
+ xx = neigh.index(nIdx)
570
+ fnIdxs = (neigh[xx - 1], neigh[(xx + 1) % len(neigh)])
571
+
572
+ # Then compute
573
+ # vk = 4*k1e - ke - k1fNs[0] - k1fNs[1]
574
+ vka = uVerts[uNIdx] + verts[fnIdxs[0]] + verts[fnIdxs[1]]
575
+ vkb = verts[nIdx] * 4
576
+ uVerts[vIdx] = vkb - vka
577
+ computed.add(vIdx)
578
+ return True
579
+
580
+ else:
581
+ # The Hard valence 3 case. Made even harder
582
+ # because the paper has a mistake in it
583
+
584
+ # vk = 4*ejk1 + 4*ejpk1 - fjnk1 - fjpk1 - 6*fjk1 + sum(fik)
585
+ # where k1 means subdivided mesh
586
+ # where j means an index, jn and jp are next/prev adjacents
587
+ # sum(fik) is the sum of all the points of the face that
588
+ # *aren't* the original, or edge-adjacent
589
+ # There could be more than 1 if an n-gon was subdivided
590
+ #
591
+ # I wonder: If it was a triangle that was subdivided, what
592
+ # would sum(fik) because there are no verts that fit that
593
+ # description. I think this is a degenerate case
594
+
595
+ # First, find an adjacent face on the unsub mesh that
596
+ # is only missing the neighbors of the vIdx
597
+
598
+ fnIdx = None
599
+ fik = None
600
+ fCtrIdx = None
601
+ for x, v in enumerate(fNeigh):
602
+ # working with neigh, but should only ever contain uNeigh indexes
603
+ eTest = edgeDict[vIdx]
604
+ origFace = set([n for n in neighDict[v][0] if n not in eTest])
605
+
606
+ check = (origFace - set(ueNeigh)) - set([vIdx])
607
+ if computed >= check:
608
+ fCtrIdx = v
609
+ fnIdx = x
610
+ fik = sorted(list(check))
611
+ break
612
+
613
+ if fnIdx is None:
614
+ # No possiblity found
615
+ return False
616
+
617
+ # Then apply the equation from above
618
+ neighIdx = neigh.index(fCtrIdx)
619
+ ejnk1 = neigh[(neighIdx + 1) % len(neigh)]
620
+ ejpk1 = neigh[neighIdx - 1]
621
+ fjnk1 = fNeigh[(fnIdx + 1) % len(fNeigh)]
622
+ fjpk1 = fNeigh[fnIdx - 1]
623
+ fjk1 = verts[fCtrIdx]
624
+ sumFik = uVerts[fik].sum(axis=0)
625
+ vk = 4 * ejnk1 + 4 * ejpk1 - fjnk1 - fjpk1 - 6 * fjk1 + sumFik
626
+ uVerts[vIdx] = vk
627
+ computed.add(vIdx)
628
+ return True
629
+ return False
630
+
631
+
632
+ def deleteCenters(meshFaces, uvFaces, centerDel, pBar=None):
633
+ """Delete the given vertices and connected edges from a face representation
634
+ to give a new representation.
635
+
636
+ Parameters
637
+ ----------
638
+ meshFaces : [[int, ...], ...]
639
+ The list of lists of vertex indices making up faces
640
+ centerDel : set(int)
641
+ A set of vertices to delete. These were the vertices added
642
+ to the centers of the faces when subdividing.
643
+ uvFaces : [[int, ...], ...]
644
+ The list of lists of uv indices making up uvFaces
645
+ pBar : QProgressDialog or None
646
+ An optional progress bar
647
+
648
+ Returns
649
+ -------
650
+ : [[int, ...], ...]
651
+ The new list of faces of the mesh
652
+ : [[int, ...], ...]
653
+ The new list of uvfaces of the mesh
654
+ : {int: (int, int)}
655
+ A dict of a deleted edge-midpoint to its two existing neighbor verts
656
+ : {int: (int, int)}
657
+ A dict of a deleted uv edge-midpoint to its two existing neighbor uvs
658
+ """
659
+ # For each deleted index, grab the neighboring faces,
660
+ # and twist the faces so the deleted index is first
661
+ cds = set(centerDel)
662
+ faceDelDict = {}
663
+ uvDelDict = {}
664
+ uvFaces = uvFaces or []
665
+ for face, uvFace in zip_longest(meshFaces, uvFaces):
666
+ fi = cds.intersection(face)
667
+ # If we are a subdivided mesh, Then each face will have exactly one
668
+ # vertex that is part of the deletion set
669
+ if len(fi) != 1:
670
+ raise ValueError("Found a face with an unrecognized connectivity")
671
+ # Get that one vert
672
+ idx = fi.pop()
673
+ # Each face is a cycle. Rotate the cycle
674
+ # so that idx is first in the list
675
+ rv = face.index(idx)
676
+ rFace = face[rv:] + face[:rv]
677
+ faceDelDict.setdefault(idx, []).append(rFace)
678
+
679
+ if uvFace is not None:
680
+ rUVFace = uvFace[rv:] + uvFace[:rv]
681
+ uvDelDict.setdefault(idx, []).append(rUVFace)
682
+
683
+ newFaces = []
684
+ nUVFaces = []
685
+ wings = {}
686
+ uvWings = {}
687
+
688
+ if pBar is not None:
689
+ pBar.setValue(0)
690
+ pBar.setMaximum(len(faceDelDict))
691
+
692
+ chk = -1
693
+ for idx, rFaces in six.iteritems(faceDelDict):
694
+ chk += 1
695
+ if pBar is not None:
696
+ pBar.setValue(chk)
697
+ QApplication.processEvents()
698
+
699
+ ruvFaces = uvDelDict.get(idx, [])
700
+ # The faces are guaranteed to be in a single loop cycle
701
+ # so I don't have to handle any annoying edge cases! Yay!
702
+ faceEnds = {
703
+ f[1]: (f[2], f[3], uvf) for f, uvf in zip_longest(rFaces, ruvFaces)
704
+ } # face ends
705
+
706
+ end = rFaces[-1][-1] # get an arbitrary face to start with
707
+ newFace = []
708
+ nUVFace = []
709
+ while faceEnds:
710
+ try:
711
+ diag, nxt, uvf = faceEnds.pop(end)
712
+ except KeyError:
713
+ print("rFaces", rFaces)
714
+ print("fe", faceEnds)
715
+ raise
716
+ if uvf is not None:
717
+ try:
718
+ nUVFace.append(uvf[2])
719
+ uvWings.setdefault(uvf[1], []).append(uvf[2])
720
+ uvWings.setdefault(uvf[3], []).append(uvf[2])
721
+ except IndexError:
722
+ print("UVF", uvf, chk)
723
+ raise
724
+
725
+ newFace.append(diag)
726
+ wings.setdefault(end, []).append(diag)
727
+ wings.setdefault(nxt, []).append(diag)
728
+
729
+ end = nxt
730
+ newFaces.append(newFace)
731
+ if nUVFace:
732
+ nUVFaces.append(nUVFace)
733
+ nUVFaces = nUVFaces or None
734
+
735
+ return newFaces, nUVFaces, wings, uvWings
736
+
737
+
738
+ def fixVerts(
739
+ faces,
740
+ uFaces,
741
+ verts,
742
+ neighDict,
743
+ uNeighDict,
744
+ edgeDict,
745
+ uEdgeDict,
746
+ borders,
747
+ pinned,
748
+ pBar=None,
749
+ ):
750
+ """Given the faces, vertex positions, and the point indices that
751
+ were created at the face centers for a subdivision step
752
+ Return the faces and verts of the mesh from before the
753
+ subdivision step. This algorithm doesn't handle UV's yet
754
+
755
+ Parameters
756
+ ----------
757
+ faces : [[int, ...], ...]
758
+ The list of lists of vertex indices making up faces
759
+ verts : np.array
760
+ The Nx3 array of vertices
761
+ centerDel : set(int)
762
+ A set of vertices to delete
763
+ uFaces : [[int, ...], ...]
764
+ The list of lists of vertex indices making up the
765
+ un-subdivided faces. Not all numbers in the vert range are in this structure
766
+ neighDict : {int: [int, ...]}
767
+ The dictionary of vertex neighbors based on ``faces``
768
+ uNeighDict : {int: [int, ...]}
769
+ The dictionary of vertex neighbors based on ``uFaces``
770
+ edgeDict : TODO
771
+ Some kind of dictionary representing individual edges
772
+ uEdgeDict : TODO
773
+ Some kind of dictionary representing individual edges in the unsub mesh
774
+ borders : set(int)
775
+ The set of vertices along the borders
776
+ pinned : set(int)
777
+ The set of vertices that will not be moved by this process
778
+ pBar : QProgressDialog or None
779
+ An optional progress bar
780
+
781
+ Returns
782
+ -------
783
+ : np.array
784
+ An array of vertex positions
785
+ """
786
+ uVerts = verts.copy()
787
+ uIdxs = sorted(list(set([i for i in chain.from_iterable(uFaces)])))
788
+
789
+ v3Idxs = []
790
+ # bowtie verts are pinned
791
+ bowTieIdxs = []
792
+ computed = set()
793
+ i = 0
794
+ if pBar is not None:
795
+ pBar.setValue(0)
796
+ pBar.setMaximum(len(uIdxs))
797
+
798
+ for idx in uIdxs:
799
+ if pBar is not None:
800
+ pBar.setValue(i)
801
+ QApplication.processEvents()
802
+ if len(uNeighDict[idx]) > 1:
803
+ bowTieIdxs.append(idx)
804
+ i += 1
805
+ elif idx in pinned:
806
+ pass
807
+ elif idx in borders:
808
+ _findOldPositionBorder(
809
+ faces,
810
+ uFaces,
811
+ verts,
812
+ uVerts,
813
+ neighDict,
814
+ uNeighDict,
815
+ edgeDict,
816
+ uEdgeDict,
817
+ borders,
818
+ idx,
819
+ computed,
820
+ )
821
+ i += 1
822
+ elif sum(map(len, neighDict[idx])) > 6: # if valence > 3
823
+ _findOldPositionSimple(
824
+ faces,
825
+ uFaces,
826
+ verts,
827
+ uVerts,
828
+ neighDict,
829
+ uNeighDict,
830
+ edgeDict,
831
+ uEdgeDict,
832
+ idx,
833
+ computed,
834
+ )
835
+ i += 1
836
+ else:
837
+ v3Idxs.append(idx)
838
+
839
+ updated = True
840
+ while updated:
841
+ updated = False
842
+ rem = set()
843
+ for idx in v3Idxs:
844
+ up = _findOldPosition3Valence(
845
+ faces,
846
+ uFaces,
847
+ verts,
848
+ uVerts,
849
+ neighDict,
850
+ uNeighDict,
851
+ edgeDict,
852
+ uEdgeDict,
853
+ idx,
854
+ computed,
855
+ )
856
+ if not up:
857
+ continue
858
+ if pBar is not None:
859
+ pBar.setValue(i)
860
+ QApplication.processEvents()
861
+ i += 1
862
+ updated = True
863
+ rem.add(idx)
864
+ v3Idxs = list(set(v3Idxs) - rem)
865
+
866
+ return uVerts
867
+
868
+
869
+ def getUVPins(faces, borders, uvFaces, uvBorders, pinBorders):
870
+ """Find which uvBorders are also mesh borders
871
+
872
+ Parameters
873
+ ----------
874
+ faces : [[int, ...], ...]
875
+ The list of lists of vertex indices making up faces
876
+ borders : set(int)
877
+ The set of vertices along the borders
878
+ uvFaces : [[int, ...], ...]
879
+ The list of lists of uv indices making up uvFaces
880
+ uvBorders : set(int)
881
+ The set of vertices along the borders of uvs
882
+ pinBorders : bool
883
+ Whether to just pin all uv borders
884
+
885
+ Returns
886
+ -------
887
+ : set(int)
888
+ The vertex indices to pin
889
+ """
890
+ if uvFaces is None:
891
+ return set()
892
+ if pinBorders:
893
+ return set(uvBorders)
894
+
895
+ pinnit = set()
896
+ for face, uvFace in zip(faces, uvFaces):
897
+ for i in range(len(face)):
898
+ f = face[i]
899
+ pf = face[i - 1]
900
+
901
+ uv = uvFace[i]
902
+ puv = uvFace[i - 1]
903
+
904
+ if not (f in borders and pf in borders):
905
+ if uv in uvBorders and puv in uvBorders:
906
+ pinnit.add(puv)
907
+ pinnit.add(uv)
908
+
909
+ return uvBorders & pinnit
910
+
911
+
912
+ def collapse(faces, verts, uvFaces, uvs):
913
+ """Take a mesh representation with unused vertex indices, and remove those vertices
914
+
915
+ Parameters
916
+ ----------
917
+ faces : [[int, ...], ...]
918
+ The list of lists of vertex indices making up faces
919
+ The set of integers used here will be non-contiguous
920
+ verts : np.array
921
+ The N*3 array of vertices
922
+ uvFaces : [[int, ...], ...]
923
+ The list of lists of uv indices making up uvFaces
924
+ The set of integers used here will be non-contiguous
925
+ uvs : np.array
926
+ The N*2 array of uvs
927
+
928
+ Returns
929
+ -------
930
+ : [[int, ...], ...]
931
+ The list of lists of vertex indices making up faces
932
+ The set of integers used here will be contiguous
933
+ : np.array
934
+ The new N*3 array of vertices
935
+ : [[int, ...], ...]
936
+ The list of lists of uv indices making up uvFaces
937
+ The set of integers used here will be non-contiguous
938
+ : np.array
939
+ The new N*2 array of uvs
940
+ """
941
+ vset = sorted(list(set(chain.from_iterable(faces))))
942
+ nVerts = verts[vset]
943
+ vDict = {v: i for i, v in enumerate(vset)}
944
+ nFaces = [[vDict[f] for f in face] for face in faces]
945
+
946
+ if uvFaces is not None:
947
+ uvset = sorted(list(set(chain.from_iterable(uvFaces))))
948
+ nUVs = uvs[uvset]
949
+ uvDict = {v: i for i, v in enumerate(uvset)}
950
+ nUVFaces = [[uvDict[f] for f in face] for face in uvFaces]
951
+ else:
952
+ nUVs = None
953
+ nUVFaces = None
954
+
955
+ return nFaces, nVerts, nUVFaces, nUVs
956
+
957
+
958
+ def getCenters(faces, hints=None, pBar=None):
959
+ """Given a set of faces, find the face-center vertices from the subdivision
960
+
961
+ Parameters
962
+ ----------
963
+ faces : [[int, ...], ...]
964
+ The list of lists of vertex indices making up faces
965
+ hints : set(int) or None
966
+ An optional list of star points that were part of the original un-subdivided mesh
967
+ pBar : QProgressDialog or None
968
+ An optional progress bar
969
+
970
+ Returns
971
+ -------
972
+ : set(int)
973
+ The vertices that were added to the centers of the faces as part of the subdivision process
974
+ """
975
+ if pBar is not None:
976
+ pBar.setLabelText("Crawling Edges")
977
+ pBar.show()
978
+ QApplication.processEvents()
979
+
980
+ eNeigh = buildEdgeDict(faces)
981
+ if hints is None:
982
+ borders = getBorders(faces)
983
+ hints = buildUnsubdivideHints(
984
+ faces, eNeigh, borders, pBar=None
985
+ ) # purposely no PBar
986
+ centerDel, fail = getFaceCenterDel(faces, eNeigh, hints, pBar=pBar)
987
+ assert not fail, "Could not detect subdivided topology with the provided hints"
988
+
989
+ if pBar is not None:
990
+ pBar.close()
991
+
992
+ return centerDel
993
+
994
+
995
+ def unSubdivide(
996
+ faces,
997
+ verts,
998
+ uvFaces,
999
+ uvs,
1000
+ hints=None,
1001
+ repositionVerts=True,
1002
+ pinBorders=False,
1003
+ pBar=None,
1004
+ ):
1005
+ """Given a mesh representation (faces and vertices) remove the edges added
1006
+ by a subdivision, and optionally reposition the verts
1007
+
1008
+ Parameters
1009
+ ----------
1010
+ faces : [[int, ...], ...]
1011
+ The list of lists of vertex indices making up faces
1012
+ verts : np.array
1013
+ The N*3 array of vertices
1014
+ uvFaces : [[int, ...], ...]
1015
+ The list of lists of uv indices making up uvFaces
1016
+ uvs : np.array
1017
+ The N*2 array of uvs
1018
+ hints : set(int) or None
1019
+ An optional list of star points that were part of the original un-subdivided mesh
1020
+ repositionVerts : bool
1021
+ Whether to also estimate the positions of the un-subdivided verts. Defaults to True
1022
+ pinBorders : bool
1023
+ Whether or not to pin the border vertices. Defaults to False
1024
+ pBar : QProgressDialog or None
1025
+ An optional progress bar
1026
+
1027
+ Returns
1028
+ -------
1029
+ : [[vIdx ...], ...]
1030
+ The un-subdivided face structure
1031
+ : np.array
1032
+ The un-subdivided vertex positions
1033
+ : [[vIdx ...], ...] or None
1034
+ The un-subdivided uv-face structure if it exists
1035
+ : np.array or None
1036
+ The un-subdivided uvs if they exist
1037
+ """
1038
+ if pBar is not None:
1039
+ pBar.show()
1040
+ pBar.setLabelText("Finding Neighbors")
1041
+ QApplication.processEvents()
1042
+
1043
+ eNeigh = buildEdgeDict(faces)
1044
+
1045
+ if hints is None:
1046
+ if pBar is not None:
1047
+ pBar.show()
1048
+ pBar.setLabelText("Getting Hints")
1049
+ QApplication.processEvents()
1050
+ borders = getBorders(faces)
1051
+ hints = buildUnsubdivideHints(
1052
+ faces, eNeigh, borders, pBar=None
1053
+ ) # Purposely no PBar
1054
+
1055
+ if pBar is not None:
1056
+ pBar.setLabelText("Crawling Edges")
1057
+ QApplication.processEvents()
1058
+ centerDel, fail = getFaceCenterDel(faces, eNeigh, hints, pBar=pBar)
1059
+ assert not fail, "Could not detect subdivided topology with the provided hints"
1060
+
1061
+ if pBar is not None:
1062
+ pBar.setLabelText("Deleting Edges")
1063
+ QApplication.processEvents()
1064
+ uFaces, uUVFaces, dWings, uvDWings = deleteCenters(
1065
+ faces, uvFaces, centerDel, pBar=pBar
1066
+ )
1067
+
1068
+ uVerts = verts
1069
+ uUVs = uvs
1070
+ if repositionVerts:
1071
+ # Handle the verts
1072
+ if pBar is not None:
1073
+ pBar.setLabelText("Building Correspondences")
1074
+ QApplication.processEvents()
1075
+ neighDict, uNeighDict, edgeDict, uEdgeDict, borders = buildLayeredNeighborDicts(
1076
+ faces, uFaces, dWings
1077
+ )
1078
+ pinned = set(borders) if pinBorders else []
1079
+ if pBar is not None:
1080
+ pBar.setLabelText("Fixing Vert Positions")
1081
+ QApplication.processEvents()
1082
+ uVerts = fixVerts(
1083
+ faces,
1084
+ uFaces,
1085
+ verts,
1086
+ neighDict,
1087
+ uNeighDict,
1088
+ edgeDict,
1089
+ uEdgeDict,
1090
+ borders,
1091
+ pinned,
1092
+ pBar=pBar,
1093
+ )
1094
+
1095
+ # Handle the UVs
1096
+ if uvFaces is not None:
1097
+ (
1098
+ uvNeighDict,
1099
+ uUVNeighDict,
1100
+ uvEdgeDict,
1101
+ uvUEdgeDict,
1102
+ uvBorders,
1103
+ ) = buildLayeredNeighborDicts(uvFaces, uUVFaces, uvDWings)
1104
+ uvPinned = getUVPins(faces, borders, uvFaces, uvBorders, pinBorders)
1105
+ if pBar is not None:
1106
+ pBar.setLabelText("Fixing UV Positions")
1107
+ QApplication.processEvents()
1108
+ uUVs = fixVerts(
1109
+ uvFaces,
1110
+ uUVFaces,
1111
+ uvs,
1112
+ uvNeighDict,
1113
+ uUVNeighDict,
1114
+ uvEdgeDict,
1115
+ uvUEdgeDict,
1116
+ uvBorders,
1117
+ uvPinned,
1118
+ pBar=pBar,
1119
+ )
1120
+
1121
+ rFaces, rVerts, rUVFaces, rUVs = collapse(uFaces, uVerts, uUVFaces, uUVs)
1122
+
1123
+ if pBar is not None:
1124
+ pBar.close()
1125
+
1126
+ return rFaces, rVerts, rUVFaces, rUVs
1127
+
1128
+
1129
+ ####################################################################
1130
+ # Handle .smpx files here #
1131
+ ####################################################################
1132
+
1133
+
1134
+ def _ussmpx(faces, verts, uvFaces, uvs, pBar=None):
1135
+ """Unsubdivide a simplex"""
1136
+ pbPrint(pBar, message="Finding Neighbors")
1137
+ eNeigh = buildEdgeDict(faces)
1138
+
1139
+ pbPrint(pBar, message="Getting Hints")
1140
+ borders = getBorders(faces)
1141
+ hints = buildUnsubdivideHints(
1142
+ faces, eNeigh, borders, pBar=None
1143
+ ) # Purposely no PBar
1144
+
1145
+ pbPrint(pBar, message="Crawling Edges")
1146
+ centerDel, fail = getFaceCenterDel(faces, eNeigh, hints, pBar=pBar)
1147
+ assert not fail, "Could not detect subdivided topology with the provided hints"
1148
+
1149
+ pbPrint(pBar, message="Deleting Edges")
1150
+ uFaces, uUVFaces, _, _ = deleteCenters(faces, uvFaces, centerDel, pBar=pBar)
1151
+
1152
+ pbPrint(pBar, message="Collapsing Indexes")
1153
+ uVerts = verts
1154
+ uUVs = uvs
1155
+
1156
+ rFaces, rVerts, rUVFaces, rUVs = collapse(uFaces, uVerts, uUVFaces, uUVs)
1157
+
1158
+ if pBar is not None:
1159
+ pBar.close()
1160
+ else:
1161
+ print("Done")
1162
+
1163
+ return rFaces, rVerts, rUVFaces, rUVs
1164
+
1165
+
1166
+ def _applyShapePrefix(shapePrefix, jsString):
1167
+ """Apply a prefix to the shape names.
1168
+ For XSI where shape names must be unique
1169
+ """
1170
+ if shapePrefix is not None:
1171
+ d = json.loads(jsString)
1172
+ if d["encodingVersion"] > 1:
1173
+ for shape in d["shapes"]:
1174
+ shape["name"] = shapePrefix + shape["name"]
1175
+ else:
1176
+ d["shapes"] = [shapePrefix + i for i in d["shapes"]]
1177
+ jsString = json.dumps(d)
1178
+ return jsString
1179
+
1180
+
1181
+ def _unflattenFaces(flatFaces, counts):
1182
+ faces = []
1183
+ ptr = 0
1184
+ for c in counts:
1185
+ faces.append(flatFaces[ptr : ptr + c].tolist())
1186
+ ptr += c
1187
+ return faces
1188
+
1189
+
1190
+ def unsubdivideSimplex(inPath, outPath, shapePrefix=None, pBar=None):
1191
+ """Unsubdivde a .smpx file on disk
1192
+
1193
+ Parameters
1194
+ ----------
1195
+ inPath : str
1196
+ The input .smpx file path
1197
+ outPath : str
1198
+ The output .smpx file path
1199
+ shapePrefix : str or None
1200
+ An optional string to prefix the shape names with
1201
+ pBar : QProgressDialog or None
1202
+ An optional progress bar
1203
+ """
1204
+ if np is None:
1205
+ raise RuntimeError("Un-Subdivide requires numpy, and it is not available here")
1206
+
1207
+ pbPrint(pBar, message="Loading smpx")
1208
+ jsString, counts, verts, flatFaces, uvs, flatUVFaces = readSmpx(inPath)
1209
+ jsString = _applyShapePrefix(shapePrefix, jsString)
1210
+
1211
+ js = json.loads(jsString)
1212
+ name = js["systemName"]
1213
+
1214
+ faces = _unflattenFaces(flatFaces, counts)
1215
+ uvFaces = None
1216
+ if flatUVFaces is not None:
1217
+ uvFaces = _unflattenFaces(flatUVFaces, counts)
1218
+
1219
+ pbPrint(pBar, message="Unsubdividing")
1220
+ verts = verts.swapaxes(0, 1)
1221
+ uFaces, uVerts, uUVFaces, uUVs = _ussmpx(faces, verts, uvFaces, uvs, pBar=pBar)
1222
+
1223
+ pbPrint(pBar, message="Exporting")
1224
+ buildSmpx(
1225
+ outPath,
1226
+ uVerts.swapaxes(0, 1),
1227
+ uFaces,
1228
+ jsString,
1229
+ name,
1230
+ uvs=uUVs,
1231
+ uvFaces=uUVFaces,
1232
+ )