RenderContentSerializer
ReferencesUsed to import and export custom render content such as materials, environments and textures. You must override RenderPlugIn.RenderContentSerializers() and return an array of derived RenderContentSerializer class types to add to the content browsers.
Constructors
RenderContentSerializer
#protected RenderContentSerializer(string fileExtension, RenderContentKind contentKind, bool canRead, bool canWrite)
Protected constructor to be called from derived class
Parameters:
| fileExtension (string) | File extension associated with this serialize object |
| contentKind (RenderContentKind) | Kind of content created when importing or exporting this file type. |
| canRead (bool) | If true then the file type can be imported and will be included in the file open box when importing the specified render content kind. |
| canWrite (bool) | If true then the file type can be exported and will be included in the file save box when exporting the specified render content kind. |
Properties
If true then the file type can be imported and will be included in the file open box when importing the specified render content kind.
If true then the file type can be exported and will be included in the file save box when exporting the specified render content kind.
Kind of content created when importing or exporting this file type - ie, Material, Texture or Environment
obsoleteUse ContentKind
Kind of content created when importing or exporting this file type. Obsolete - use ContentKind
English string describing this plug-in
File extension associated with this serialize object
Methods
If true the plug-in is capable of loading multiple contents.
public virtual bool LoadMultiple(RhinoDoc doc, IEnumerable<string> fileNames, RenderContentKind contentKind, LoadMultipleFlags flags)
Create any number of new render contents loaded from any number of files.
Parameters:
| doc (RhinoDoc) | Rhino document |
| fileNames (IEnumerable<string>) | A list of filenames to load from. Each file can contain any number of render contents. |
| contentKind (RenderContentKind) | Only used by I/O plug-ins that support multiple kinds. It tells the plug-in which content kind to create. If the plug-in only supports a single content kind, it can ignore this parameter. |
| flags (RenderContentSerializer.LoadMultipleFlags) | A set of flags from the enum above. |
Called to when importing a file, file should be parsed and converted to a valid RenderContent object.
Parameters:
| pathToFile (string) | Full path of the file to load. |
Returns: Returns a valid RenderContent object such as RenderMaterial if the file was successfully parsed otherwise returns null.
Register the RenderContentSerializer
Parameters:
| id (Guid) | Plug-in id |
This is called from your implementation of LoadMultiple() to add a content and the file it was loaded from when the LoadMultipleFlags.Preload flag is NOT set. See LoadMultiple() for an explanation of this method's use.
Parameters:
| renderContent (RenderContent) | Render content that was loaded from the file. |
| pathToFile (string) | Full path of the file that the render content was loaded from. |
| flags (int) | Flags for future use; should be passed as zero. |
public virtual void ReportDeferredContentAndFile(RenderContent renderContent, string pathToFile, int flags)
This is called from your implementation of LoadMultiple() to add a 'deferred' content and the file it will be loaded from when the LoadMultipleFlags.Preload flag is set. See LoadMultiple() for an explanation of this method's use. \param c is the deferred content. \param wszFullPath is the full path to the file that 'c' will be loaded from. \param flags is reserved for future use; you should pass zero. \param pReserved is reserved for future use; you should pass nullptr. */
Parameters:
| renderContent (RenderContent) | Deferred render content - represents all contents that will be loaded from the file. |
| pathToFile (string) | Full path of the file that render contents will be loaded from. |
| flags (int) | Flags for future use; should be passed as zero. |
public abstract bool Write(string pathToFile, RenderContent renderContent, CreatePreviewEventArgs previewArgs)
Called to save a custom RenderContent object as an external file.
Parameters:
| pathToFile (string) | Full path of file to write |
| renderContent (RenderContent) | Render content to save |
| previewArgs (CreatePreviewEventArgs) | Parameters used to generate a preview image which may be embedded in the exported file. |