RenderContent
Base class for all RenderContent - RenderMaterial, RenderTexture and RenderEnvironment Contents have a unique type id which is the same for all instances of the same class and an instance id which is unique for each instance.They know how to provide a shader for rendering, how to read and write their state as XML and how to create their own user interfaces. There are two flavors of content in the RDK — temporary and persistent.It is very important to understand the distinction between a temporary content instance and a persistent content instance, and the fact that a temporary instance (and all its children) can become persistent.Persistent content is registered with a document and is usually(but not always) owned by it. Temporary contents get created and deleted very often during the normal operation of the RDK.In fact, just about anything the user clicks on might result in a temporary content being created and deleted again.They are created by the content browser, the thumbnail rendering, and so on.They are ‘free floating’ and are owned by whomever created them.They do not appear in the modeless UI, they do not get saved in the 3dm file, and they can freely be deleted again after use. Contrast this with persistent contents which are attached to a document.They are always owned by RDK, appear in the modeless UI and get saved in the 3dm file. Pointers to persistent contents should never be stored by clients; you should only store their instance ids and look them up again using RenderContent.FromId. They can be deleted only after detaching them from the document. RenderContent::Create is the highest-level function for creating a content.It creates it, initializes it, adds it to the document and sends many events.It even records undo.You cannot call this method from just anywhere. It must only be called by ‘UI code’; scripts or buttons on a dialog.It results in a persistent (usually top-level) content being attached to the document and appearing in all the RDK UI elements that display contents, like the thumbnail and tree views.If you call this method and specify a parent and child-slot name, your new content will be attached to the document-resident parent as a child and the UI will be updated accordingly. The important point is that everything is temporary while the content structure is being built. Only after the whole structure is complete will the top-level parent be attached to the document making the whole structure persistent.
Inheritance Hierarchy
System.Object
Rhino.Render.RenderContent
Rhino.Render.RenderEnvironment
Rhino.Render.RenderMaterial
Rhino.Render.RenderTexture
Namespace: Rhino.Render
Assembly: RhinoCommon (in RhinoCommon.dll)
Syntax
public abstract class RenderContent : IDisposable
The RenderContent type exposes the following members.
Properties
Name
Description
Public Property
CanBeEdited
Determines if the content can be edited.
Public Property
Category
Category for this content.
Public Property
ChildSlotDisplayName
Returns the localized display name of the child slot name
Public Property
ChildSlotName
Public Property
CppPointer
Public Property
DisplayName
Display name for this content.
Public Property
Document
Obsolete.
Obsolete. Do not use. You should use DocumentOwner instead.
Public Property
DocumentAssoc
If this render content is associated with a document in any way, the document will be returned. This includes copies of render contents that were attached to a document when the copy was made. Otherwise returns null.
Public Property
DocumentOwner
If this render content is owned by a document, the document will be returned. This is the same as getting the document the render content is attached to. Otherwise returns null.
Public Property
DocumentRegistered
Obsolete.
Obsolete. Do not use. You should use DocumentOwner instead.
Public Property
Fields
Rhino.Render.Fields FieldDictionary which provides access to setting and retrieving field values.
Public Property
Filename
If the content is file based, this function can be overridden to deal with setting/getting the filename. Corresponds to IRhRdkFileBasedContent in the C++ SDK
Public Property
FilesToEmbed
A string array of full paths to files used by the content that may be embedded in .3dm files and library files (.rmtl, .renv, .rtex). The default implementation returns an empty string list. Override this to return the file name or file names used by your content. This is typically used by textures that reference files containing the texture imagery.
Public Property
FirstChild
Return First child of this content or null if none.
Public Property
GroupId
Group ID of the content
Public Property
Hidden
Gets or sets the render content’s ‘hidden’ state. This feature only works for top-level render contents because it hides the entire hierarchy. It is normally used for ‘implementation detail’ render contents. For expert use only. Hidden render contents are never shown in the UI, with the exception of the Object (or Layer) Material Properties UI which always shows whatever is assigned to the object (or layer). In the Object (or Layer) Material Properties UI, if the user drops down the list, hidden render contents are not listed. Hidden render contents, being part of the document content list, will be listed by any scripts or other code that iterates over the document render content list. It is recommended that you set IsHidden once when you create your render content and leave it on to prevent flicker or slow performance.
Public Property
Id
Instance identifier for this content.
Public Property
IsDefaultInstance
Checks if render content is default instance.
Public Property
IsHiddenByAutoDelete
Contents can be created as ‘auto-delete’ by certain commands such as ‘Picture’. These contents are automatically hidden from the user when the associated Rhino object is deleted. They are later deleted when the document is saved.
Public Property
IsLocked
Set this property to true prior to adding content to the document to lock the content browser editing UI methods. Setting this to true will keep the browser from allowing things like deleting, renaming or changing content. This is useful for custom child content that you want to be editable but persistent. Setting this after adding content to the document will cause an exception to be thrown.
Public Property
Name
Instance ‘raw’ name for this content.
Public Property
NextSibling
Return First sibling of this content or null if none.
Public Property
Notes
Notes for this content.
Public Property
Parent
Returns the top content in this parent/child chain.
Public Property
ProxyType
Gets the proxy type of the render content
Public Property
RenderHash
Render hash for the content hierarchy. It iterates over children and includes a caching mechanism which means the hash value can be retrieved quickly if it hasn’t changed. The cache is invalidated when Changed() is called. You can override the
CalculateRenderHash(UInt64)
method to provide a custom hash value.Public Property
Styles
Public Property
Tags
Tags for this content.
Public Property
TopLevel
Returns true if this content has no parent, false if it is the child of another content.
Public Property
TopLevelParent
Returns the top content in this parent/child chain.
Public Property
TypeDescription
Description for your content type. i.e., “Procedural checker pattern”
Public Property
TypeId
Type identifier for this content
Public Property
TypeName
Name for your content type. i.e., “My .net Texture”
Public Property
Xml
Methods
Name
Description
Public Method
AddAutomaticUserInterfaceSection
Add a new automatic user interface section, Field values which include prompts will be automatically added to this section.
Public Method
AddChild(RenderContent)
Obsolete.
Public Method
AddChild(RenderContent, String)
Obsolete.
Public Method
Static Member
AddPersistentRenderContent(RenderContent)
Obsolete.
Add a material, environment or texture to the internal RDK document lists as top level content. The content must have been returned from RenderContent::MakeCopy, NewContentFromType or a similar function that returns a non-document content. Obsolete - use RhinoDoc.RenderMaterials.Add or similar.
Public Method
Static Member
AddPersistentRenderContent(RhinoDoc, RenderContent)
Obsolete.
Add a material, environment or texture to the internal RDK document lists as top level content. The content must have been returned from RenderContent::MakeCopy, NewContentFromType or a similar function that returns a non-document content. Obsolete - use RhinoDoc.RenderMaterials.Add or similar.
Public Method
AddUserInterfaceSection(ICollapsibleSection)
Public Method
AddUserInterfaceSection(Type, String, Boolean, Boolean)
Obsolete.
Add a new .NET control to an content expandable tab section, the height of the createExpanded tabs client area will be the initial height of the specified control.
Public Method
BeginChange
Begins a change or batch of changes. It may also make a copy of the content state allowing
EndChange.
to send an event with the old and new contents. Calls to this method are counted; you must call EndChange() once for every call to BeginChange(). Note: If Changed() was called between the calls to BeginChange() and EndChange(), the last call to EndChange() may cause the ContentChanged event to be sent.Public Method
BeginCreateDynamicFields
Automatic Dynamic Field support. Dynamic fields are typically created in the constructor of RenderContent and they are therefore created automatically whenever the content is created. However, some advanced users require the fields to be created in response to some user action which occurs much later. This creates the problem that the fields do not exist by default and therefore cannot be loaded when the document is loaded. These methods are provided to solve that problem by making it possible to automatically create the dynamic fields on loading if they don’t already exist. Dynamic fields that have this auto-create-on-load behavior are referred to as automatic dynamic fields. Dynamic fields that do not require the advanced automatic feature can still be created by using these methods (recommended), or they can be created manually (legacy usage). You must call this before creating any dynamic fields. Calls to this method are counted; you must call EndCreateDynamicFields() once for every call to BeginCreateDynamicFields().
Public Method
BindParameterToField(String, Field, RenderContent.ChangeContexts)
Use bindings to automatically wire parameters to fields
Public Method
BindParameterToField(String, String, Field, RenderContent.ChangeContexts)
Use bindings to automatically wire parameters to fields
Protected Method
CalculateRenderHash
Obsolete.
Override this method to calculate the render hash of the state that affects how the content is rendered. Does not include children or perform any caching. Render hash values are now automatically cached by the content framework and you do not have to worry about caching. You also do not have to worry about iterating into children. This method is now only called internally by the framework, use the RenderHash property to get the current hash value.
Protected Method
CalculateRenderHash2
Public Method
ChangeChild
Obsolete.
Public Method
ChildSlotAmount
Gets the amount property for the texture in the specified child slot.
Public Method
ChildSlotNameFromParamName
A “child slot” is the specific “slot” that a child (usually a texture) occupies. This is generally the “use” of the child - in other words, the thing the child operates on. Some examples are “color”, “transparency”.
Public Method
ChildSlotOn
Gets the on-ness property for the texture in the specified child slot.
Public Method
ConvertUnits
Modify your content so that it is converted from meters into the units of the unit system. No need to call the base class when you override this, and no need to recurse into children.
Public Method
Static Member
Create(RhinoDoc, Guid)
Constructs a new content of the specified type and attaches it to a document. This function cannot be used to create temporary content that you delete after use. Content created by this function is owned by RDK and appears in the content editor. To create a temporary content which is owned by you, call RenderContentType.NewContentFromTypeId().
Public Method
Static Member
Create(RhinoDoc, Type)
Constructs a new content of the specified type and attaches it to a document. This function cannot be used to create temporary content that you delete after use. Content created by this function is owned by RDK and appears in the content editor. To create a temporary content which is owned by you, call RenderContentType.NewContentFromTypeId().
Public Method
Static Member
Create(Guid, RenderContent.ShowContentChooserFlags, RhinoDoc)
Constructs a new content of the specified type and attaches it to a document. This function cannot be used to create temporary content that you delete after use. Content created by this function is owned by RDK and appears in the content editor. To create a temporary content which is owned by you, call RenderContentType.NewContentFromTypeId().
Public Method
Static Member
Create(Type, RenderContent.ShowContentChooserFlags, RhinoDoc)
Constructs a new content of the specified type and attaches it to a document. This function cannot be used to create temporary content that you delete after use. Content created by this function is owned by RDK and appears in the content editor. To create a temporary content which is owned by you, call RenderContentType.NewContentFromTypeId().
Public Method
Static Member
Create(RhinoDoc, Guid, RenderContent, String)
Constructs a new content of the specified type and attaches it to a document. This function cannot be used to create temporary content that you delete after use. Content created by this function is owned by RDK and appears in the content editor. To create a temporary content which is owned by you, call RenderContentType.NewContentFromTypeId().
Public Method
Static Member
Create(RhinoDoc, Type, RenderContent, String)
Constructs a new content of the specified type and attaches it to a document. This function cannot be used to create temporary content that you delete after use. Content created by this function is owned by RDK and appears in the content editor. To create a temporary content which is owned by you, call RenderContentType.NewContentFromTypeId().
Public Method
Static Member
Create(Guid, RenderContent, String, RenderContent.ShowContentChooserFlags, RhinoDoc)
Constructs a new content of the specified type and attaches it to a document. This function cannot be used to create temporary content that you delete after use. Content created by this function is owned by RDK and appears in the content editor. To create a temporary content which is owned by you, call RenderContentType.NewContentFromTypeId().
Public Method
Static Member
Create(Type, RenderContent, String, RenderContent.ShowContentChooserFlags, RhinoDoc)
Constructs a new content of the specified type and attaches it to a document. This function cannot be used to create temporary content that you delete after use. Content created by this function is owned by RDK and appears in the content editor. To create a temporary content which is owned by you, call RenderContentType.NewContentFromTypeId().
Public Method
CreateDynamicField
Create a dynamic field with an initial value and min and max limits.
Public Method
DeleteAllChildren
Public Method
DeleteChild
Public Method
Dispose.
Releases all resources used by the RenderContent
Protected Method
Dispose(Boolean)
Dispose
Public Method
DynamicIcon
Public Method
Edit
This method allows a render content hierarchy to be edited using a modal (AKA ‘pop-up’) editor. If the original render content is in a document, it will remain there, and the edited one will be ‘free-floating’. Therefore it is the caller’s responsibility to do any replacement in the document if required. The returned new content will be owned by the caller.
Public Method
EndChange
Ends a change or batch of changes. Calls to this method are counted; you must call this method once for every call to
BeginChange(RenderContent.ChangeContexts)
. Note: IfBeginChange(RenderContent.ChangeContexts)
was called with ChangeContexts.UI, ChangeContexts.Program, ChangeContexts.Drop or ChangeContexts.UI.Tree and Changed() was called between the calls toBeginChange(RenderContent.ChangeContexts)
and EndChange(), the last call to EndChange() will raise theContentChanged
event.Public Method
EndCreateDynamicFields
You must call this after creating dynamic fields. Calls to this method are counted; you must call BeginCreateDynamicFields() once for every call to EndCreateDynamicFields().
Public Method
Equals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public Method
Factory
Protected Method
Finalize
Finalizer
(Overrides Object.Finalize..)
Public Method
FindChild
Public Method
ForDisplay
**** This method is for proxies and will be marked obsolete in the future **** The only place a single proxy can be displayed is in the New Content Control main thumbnail. All other attempts to use a single proxy in a UI require it to be replaced with the corresponding multi proxy. Single proxies override this to find the corresponding multi proxy.
Public Method
Static Member
FromId
Search for a content object based on its Id
Public Method
Static Member
FromXml(String)
Obsolete.
Public Method
Static Member
FromXml(String, RhinoDoc)
Creates a new content from the XML data. The resulting content will not be attached to the document.
Public Method
Static Member
GenerateQuickContentPreview
Generate a quick render content preview
Public Method
Static Member
GenerateRenderContentPreview
Generate a render content preview
Public Method
GetChildSlotParameter
Extra requirements are a way of specifying extra functionality on parameters in the automatic UI. Override this function to specify additional functionality for automatic UI sections or the texture summary. See IAutoUIExtraRequirements.h in the C++ RDK SDK for string definitions for the parameter names. Call the base class from your override if you do not support the extra requirement parameter. Please do not call this function. It is only retained for backward compatibility. You should instead call GetExtraRequirementParameter().
Public Method
GetEmbeddedFilesList
Public Method
GetExtraRequirementParameter
Extra requirements are a way of specifying extra functionality on parameters in the automatic UI. See IAutoUIExtraRequirements.h in the C++ RDK SDK for string definitions for the parameter names.
Public Method
GetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public Method
GetParameter
Query the content instance for the value of a given named parameter. If you do not support this parameter, call the base class.
Public Method
GetType
Gets the Type of the current instance.
(Inherited from Object.)
Public Method
GetUiHash
This allows a content to have more than one UI for the same content type.
Public Method
GetUnderlyingInstances
Public Method
Icon
Public Method
Initialize
Obsolete.
Public Method
IsCompatible
Public Method
IsContentTypeAcceptableAsChild
Public Method
IsFactoryProductAcceptableAsChild(ContentFactory, String)
Public Method
IsFactoryProductAcceptableAsChild(Guid, String, String)
Override this method to restrict the type of acceptable child content. The default implementation of this method returns true if the factory kind is ‘texture’.
Public Method
IsReference
Query whether or not the content or any of its ancestors is a reference content.
Public Method
IsRenderHashCached
Obsolete.
This method is deprecated and no longer called. For more information see
CalculateRenderHash(UInt64)
Public Method
Static Member
LoadFromFile
Loads content from a library file. Does not add the content to the document. Use RhinoDoc.RenderMaterials.Add or similar.
Public Method
MakeCopy
Create a copy of the render content. All content is the same, except for the instance Id.
Public Method
MakeGroupInstance
Create an ‘instance’ of the content hierarchy and group the new hierarchy with this hierarchy. If the instance is subsequently attached to the same document, the state of all members of the group will be kept synchronized. With the exception of the instance ids, all state is exactly preserved in the new instance hierarchy. \note The grouping will have no effect until the new instance is attached to the same document.
Public Method
MatchData
Implement to transfer data from another content to this content during creation.
Protected Method
MemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected Method
ModifyRenderContentStyles
ModifyRenderContentStyles
Public Method
NewPreviewSceneServer
Gets the PreviewSceneServer of the content
Protected Method
OnAddUserInterfaceSections
Override to provide UI sections to display in the editor.
Protected Method
OnGetDefaultsInteractive
Override this method to prompt user for information necessary to create a new content object. For example, if you are created a textured material you may prompt the user for a bitmap file name prior to creating the textured material.
Protected Method
OnMakeCopy
Override this function to supplement the standard copying behavour for your RenderContent.
Public Method
OpenInEditor
Call this method to open the content in the relevant thumbnail editor and select it for editing by the user. The content must be in the document or the call will fail.
Public Method
OpenInModalEditor
Obsolete.
Call this method to open the content in the a modal version of the editor. The content must be in the document or the call will fail.
Public Method
ParamNameFromChildSlotName
A “child slot” is the specific “slot” that a child (usually a texture) occupies. This is generally the “use” of the child - in other words, the thing the child operates on. Some examples are “color”, “transparency”.
Public Method
Static Member
RegisterContent(PlugIn)
Call RegisterContent in your plug-in’s OnLoad function in order to register all of the custom RenderContent classes in your assembly.
Public Method
Static Member
RegisterContent(Assembly, Guid)
Call RegisterContent in your plug-in’s OnLoad function in order to register all of the custom RenderContent classes in your assembly.
Public Method
RenderHashExclude(CrcRenderHashFlags, String)
As RenderHash, but allows you to specify flags and exclude specific parameters.
Public Method
RenderHashExclude(TextureRenderHashFlags, String)
This method is deprecated in favor of the one that takes CrcRenderHashFlags.
Public Method
RenderHashExclude(CrcRenderHashFlags, String, LinearWorkflow)
As RenderHash, but allows you to specify flags and exclude specific parameters. Use this version of the function to calculate a render hash when you have the linear workflow information and you are not running on the main thread. Access to LinearWorkflow data requires document access. CrcRenderHashFlags.ExcludeLinearWorkflow must be specified.
Public Method
Replace
Public Method
SaveToFile
Saves content to a file - RMTL, RENV or RTEX.
Public Method
SetChild(RenderContent, String)
Set another content as a child of this content. This content may or may not be attached to a document. If this content already has a child with the specified child slot name, that child will be deleted. If this content is not attached to a document, the child will be added without sending any events. If this content is attached to a document, the necessary events will be sent to update the UI. Note: Do not call this method to add children in your constructor. If you want to add default children, you should override Initialize() and add them there.
Public Method
SetChild(RenderContent, String, RenderContent.ChangeContexts)
Obsolete.
Set another content as a child of this content. This content may or may not be attached to a document. If this content already has a child with the specified child slot name, that child will be deleted. If this content is not attached to a document, the child will be added without sending any events. If this content is attached to a document, the necessary events will be sent to update the UI. Note: Do not call this method to add children in your constructor. If you want to add default children, you should override Initialize() and add them there.
Public Method
SetChildSlotAmount
Sets the amount property for the texture in the specified child slot.
Public Method
SetChildSlotOn
Sets the on-ness property for the texture in the specified child slot.
Public Method
SetChildSlotParameter
Extra requirements are a way of specifying extra functionality on parameters in the automatic UI. Override this function to support values being set from automatic UI sections or the texture summary. See IAutoUIExtraRequirements.h in the C++ RDK SDK for string definitions for the parameter names. Call the base class from your override if you do not support the extra requirement parameter. Please do not call this function. It is only retained for backward compatibility. You should instead call SetExtraRequirementParameter().
Public Method
SetExtraRequirementParameter
Extra requirements are a way of specifying extra functionality on parameters in the automatic UI. See IAutoUIExtraRequirements.h in the C++ RDK SDK for string definitions for the parameter names.
Public Method
SetIsRenderHashRecursive
By default, RenderHash recurses into children when computing the render hash. However, some applications may require children to be excluded from the render hash calculation. Call this method to enable or disable recursing into children. see
RenderHash
Public Method
SetName
Set instance name for this content
Public Method
SetParameter(String, Object)
Set the named parameter value for this content instance. If you do not support this parameter, call the base class.
Public Method
SetParameter(String, Object, RenderContent.ChangeContexts)
Obsolete.
Set the named parameter value for this content instance. If you do not support this parameter, call the base class.
Public Method
SetRenderHash
Obsolete.
This method is deprecated and no longer called. For more information see
CalculateRenderHash(UInt64)
Public Method
SmartUngroupRecursive
Remove this content and all its children from any instance groups they may be a member of. If any content in the same document is left alone in the group, that content is also ungrouped. Records undo and sends events OnContentChanged and OnContentGroupIdChanged. \note This method is designed to be called from a content UI and is intended for RDK internal use but may be used as an expert user override.
Public Method
ToString
Returns a string that represents the current object.
(Inherited from Object.)
Public Method
Ungroup
Remove this content from any instance group it may be a member of. Does not record undo but does send the OnContentGroupIdChanged event.
Public Method
UngroupRecursive
Remove this content and all its children from any instance groups they may be a member of. Does not record undo but does send the OnContentGroupIdChanged event.
Public Method
Uninitialize
Obsolete.
Public Method
UseCount
UseCount returns how many times the content is used
Public Method
VirtualIcon
Icon to display in the content browser, this bitmap needs to be valid for the life of this content object, the content object that returns the bitmap is responsible for disposing of the bitmap.
Events
Name
Description
Public Event
Static Member
ContentAdded
Used to monitor render content addition to the document.
Public Event
Static Member
ContentChanged
Used to monitor render content modifications.
Public Event
Static Member
ContentDeleted
Used to monitor render content deletion from the document.
Public Event
Static Member
ContentDeleting
Used to monitor render content deletion from the document.
Public Event
Static Member
ContentFieldChanged
This event is raised when a field value is modified.
Public Event
Static Member
ContentRenamed
Used to monitor render content renaming in the document.
Public Event
Static Member
ContentReplaced
Used to monitor render content replacing in the document.
Public Event
Static Member
ContentReplacing
Used to monitor render content replacing in the document.
Public Event
Static Member
ContentUpdatePreview
Used to monitor render content preview updates.
Public Event
Static Member
CurrentEnvironmentChanged
Event fired when changes to current environments have been made. This will be one of Background, Reflection or Skylighting Since 6.11
Public Event
Static Member
PreviewRendered
This event is raised when a preview has been rendered