예제 #1
0
파일: Imported.cs 프로젝트: kkdevs/sb3u
        public static ImportedMesh FindMesh(ImportedFrame frame, List <ImportedMesh> importedMeshList)
        {
            StringBuilder sb = new StringBuilder();
            string        framePath;
            ImportedFrame root = frame;

            while (root.Parent != null)
            {
                sb.Insert(0, root.Name).Insert(0, '/');
                root = root.Parent;
            }
            if (sb.Length > 0)
            {
                sb.Remove(0, 1);
                framePath = sb.ToString();
            }
            else
            {
                framePath = frame.Name;
            }

            foreach (ImportedMesh mesh in importedMeshList)
            {
                if (mesh.Name == framePath)
                {
                    return(mesh);
                }
            }

            return(null);
        }
예제 #2
0
파일: Imported.cs 프로젝트: kkdevs/sb3u
        public static ImportedFrame FindFrame(String name, ImportedFrame root)
        {
            String[]      path  = name.Split('/');
            ImportedFrame frame = root;
            bool          found = false;

            for (int i = 0; i < path.Length; i++)
            {
                found = false;
                for (int j = 0; j < frame.Count; j++)
                {
                    if (frame[j].Name == path[i])
                    {
                        frame = frame[j];
                        found = true;
                        break;
                    }
                }
                if (!found)
                {
                    Report.ReportLog("Wrong path= " + name + ". Child " + path[i] + " not found.");
                    return(null);
                }
            }
            return(found ? frame : root.Name == name ? root : null);
        }
예제 #3
0
        void InitFrames(ImportedFrame frame)
        {
            Frames.Add(frame);

            foreach (var child in frame)
            {
                InitFrames(child);
            }
        }
예제 #4
0
        public void MergeFrame(ImportedFrame srcFrame, int destParentId, int meshMatOffset)
        {
            xxFrame newFrame = xx.CreateFrame(srcFrame);

            xx.CopyOrCreateUnknowns(newFrame, Parser.Frame, Parser.Format);
            MeshMatOffset(newFrame, meshMatOffset);

            MergeFrame(newFrame, destParentId);
        }
예제 #5
0
        public static Matrix WorldTransform(ImportedFrame frame)
        {
            Matrix world = frame.Matrix;

            while (frame.Parent != null)
            {
                frame = frame.Parent;
                world = world * frame.Matrix;
            }
            return(world);
        }
예제 #6
0
        private void BuildTree(string editorVar, ImportedFrame frame, TreeNode parent, ImportedEditor editor)
        {
            TreeNode node = new TreeNode(frame.Name);

            node.Checked = true;
            node.Tag     = new DragSource(editorVar, typeof(ImportedFrame), editor.Frames.IndexOf(frame));
            this.treeView.AddChild(parent, node);

            foreach (var child in frame)
            {
                BuildTree(editorVar, child, node, editor);
            }
        }
예제 #7
0
파일: xxReplace.cs 프로젝트: kkdevs/sb3u
        public static xxFrame CreateFrame(ImportedFrame frame)
        {
            xxFrame xxFrame = new xxFrame();

            xxFrame.Matrix = frame.Matrix;
            xxFrame.Bounds = new BoundingBox();
            xxFrame.Name   = frame.Name;

            xxFrame.InitChildren(frame.Count);
            for (int i = 0; i < frame.Count; i++)
            {
                xxFrame.AddChild(CreateFrame(frame[i]));
            }

            return(xxFrame);
        }
예제 #8
0
        public static ImportedFrame FindFrame(String name, ImportedFrame root)
        {
            ImportedFrame frame = root;

            if ((frame != null) && (frame.Name == name))
            {
                return(frame);
            }

            for (int i = 0; i < root.Count; i++)
            {
                if ((frame = FindFrame(name, root[i])) != null)
                {
                    return(frame);
                }
            }

            return(null);
        }
예제 #9
0
        public static ImportedMesh FindMesh(ImportedFrame frame, List <ImportedMesh> importedMeshList)
        {
            string        framePath = frame.Name;
            ImportedFrame root      = frame;

            while (root.Parent != null)
            {
                root      = root.Parent;
                framePath = root.Name + "/" + framePath;
            }

            foreach (ImportedMesh mesh in importedMeshList)
            {
                if (mesh.Name == framePath)
                {
                    return(mesh);
                }
            }

            return(null);
        }