-
Notifications
You must be signed in to change notification settings - Fork 1
/
VRoidAvatar.cs
589 lines (522 loc) · 28.5 KB
/
VRoidAvatar.cs
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
using System.Collections.Generic;
using UnityEditorInternal;
using UnityEngine;
using UnityEngine.Animations;
using VRC.Dynamics;
using VRC.SDK3.Avatars.Components;
using VRC.SDK3.Dynamics.PhysBone.Components;
using static VRC.SDK3.Avatars.Components.VRCAvatarDescriptor.CustomEyeLookSettings;
namespace Jirko.Unity.VRoidAvatarUtils
{
public class VRoidAvatar
{
private GameObject cloneGameObject = null;
private Dictionary<string, List<VRCPhysBone>> physBoneDict;
private List<string> boneName;
private List<string> exclusionBoneName;
private VRCAvatarDescriptor sourceAvatarDescriptor;
private VRCAvatarDescriptor targetAvatarDescriptor;
private VRC.Core.PipelineManager sourcePipelineManager;
private VRC.Core.PipelineManager targetPipelineManager;
public List<string> messages;
public List<string> errors;
public float viewX = 0f;
public float viewY = 0f;
public float viewZ = 0f;
public float confidence = 0f;
public float excitement = 0f;
public Quaternion quaterRL;
public Quaternion quaterRR;
public Quaternion quaterLL;
public Quaternion quaterLR;
public Quaternion quaterUL;
public Quaternion quaterUR;
public Quaternion quaterDL;
public Quaternion quaterDR;
public Quaternion quaterSL;
public Quaternion quaterSR;
public string srcBlueprintId;
public VRCAvatarDescriptor.CustomAnimLayer[] srcBaseAnimationLayers;
public VRCAvatarDescriptor.CustomAnimLayer[] srcSpecialAnimationLayers;
public VRC.SDK3.Avatars.ScriptableObjects.VRCExpressionsMenu srcExpressionsMenu;
public VRC.SDK3.Avatars.ScriptableObjects.VRCExpressionParameters srcExpressionParameters;
public int avatarMode = 0;
// VRC Avatar Descripter
//// View
public bool viewPosition = true;
//// Eye Look
public bool eyeMovements = true;
public bool rotationStates = true;
//// Playerble Layers
public bool baseAnimationLayers = true;
public bool specialAnimationLayers = true;
//// Expressions
public bool expressionsMenu = true;
public bool expressionParameters = true;
// Pipeline Manager
public bool blueprintId = true;
// PhysBone
//// PhysBones
public bool physBones = true;
public bool physBones_hair = true;
public bool physBones_skirt = true;
public bool physBones_bust = true;
public bool physBones_sleeve = true;
public bool physBones_other = true;
public bool physBoneColiders = true;
// Object
public bool objects = true;
// Constraints
public bool aimConstraint = true;
public bool lookAtConstraint = true;
public bool parentConstraint = true;
public bool positionConstraint = true;
public bool rotationConstraint = true;
public bool scaleConstraint = true;
public VRoidAvatar(GameObject gameObject)
{
cloneGameObject = UnityEngine.Object.Instantiate(gameObject);
sourceAvatarDescriptor = cloneGameObject.GetComponent<VRCAvatarDescriptor>();
sourcePipelineManager = cloneGameObject.GetComponent<VRC.Core.PipelineManager>();
if (ShouldCopyVRCAvatarDescripter() && sourceAvatarDescriptor != null)
{
viewX = sourceAvatarDescriptor.ViewPosition.x;
viewY = sourceAvatarDescriptor.ViewPosition.y;
viewZ = sourceAvatarDescriptor.ViewPosition.z;
confidence = sourceAvatarDescriptor.customEyeLookSettings.eyeMovement.confidence;
excitement = sourceAvatarDescriptor.customEyeLookSettings.eyeMovement.excitement;
srcBaseAnimationLayers = sourceAvatarDescriptor.baseAnimationLayers;
srcSpecialAnimationLayers = sourceAvatarDescriptor.specialAnimationLayers;
srcExpressionsMenu = sourceAvatarDescriptor.expressionsMenu;
srcExpressionParameters = sourceAvatarDescriptor.expressionParameters;
EyeRotations eyesLooking = sourceAvatarDescriptor.customEyeLookSettings.eyesLookingRight;
quaterRL = new Quaternion(eyesLooking.left.x, eyesLooking.left.y, eyesLooking.left.z, eyesLooking.left.w);
quaterRL = new Quaternion(eyesLooking.right.x, eyesLooking.right.y, eyesLooking.right.z, eyesLooking.right.w);
eyesLooking = sourceAvatarDescriptor.customEyeLookSettings.eyesLookingLeft;
quaterLL = new Quaternion(eyesLooking.left.x, eyesLooking.left.y, eyesLooking.left.z, eyesLooking.left.w);
quaterLR = new Quaternion(eyesLooking.right.x, eyesLooking.right.y, eyesLooking.right.z, eyesLooking.right.w);
eyesLooking = sourceAvatarDescriptor.customEyeLookSettings.eyesLookingDown;
quaterDL = new Quaternion(eyesLooking.left.x, eyesLooking.left.y, eyesLooking.left.z, eyesLooking.left.w);
quaterDR = new Quaternion(eyesLooking.right.x, eyesLooking.right.y, eyesLooking.right.z, eyesLooking.right.w);
eyesLooking = sourceAvatarDescriptor.customEyeLookSettings.eyesLookingUp;
quaterUL = new Quaternion(eyesLooking.left.x, eyesLooking.left.y, eyesLooking.left.z, eyesLooking.left.w);
quaterUR = new Quaternion(eyesLooking.right.x, eyesLooking.right.y, eyesLooking.right.z, eyesLooking.right.w);
eyesLooking = sourceAvatarDescriptor.customEyeLookSettings.eyesLookingStraight;
quaterSL = new Quaternion(eyesLooking.left.x, eyesLooking.left.y, eyesLooking.left.z, eyesLooking.left.w);
quaterSR = new Quaternion(eyesLooking.right.x, eyesLooking.right.y, eyesLooking.right.z, eyesLooking.right.w);
}
physBoneDict = new Dictionary<string, List<VRCPhysBone>>();
VRCPhysBone[] physBones;
physBones = cloneGameObject.GetComponentsInChildren<VRCPhysBone>();
foreach (var ph in physBones)
{
if (!physBoneDict.ContainsKey(ph.gameObject.GetFullPath()))
{
physBoneDict.Add(ph.gameObject.GetFullPath(), new List<VRCPhysBone>());
}
physBoneDict[ph.gameObject.GetFullPath()].Add(ph);
}
}
public void CopyToTarget(GameObject targetObject)
{
targetAvatarDescriptor = targetObject.GetComponent<VRCAvatarDescriptor>();
targetPipelineManager = targetObject.GetComponent<VRC.Core.PipelineManager>();
this.messages = new List<string>();
this.errors = new List<string>();
this.boneName = new List<string>();
this.exclusionBoneName = new List<string>();
boneName.Add("Hair");
boneName.Add("Skirt");
boneName.Add("Bust");
boneName.Add("Sleeve");
if (!physBones_hair)
{
exclusionBoneName.Add("Hair");
}
if (!physBones_skirt)
{
exclusionBoneName.Add("Skirt");
}
if (!physBones_bust)
{
exclusionBoneName.Add("Bust");
}
if (!physBones_sleeve)
{
exclusionBoneName.Add("Sleeve");
}
if (ShouldCopyVRCAvatarDescripter() && sourceAvatarDescriptor == null)
{
errors.Add("コピー元アバターにVRCAvatarDescriptorコンポーネントがないためコピーできませんでした。\n VRCAvatarDescriptor配下の項目のチェックを外すか、コピー元アバターにコンポーネントを追加してください");
}
if (ShouldCopyVRCAvatarDescripter() && targetAvatarDescriptor == null)
{
errors.Add("コピー先アバターにVRCAvatarDescriptorコンポーネントがないためコピーできませんでした。\n VRCAvatarDescriptor配下の項目のチェックを外すか、コピー先アバターにコンポーネントを追加してください");
}
if(ShouldCopyVRCAvatarDescripter() && sourceAvatarDescriptor != null && targetAvatarDescriptor != null)
{
if (viewPosition)
{
messages.Add("View Positionをコピー");
targetAvatarDescriptor.ViewPosition.x = viewX;
targetAvatarDescriptor.ViewPosition.y = viewY;
targetAvatarDescriptor.ViewPosition.z = viewZ;
}
if (eyeMovements)
{
messages.Add("Eye Look - Eye Movementsをコピー");
targetAvatarDescriptor.customEyeLookSettings.eyeMovement.confidence = confidence;
targetAvatarDescriptor.customEyeLookSettings.eyeMovement.excitement = excitement;
}
if (rotationStates)
{
messages.Add("Eye Look - Rotation Statesをコピー");
targetAvatarDescriptor.customEyeLookSettings.eyesLookingRight.left = quaterRL;
targetAvatarDescriptor.customEyeLookSettings.eyesLookingRight.right = quaterRR;
targetAvatarDescriptor.customEyeLookSettings.eyesLookingLeft.left = quaterLL;
targetAvatarDescriptor.customEyeLookSettings.eyesLookingLeft.right = quaterLR;
targetAvatarDescriptor.customEyeLookSettings.eyesLookingDown.left = quaterDL;
targetAvatarDescriptor.customEyeLookSettings.eyesLookingDown.right = quaterDR;
targetAvatarDescriptor.customEyeLookSettings.eyesLookingUp.left = quaterUL;
targetAvatarDescriptor.customEyeLookSettings.eyesLookingUp.right = quaterUR;
targetAvatarDescriptor.customEyeLookSettings.eyesLookingStraight.left = quaterSL;
targetAvatarDescriptor.customEyeLookSettings.eyesLookingStraight.right = quaterSR;
}
if (baseAnimationLayers)
{
messages.Add("BaseAnimationLayersをコピー");
foreach (var layer in srcBaseAnimationLayers)
{
switch (layer.type)
{
case VRCAvatarDescriptor.AnimLayerType.Base:
targetAvatarDescriptor.baseAnimationLayers[0] = layer;
break;
case VRCAvatarDescriptor.AnimLayerType.Additive:
targetAvatarDescriptor.baseAnimationLayers[1] = layer;
break;
case VRCAvatarDescriptor.AnimLayerType.Gesture:
targetAvatarDescriptor.baseAnimationLayers[2] = layer;
break;
case VRCAvatarDescriptor.AnimLayerType.Action:
targetAvatarDescriptor.baseAnimationLayers[3] = layer;
break;
case VRCAvatarDescriptor.AnimLayerType.FX:
targetAvatarDescriptor.baseAnimationLayers[4] = layer;
break;
}
}
}
if (specialAnimationLayers)
{
messages.Add("SpecialAnimationLayersをコピー");
foreach (var layer in srcSpecialAnimationLayers)
{
switch (layer.type)
{
case VRCAvatarDescriptor.AnimLayerType.Sitting:
targetAvatarDescriptor.specialAnimationLayers[0] = layer;
break;
case VRCAvatarDescriptor.AnimLayerType.TPose:
targetAvatarDescriptor.specialAnimationLayers[1] = layer;
break;
case VRCAvatarDescriptor.AnimLayerType.IKPose:
targetAvatarDescriptor.specialAnimationLayers[2] = layer;
break;
}
}
}
if (expressionsMenu)
{
messages.Add("ExpressionsMenuをコピー");
targetAvatarDescriptor.expressionsMenu = srcExpressionsMenu;
}
if (expressionParameters)
{
messages.Add("ExpressionParametersをコピー");
targetAvatarDescriptor.expressionParameters = srcExpressionParameters;
}
}
if (blueprintId && sourcePipelineManager == null)
{
errors.Add("コピー元アバターにPipelineManagerコンポーネントがないためコピーできませんでした。\n Blueprint IDのチェックを外すか、コピー元アバターにコンポーネントを追加してください");
}
if (blueprintId && targetPipelineManager == null)
{
errors.Add("コピー先アバターにPipelineManagerコンポーネントがないためコピーできませんでした。\n Blueprint IDのチェックを外すか、コピー先アバターにコンポーネントを追加してください");
}
if (blueprintId && sourcePipelineManager != null && targetPipelineManager != null)
{
messages.Add("BlueprintIDをコピー");
targetPipelineManager.blueprintId = sourcePipelineManager.blueprintId;
}
if (objects)
{
int obj_count = 0;
const bool includeInactive = true;
Transform[] allchildren = cloneGameObject.GetComponentsInChildren<Transform>(includeInactive);
foreach (Transform child in allchildren)
{
if (child.gameObject.transform.parent != null)
{
if ((child.gameObject.transform.parent.gameObject.GetFullPath()).Equals(cloneGameObject.transform.name))
{
// 1階層目
if (targetObject.transform.Find(child.gameObject.name) == null)
{
GameObject new_child = UnityEngine.Object.Instantiate(child.gameObject, new Vector3(child.gameObject.transform.position.x, child.gameObject.transform.position.y, child.gameObject.transform.position.z), Quaternion.identity);
new_child.transform.rotation = new Quaternion(child.gameObject.transform.rotation.x, child.gameObject.transform.rotation.y, child.gameObject.transform.rotation.z, child.gameObject.transform.rotation.w);
new_child.transform.parent = targetObject.transform;
new_child.name = child.gameObject.name;
obj_count++;
}
}
else
{
// 2階層以下
if (targetObject.transform.Find(child.gameObject.GetFullPath()) == null)
{
GameObject new_child = UnityEngine.Object.Instantiate(child.gameObject, new Vector3(child.gameObject.transform.position.x, child.gameObject.transform.position.y, child.gameObject.transform.position.z), Quaternion.identity);
new_child.transform.rotation = new Quaternion(child.gameObject.transform.rotation.x, child.gameObject.transform.rotation.y, child.gameObject.transform.rotation.z, child.gameObject.transform.rotation.w);
new_child.transform.parent = targetObject.transform.Find(child.gameObject.transform.parent.GetFullPath()).transform;
new_child.name = child.gameObject.name;
obj_count++;
}
}
}
}
messages.Add("Objectをコピー(" + obj_count + "件)");
}
VRCPhysBoneCollider[] physBoneColliders_array = null;
if (physBoneColiders)
{
int col_count = 0;
physBoneColliders_array = targetObject.GetComponentsInChildren<VRCPhysBoneCollider>();
VRCPhysBoneCollider[] physBoneColliders = null;
physBoneColliders = cloneGameObject.GetComponentsInChildren<VRCPhysBoneCollider>();
foreach (var col in physBoneColliders)
{
ComponentUtility.CopyComponent(col);
VRCPhysBoneCollider target = targetObject.transform.Find(col.gameObject.GetFullPath()).gameObject.AddComponent<VRCPhysBoneCollider>();
ComponentUtility.PasteComponentValues(target);
if (col.rootTransform) target.rootTransform = targetObject.transform.Find(col.rootTransform.GetFullPath());
col_count++;
}
messages.Add("Phys Bone Coliderをコピー(" + col_count + "件)");
}
if ((avatarMode == 1 && physBones) || (avatarMode == 0 && (exclusionBoneName.Count > 0 || physBones_other)))
{
int bone_count = 0;
Dictionary<string, List<VRCPhysBone>> targetBoneDict = new Dictionary<string, List<VRCPhysBone>>();
VRCPhysBone[] physBones;
physBones = targetObject.GetComponentsInChildren<VRCPhysBone>();
foreach (var phy in physBones)
{
if (avatarMode == 0)
{
if (phy.rootTransform != null && checkExclutionPhysBoneContain(phy.rootTransform.name))
{
continue;
}
else if (phy.rootTransform != null && !checkPhysBoneContain(phy.rootTransform.name) && !physBones_other)
{
continue;
}
}
UnityEngine.Object.DestroyImmediate(phy);
}
physBones = cloneGameObject.GetComponentsInChildren<VRCPhysBone>();
foreach (var phy in physBones)
{
if (avatarMode == 0)
{
if (checkExclutionPhysBoneContain(phy.rootTransform.name))
{
continue;
}
else if (!checkPhysBoneContain(phy.rootTransform.name) && !physBones_other)
{
continue;
}
}
ComponentUtility.CopyComponent(phy);
GameObject targetObj = targetObject.transform.Find(phy.gameObject.GetFullPath()).gameObject;
ComponentUtility.PasteComponentAsNew(targetObj);
VRCPhysBone[] p = targetObj.GetComponents<VRCPhysBone>();
VRCPhysBone newPhysBone = p[p.Length - 1];
newPhysBone.rootTransform = targetObject.transform.Find(newPhysBone.rootTransform.gameObject.GetFullPath()).gameObject.transform;
List<VRCPhysBoneColliderBase> new_coliders = new List<VRCPhysBoneColliderBase>();
foreach (var tarcol in newPhysBone.colliders)
{
if (tarcol != null)
{
new_coliders.Add(targetObject.transform.Find(tarcol.gameObject.GetFullPath()).gameObject.GetComponent<VRCPhysBoneColliderBase>());
}
}
List<Transform> new_ignoreTransforms = new List<Transform>();
foreach (var tarexc in newPhysBone.ignoreTransforms)
{
if (tarexc != null)
{
new_ignoreTransforms.Add(tarexc);
}
}
newPhysBone.colliders = new_coliders;
newPhysBone.ignoreTransforms = new_ignoreTransforms;
bone_count++;
}
if (bone_count > 0)
{
messages.Add("Phys Boneをコピー(" + bone_count + "件)");
}
if (physBoneColiders && physBoneColliders_array != null && physBoneColliders_array.Length > 0)
{
VRCPhysBone[] allPhysBone = targetObject.GetComponentsInChildren<VRCPhysBone>();
List<Dictionary<string, object>> allBoneList = new List<Dictionary<string, object>>();
foreach (var bone in allPhysBone)
{
Dictionary<string, object> dict = new Dictionary<string, object>();
dict.Add("bone", bone);
if (bone.rootTransform != null)
{
dict.Add("rootTransform", (object)bone.rootTransform.gameObject.GetFullPath());
}
else
{
dict.Add("rootTransform", null);
}
List<string> colliders_list = new List<string>();
foreach (var col in bone.colliders)
{
colliders_list.Add(col.gameObject.GetFullPath());
}
dict.Add("colliders", colliders_list);
List<string> ignoreTransforms_list = new List<string>();
foreach (var exc in bone.ignoreTransforms)
{
ignoreTransforms_list.Add(exc.gameObject.GetFullPath());
}
dict.Add("ignoreTransforms", ignoreTransforms_list);
allBoneList.Add(dict);
}
foreach (var col in physBoneColliders_array)
{
UnityEngine.Object.DestroyImmediate(col);
}
foreach (var bonedic in allBoneList)
{
VRCPhysBone bone = (VRCPhysBone)bonedic["bone"];
string new_rootTransform = (string)bonedic["rootTransform"];
bone.rootTransform = targetObject.transform.Find(new_rootTransform).gameObject.transform;
List<VRCPhysBoneColliderBase> new_coliders = new List<VRCPhysBoneColliderBase>();
List<string> new_coliders_string = (List<string>)bonedic["colliders"];
foreach (var tarcol_string in new_coliders_string)
{
if (tarcol_string != null)
{
new_coliders.Add(targetObject.transform.Find(tarcol_string).gameObject.GetComponent<VRCPhysBoneColliderBase>());
}
}
List<Transform> new_ignoreTransforms = new List<Transform>();
List<string> new_ignoreTransforms_string = (List<string>)bonedic["ignoreTransforms"];
foreach (var tarexc_string in new_ignoreTransforms_string)
{
if (tarexc_string != null)
{
new_ignoreTransforms.Add(targetObject.transform.Find(tarexc_string));
}
}
bone.colliders = new_coliders;
bone.ignoreTransforms = new_ignoreTransforms;
}
}
}
if (aimConstraint || lookAtConstraint || parentConstraint || positionConstraint || rotationConstraint || scaleConstraint)
{
int constraints_count = 0;
void setConstraint<T>(T[] constraints) where T : Behaviour, IConstraint
{
foreach (T constraint in constraints)
{
List<ConstraintSource> dest = new List<ConstraintSource>();
List<ConstraintSource> from = new List<ConstraintSource>();
constraint.GetSources(from);
foreach (ConstraintSource f in from)
{
ConstraintSource d = new ConstraintSource();
if (f.sourceTransform != null)
{
d.sourceTransform = gameObject.transform.Find(f.sourceTransform.gameObject.GetFullPath());
}
d.weight = f.weight;
dest.Add(d);
}
Transform target = targetObject.transform.Find(constraint.gameObject.GetFullPath());
target.GetComponent<T>().SetSources(dest);
constraints_count++;
}
}
bool includeInactive = true;
if (aimConstraint) setConstraint(cloneGameObject.GetComponentsInChildren<AimConstraint>(includeInactive));
if (lookAtConstraint) setConstraint(cloneGameObject.GetComponentsInChildren<LookAtConstraint>(includeInactive));
if (parentConstraint) setConstraint(cloneGameObject.GetComponentsInChildren<ParentConstraint>(includeInactive));
if (positionConstraint) setConstraint(cloneGameObject.GetComponentsInChildren<PositionConstraint>(includeInactive));
if (rotationConstraint) setConstraint(cloneGameObject.GetComponentsInChildren<RotationConstraint>(includeInactive));
if (scaleConstraint) setConstraint(cloneGameObject.GetComponentsInChildren<ScaleConstraint>(includeInactive));
messages.Add("Constraintsをコピー(" + constraints_count + "件)");
}
UnityEngine.Object.DestroyImmediate(cloneGameObject);
}
public void Log()
{
Debug.Log("viewX : " + viewX);
Debug.Log("viewY : " + viewY);
Debug.Log("viewZ : " + viewZ);
}
private bool checkExclutionPhysBoneContain(string str)
{
bool rtn = false;
foreach (var name in exclusionBoneName)
{
rtn = rtn || str.Contains(name);
}
return rtn;
}
private bool checkPhysBoneContain(string str)
{
bool rtn = false;
foreach (var name in boneName)
{
rtn = rtn || str.Contains(name);
}
return rtn;
}
private bool ShouldCopyVRCAvatarDescripter()
{
return viewPosition || eyeMovements || rotationStates || baseAnimationLayers ||
specialAnimationLayers || expressionsMenu || expressionParameters;
}
}
public static class Extensions
{
public static string GetFullPath(this GameObject obj)
{
return GetFullPath(obj.transform);
}
public static string GetFullPath(this Transform t)
{
string path = t.name;
var parent = t.parent;
while (parent)
{
if (parent.parent == null)
{
return path;
}
path = $"{parent.name}/{path}";
parent = parent.parent;
}
return path;
}
}
}