コード例 #1
0
 internal TransformObject([NotNull] string name, [NotNull] RawTransform transform)
 {
     Name      = name;
     Transform = transform;
     Children  = Array.Empty <TransformObject>();
     ChildList = new List <TransformObject>();
 }
コード例 #2
0
        internal PrettySkeletonPose([NotNull] SkeletonPose pose)
        {
            var transformCount = pose.m_X.Length;
            var transforms     = new RawTransform[transformCount];

            for (var i = 0; i < transformCount; i += 1)
            {
                var t = new RawTransform(pose.m_X[i]);
                transforms[i] = t;
            }

            Transforms = transforms;
        }
コード例 #3
0
        private static void BuildHierarchy([NotNull] GameObject root, [NotNull] SerializedObjectsLookup serializedObjectsLookup, [NotNull] Dictionary <long, TransformObject> objObjMap)
        {
            if (objObjMap.ContainsKey(root.m_PathID))
            {
                return;
            }

            var transform       = new RawTransform(root.m_Transform);
            var transformObject = new TransformObject(root.m_Name, transform);

            objObjMap.Add(root.m_PathID, transformObject);

            {
                var childTransforms = root.m_Transform.m_Children;

                if (childTransforms.Length > 0)
                {
                    var childList = transformObject.ChildList;
                    Debug.Assert(childList != null, nameof(childList) + " != null");

                    foreach (var childTransform in childTransforms)
                    {
                        Debug.Assert(childTransform != null, nameof(childTransform) + " != null");

                        var childGameObject = serializedObjectsLookup.Find <GameObject>(t => t.m_Transform.m_PathID == childTransform.m_PathID);
                        Debug.Assert(childGameObject != null, nameof(childGameObject) + " != null");

                        BuildHierarchy(childGameObject, serializedObjectsLookup, objObjMap);

                        childList.Add(objObjMap[childGameObject.m_PathID]);
                    }
                }
            }

            {
                var parentTransform = root.m_Transform.m_Father;

                if (!parentTransform.IsNull)
                {
                    var parentGameObject = serializedObjectsLookup.Find <GameObject>(t => t.m_Transform.m_PathID == parentTransform.m_PathID);
                    Debug.Assert(parentGameObject != null, nameof(parentGameObject) + " != null");

                    BuildHierarchy(parentGameObject, serializedObjectsLookup, objObjMap);

                    transformObject.Parent = objObjMap[parentGameObject.m_PathID];
                }
            }
        }