scripts
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ProBuilder2.Common
|
||||
{
|
||||
// Token: 0x02000002 RID: 2
|
||||
public static class pbTransformUtil
|
||||
{
|
||||
// Token: 0x06000001 RID: 1 RVA: 0x00002050 File Offset: 0x00000450
|
||||
public static void UnparentChildren(Transform t)
|
||||
{
|
||||
Transform[] array = new Transform[t.childCount];
|
||||
for (int i = 0; i < t.childCount; i++)
|
||||
{
|
||||
Transform child = t.GetChild(i);
|
||||
array[i] = child;
|
||||
child.SetParent(null, true);
|
||||
}
|
||||
pbTransformUtil._childrenStack.Add(t, array);
|
||||
}
|
||||
|
||||
// Token: 0x06000002 RID: 2 RVA: 0x000020A0 File Offset: 0x000004A0
|
||||
public static void ReparentChildren(Transform t)
|
||||
{
|
||||
Transform[] array;
|
||||
if (pbTransformUtil._childrenStack.TryGetValue(t, out array))
|
||||
{
|
||||
foreach (Transform transform in array)
|
||||
{
|
||||
transform.SetParent(t, true);
|
||||
}
|
||||
pbTransformUtil._childrenStack.Remove(t);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04000001 RID: 1
|
||||
private static Dictionary<Transform, Transform[]> _childrenStack = new Dictionary<Transform, Transform[]>();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user