Ejemplo n.º 1
0
        /// <summary>
        /// Creates new editor scene data.
        /// </summary>
        /// <param name="root">Root object of the scene to create editor scene data for.</param>
        /// <returns>New editor scene data object, initialized with the hierarchy of the provided scene.</returns>
        public static EditorSceneData FromScene(SceneObject root)
        {
            EditorSceneData output = new EditorSceneData();

            output.Root = EditorSceneObject.FromSceneObject(root);

            return(output);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Updates the editor scene object hierarchy from the current scene hierarchy.
        /// </summary>
        /// <param name="root">Root of the hierarchy to update from.</param>
        public void UpdateFromScene(SceneObject root)
        {
            Dictionary <UUID, EditorSceneObject> lookup = GetLookup();

            Root = EditorSceneObject.FromSceneObject(root);

            void UpdateFromOldData(EditorSceneObject so)
            {
                if (lookup.TryGetValue(so.UUID, out EditorSceneObject data))
                {
                    so.CopyData(data);
                }

                foreach (var entry in so.Children)
                {
                    UpdateFromOldData(entry);
                }
            }

            UpdateFromOldData(Root);
        }