2.1. Overview

Users often wish to load and save data (usually-but-not-necessarily mesh data) using file formats specific to other applications. This is commonly referred to as "importing" and "exporting" data. K-3D provides four types of plugins related to the task:

Importers and Exporters work to load and save entire documents (or subsets of documents) in a single pass. As an example, when you save a K-3D document using K-3D’s native .k3d file format, you are using the K3DDocumentExporter plugin. When you reload the document from disk, you are using the K3DDocumentImporter plugin.

Readers and Writers are individual nodes that become part of a document and the . A Reader is a data source, and a Writer is a data sink. Once a Reader or Writer is created and hooked into the pipeline, you can modify its properties (such as pointing it to a different data file) and the pipeline will automatically update with the new data.

Note the dualities among the different plugin types. An Importer 'creates' nodes based on the contents of an external file, while a Reader 'is-a' node that reads data from an external file. An exporter 'copies' nodes to an external file, whereas a Writer 'is-a' node that writes data to an external file. Stated differently: an Importer copies data from an external file into your document, so that the data becomes part of the document and is stored and loaded along with the rest of its contents. A Reader "references" data in an external file, loading it into memory when needed, but the data remains external to the document.

Understanding the distinctions among the external file plugin types is important because there may be more than one type implemented for a given file format. In this case, you will have to choose the correct plugin for your needs. As an example, file format "foo" might eventually have both "FooReader" and "FooDocumentImporter" plugins.