示例#1
0
        private void OnSceneLoaded(Scene scene, Guid sceneId)
        {
            var startTime = DateTime.UtcNow;

            // Build scene tree
            var sceneNode = SceneGraphFactory.BuildSceneTree(scene);
            var treeNode  = sceneNode.TreeNode;

            treeNode.IsLayoutLocked = true;
            treeNode.Expand(true);

            // Add to the tree
            var rootNode = Root.TreeNode;

            rootNode.IsLayoutLocked = true;
            //
            sceneNode.ParentNode = Root;
            rootNode.SortChildren();
            //
            treeNode.UnlockChildrenRecursive();
            rootNode.IsLayoutLocked = false;
            rootNode.Parent.PerformLayout();

            var endTime      = DateTime.UtcNow;
            var milliseconds = (int)(endTime - startTime).TotalMilliseconds;

            Editor.Log($"Created graph for scene \'{scene.Name}\' in {milliseconds} ms");
        }