RenderContentSerializer

References
public abstract class RenderContentSerializer
Used 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
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

CanRead

#Since v5.7
public bool CanRead { get; }
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

#Since v5.7
public bool CanWrite { get; }
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.

ContentKind

#Since v7.0
public RenderContentKind ContentKind { get; }
Kind of content created when importing or exporting this file type - ie, Material, Texture or Environment

ContentType

#Since v5.7
public RenderContentKind ContentType { get; }
obsoleteUse ContentKind
Kind of content created when importing or exporting this file type. Obsolete - use ContentKind

EnglishDescription

#Since v5.7
public abstract string EnglishDescription { get; }
English string describing this plug-in

FileExtension

#Since v5.7
public string FileExtension { get; }
File extension associated with this serialize object

LocalDescription

#Since v5.7
public virtual string LocalDescription { get; }
Localized plug-in description

Methods

CanLoadMultiple

#Since v7.0
public virtual bool CanLoadMultiple()
If true the plug-in is capable of loading multiple contents.

LoadMultiple

#Since v7.0
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.
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.

Read

#Since v5.7
public abstract RenderContent Read(string pathToFile)
Called to when importing a file, file should be parsed and converted to a valid RenderContent object.
pathToFile (string)Full path of the file to load.
Returns a valid RenderContent object such as RenderMaterial if the file was successfully parsed otherwise returns null.

RegisterSerializer

#Since v6.0
public bool RegisterSerializer(Guid id)
Register the RenderContentSerializer
id (Guid)Plug-in id

ReportContentAndFile

#Since v7.0
public virtual void ReportContentAndFile(RenderContent renderContent, string pathToFile, int flags)
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.
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.

ReportDeferredContentAndFile

#Since v7.0
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. */
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.

Write

#Since v5.7
public abstract bool Write(string pathToFile, RenderContent renderContent, CreatePreviewEventArgs previewArgs)
Called to save a custom RenderContent object as an external file.
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.