Esempio n. 1
0
        public async Task <ExportModelContainer> PrepareForExportAsync(
            IEnumerable <SceneObject> objectsToExport,
            ExportOptions exportOptions)
        {
            objectsToExport.EnsureNotNull(nameof(objectsToExport));
            objectsToExport.EnsureMoreThanZeroElements(nameof(objectsToExport));

            // Create result object container
            var result = new ExportModelContainer();

            // Fill export container beside rendering
            //  (there it is ensured that no one changes the scene)
            await this.PerformBeforeUpdateAsync(() =>
            {
                // First step: Register all objects which we want to export
                foreach (var actObject in objectsToExport)
                {
                    actObject.EnsureObjectOfScene(this, nameof(objectsToExport));

                    if (!actObject.IsExportable)
                    {
                        continue;
                    }

                    result.RegisterOriginalObject(actObject);
                }

                // Second step: Store all needed data into the container
                foreach (var actObject in objectsToExport)
                {
                    if (!actObject.IsExportable)
                    {
                        continue;
                    }

                    actObject.PrepareForExport(result, exportOptions);
                }
            });

            // Return the container
            return(result);
        }
Esempio n. 2
0
 /// <summary>
 /// This methode stores all data related to this object into the given <see cref="ExportModelContainer"/>.
 /// </summary>
 /// <param name="modelContainer">The target container.</param>
 /// <param name="exportOptions">Options for export.</param>
 internal void PrepareForExport(ExportModelContainer modelContainer, ExportOptions exportOptions)
 {
     this.PrepareForExportInternal(modelContainer, exportOptions);
 }
Esempio n. 3
0
 /// <summary>
 /// This methode stores all data related to this object into the given <see cref="ExportModelContainer"/>.
 /// </summary>
 /// <param name="modelContainer">The target container.</param>
 /// <param name="exportOptions">Options for export.</param>
 protected virtual void PrepareForExportInternal(
     ExportModelContainer modelContainer,
     ExportOptions exportOptions)
 {
 }