当前位置: 首页>>代码示例>>C#>>正文


C# Transform.InitChildren方法代码示例

本文整理汇总了C#中Transform.InitChildren方法的典型用法代码示例。如果您正苦于以下问题:C# Transform.InitChildren方法的具体用法?C# Transform.InitChildren怎么用?C# Transform.InitChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Transform的用法示例。


在下文中一共展示了Transform.InitChildren方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CloneTransformTree

        public static Transform CloneTransformTree(Animator parser, Transform frame, Transform parent)
        {
            Transform trans = new Transform(parser.file);
            GameObject gameObj = new GameObject(parser.file);
            gameObj.m_Name = (string)frame.m_GameObject.instance.m_Name.Clone();
            UniqueName(parser, gameObj);
            gameObj.AddLinkedComponent(trans);

            parser.m_Avatar.instance.AddBone(parent, trans);

            trans.m_LocalRotation = frame.m_LocalRotation;
            trans.m_LocalPosition = frame.m_LocalPosition;
            trans.m_LocalScale = frame.m_LocalScale;
            CopyUnknowns(frame, trans);

            trans.InitChildren(frame.Count);
            for (int i = 0; i < frame.Count; i++)
            {
                trans.AddChild(CloneTransformTree(parser, frame[i], trans));
            }

            return trans;
        }
开发者ID:hejob,项目名称:SB3Utility,代码行数:23,代码来源:Replace.cs

示例2: CreateTransformTree

        public static Transform CreateTransformTree(Animator parser, ImportedFrame frame, Transform parent)
        {
            Transform trans = new Transform(parser.file);
            GameObject gameObj = new GameObject(parser.file);
            gameObj.m_Name = (string)frame.Name.Clone();
            UniqueName(parser, gameObj);
            gameObj.AddLinkedComponent(trans);

            parser.m_Avatar.instance.AddBone(parent, trans);

            Vector3 t, s;
            Quaternion r;
            frame.Matrix.Decompose(out s, out r, out t);
            t.X *= -1;
            Vector3 euler = FbxUtility.QuaternionToEuler(r);
            euler.Y *= -1;
            euler.Z *= -1;
            trans.m_LocalRotation = FbxUtility.EulerToQuaternion(euler);
            trans.m_LocalPosition = t;
            trans.m_LocalScale = s;

            trans.InitChildren(frame.Count);
            for (int i = 0; i < frame.Count; i++)
            {
                trans.AddChild(CreateTransformTree(parser, frame[i], trans));
            }

            return trans;
        }
开发者ID:hejob,项目名称:SB3Utility,代码行数:29,代码来源:Replace.cs

示例3: MergeFrame

        public void MergeFrame(Transform srcFrame, int destParentId)
        {
            Transform srcParent = new Transform(srcFrame.file);
            GameObject srcGameObj = new GameObject(srcFrame.file);
            srcGameObj.AddLinkedComponent(srcParent);
            srcParent.InitChildren(1);
            srcParent.AddChild(srcFrame);

            Transform destParent;
            if (destParentId < 0)
            {
                destParent = new Transform(srcFrame.file);
                GameObject destGameObj = new GameObject(srcFrame.file);
                destGameObj.AddLinkedComponent(destParent);
                destParent.InitChildren(1);
                destParent.AddChild(Parser.RootTransform);
                Parser.m_GameObject.instance.RemoveLinkedComponent(Parser);
            }
            else
            {
                destParent = Frames[destParentId];
            }

            MergeFrame(srcParent, destParent);

            if (destParentId < 0)
            {
                //Parser.RootTransform = srcParent[0];
                srcParent[0].m_GameObject.instance.AddLinkedComponent(Parser);
                srcParent.RemoveChild(0);
                destParent.m_GameObject.instance.RemoveLinkedComponent(destParent);
                srcFrame.file.RemoveSubfile(destParent.m_GameObject.instance);
                srcFrame.file.RemoveSubfile(destParent);
            }

            srcGameObj.RemoveLinkedComponent(srcParent);
            srcFrame.file.RemoveSubfile(srcGameObj);
            srcFrame.file.RemoveSubfile(srcParent);

            if (Parser.file.Bundle != null)
            {
                Parser.file.Bundle.RegisterForUpdate(Parser.m_GameObject.asset);
            }
            InitLists();
            Changed = true;
        }
开发者ID:hejob,项目名称:SB3Utility,代码行数:46,代码来源:AnimatorEditor.cs


注:本文中的Transform.InitChildren方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。