VRay SDK for C#
Loading...
Searching...
No Matches
VRay.Util Class Reference

Various helper methods are grouped here More...

Classes

struct  OnPluginCopyCallbackHolder
 
class  PluginLink
 Describes a dependency between two plugin instances More...
 
struct  PluginLinkSerialized
 
struct  PreCreateCallbackOptions
 

Public Types

enum  ReasonsForAutoRename
 

Public Member Functions

delegate void OnCopyPluginParamsPostCreate (Plugin dstPlugin, string srcPluginName, ReasonsForAutoRename autoRenamedResult, string preCreateCallbackReturnedName)
 Called on each newly created plugin in the dstRenderer. More...
 
delegate PreCreateCallbackOptions OnCopyPluginParamsPreCreate (VRayRenderer dstRenderer, Plugin srcPlugin)
 Called on each plugin in the includeListOfPlugins and some of their successors. What can you do with the preCreateCallback? You get as arguments the dstRenderer and the srcPlugin. You will return a structure PreCreateCallbackOptions with the following fields: More...
 

Static Public Member Functions

static int CopyPlugins (VRayRenderer srcRenderer, VRayRenderer dstRenderer, IEnumerable< object > includeListOfPlugins, IEnumerable< object > excludeListOfPlugins, OnCopyPluginParamsPreCreate preCreateCallback, OnCopyPluginParamsPostCreate postCreateCallback)
 Copies some of the specified plugins in the includeListOfPlugins list of the srcRenderer and some of their successors, depending on an exludeListOfPlugins, a user-defined pre-create callback to the dstRenderer and at the end, invoking a user-defined post-create callback on the created plugins after all have been processed. REMARK: if a plugin scheduled to be visited by the preCreateCallback is deleted, it will not be counted as an error and it will be skipped as well as the successors that were attached to it as we have no reference to them. WARNING: One should decide how to handle singleton plugins (plugins which have at most one instance in a scene)! WARNING: We highly recommend that you don't modify plugins (including deletion, clearing the scene etc.) of srcRenderer and dstRenderer for the whole duration of this call! Doing so could lead to unexpected results including crashes. If the includeListOfPlugins is empty, we will invoke the preCreateCallback on all the plugins of the srcRenderer (a part from the rtEngine). If the includeListOfPlugins is non-empty, we will surely invoke the preCreateCallback on all plugins in the list and all successors which have been approved by the preCreateCallback invocations. If the excludeListOfPlugins is empty, it does not affect anything. If the excludeListOfPlugins is non-empty, then the mentioned plugins in it will not be scheduled to be visited by the preCreateCallback (even if they are mentioned explicitly in the includeListOfPlugins or implicitly via relatedness to a plugin mentioned in the includeListOfPlugins) and will surely not be copied. Their successors will also not be scheduled, but are not banned to be scheduled by being in another plugin's successor list. What can you do with the preCreateCallback? You get as arguments the dstRenderer and the srcPlugin. You will return a structure PreCreateCallbackOptions with some fields described in PreCreateCallbackOptions. What can you do with the postCreateCallback? You get as arguments the dstPlugin, srcPluginName, autoRenamedResult and preCreateCallbackReturnedName. Some more information about some of the arguments: More...
 
static int CopyPlugins (VRayRenderer srcRenderer, VRayRenderer dstRenderer, string pluginType, OnCopyPluginParamsPreCreate preCreateCallback, OnCopyPluginParamsPostCreate postCreateCallback)
 Copies some of the specified plugins of type (class) pluginType of the srcRenderer and some of their successors, depending on a user-defined pre-create callback to the dstRenderer and at the end, invoking a user-defined post-create callback on the created plugins after all have been processed. it will be skipped as well as the successors that were attached to it as we have no reference to them. WARNING: One should decide how to handle singleton plugins (plugins which have at most one instance in a scene)! WARNING: We highly recommend that you don't modify plugins (including deletion, clearing the scene etc.) of srcRenderer and dstRenderer for the whole duration of this call! Doing so could lead to unexpected results including crashes. What can you do with the preCreateCallback? You get as arguments the dstRenderer and the srcPlugin. You will return a structure PreCreateCallbackOptions with some fields described in PreCreateCallbackOptions. What can you do with the postCreateCallback? You get as arguments the dstPlugin, srcPluginName, autoRenamedResult and preCreateCallbackReturnedName. Some more information about some of the arguments: More...
 
static int CopyPlugins< T > (VRayRenderer srcRenderer, VRayRenderer dstRenderer, OnCopyPluginParamsPreCreate preCreateCallback, OnCopyPluginParamsPostCreate postCreateCallback)
 Copies some of the specified plugins of type (class) pluginType of the srcRenderer and some of their successors, depending on a user-defined pre-create callback to the dstRenderer and at the end, invoking a user-defined post-create callback on the created plugins after all have been processed. REMARK: if a plugin scheduled to be visited by the preCreateCallback is deleted, it will not be counted as an error and it will be skipped as well as the successors that were attached to it as we have no reference to them. WARNING: One should decide how to handle singleton plugins (plugins which have at most one instance in a scene)! WARNING: We highly recommend that you don't modify plugins (including deletion, clearing the scene etc.) of srcRenderer and dstRenderer for the whole duration of this call! Doing so could lead to unexpected results including crashes. What can you do with the preCreateCallback? You get as arguments the dstRenderer and the srcPlugin. You will return a structure PreCreateCallbackOptions with some fields described in PreCreateCallbackOptions. What can you do with the postCreateCallback? You get as arguments the dstPlugin, srcPluginName, autoRenamedResult and preCreateCallbackReturnedName. Some more information about some of the arguments: More...
 
static PluginLink[] GetChildPlugins (Plugin root, bool recursive)
 Returns a list of plugin dependency links. Any reference to another plugin from a property (including list properties) will append a PluginLink struct to the list. Properties are checked in the order of their definition in the plugin descriptor. More...
 
static float GetIESPrescribedIntensity (string fileName)
 Returns the prescribed intensity from an ies file More...
 
static PluginLink[] GetParentPlugins (Plugin child)
 Returns a list of plugins that directly reference the given child plugin. More...
 

Detailed Description

Various helper methods are grouped here

Member Function Documentation

◆ CopyPlugins() [1/2]

static int VRay.Util.CopyPlugins ( VRayRenderer  srcRenderer,
VRayRenderer  dstRenderer,
IEnumerable< object >  includeListOfPlugins,
IEnumerable< object >  excludeListOfPlugins,
OnCopyPluginParamsPreCreate  preCreateCallback,
OnCopyPluginParamsPostCreate  postCreateCallback 
)
static

Copies some of the specified plugins in the includeListOfPlugins list of the srcRenderer and some of their successors, depending on an exludeListOfPlugins, a user-defined pre-create callback to the dstRenderer and at the end, invoking a user-defined post-create callback on the created plugins after all have been processed. REMARK: if a plugin scheduled to be visited by the preCreateCallback is deleted, it will not be counted as an error and it will be skipped as well as the successors that were attached to it as we have no reference to them. WARNING: One should decide how to handle singleton plugins (plugins which have at most one instance in a scene)! WARNING: We highly recommend that you don't modify plugins (including deletion, clearing the scene etc.) of srcRenderer and dstRenderer for the whole duration of this call! Doing so could lead to unexpected results including crashes. If the includeListOfPlugins is empty, we will invoke the preCreateCallback on all the plugins of the srcRenderer (a part from the rtEngine). If the includeListOfPlugins is non-empty, we will surely invoke the preCreateCallback on all plugins in the list and all successors which have been approved by the preCreateCallback invocations. If the excludeListOfPlugins is empty, it does not affect anything. If the excludeListOfPlugins is non-empty, then the mentioned plugins in it will not be scheduled to be visited by the preCreateCallback (even if they are mentioned explicitly in the includeListOfPlugins or implicitly via relatedness to a plugin mentioned in the includeListOfPlugins) and will surely not be copied. Their successors will also not be scheduled, but are not banned to be scheduled by being in another plugin's successor list. What can you do with the preCreateCallback? You get as arguments the dstRenderer and the srcPlugin. You will return a structure PreCreateCallbackOptions with some fields described in PreCreateCallbackOptions. What can you do with the postCreateCallback? You get as arguments the dstPlugin, srcPluginName, autoRenamedResult and preCreateCallbackReturnedName. Some more information about some of the arguments:

  • srcPluginName - A string that is the same as srcPlugin name.
  • autoRenamedResult - An integer enumerable which is used to indicate how the renaming process has finished.
  • preCreateCallbackReturnedName - A string that is the same as "Name" field in the returned structure in the preCreateCallback.
    Parameters
    srcRendererThe source renderer (a valid VRayRenderer object). All plugins in the following lists must be of this renderer.
    dstRendererThe destination renderer (a valid VRayRenderer object).
    includeListOfPluginsA list of the plugins (can have pluginRefs) that will be processed. Can be empty.
    excludeListOfPluginsA list of the plugins (can have pluginRefs) that will be excluded from being processed. Can be empty.
    preCreateCallbackCalled on each plugin in the includeListOfPlugins and some of their successors.
    postCreateCallbackCalled on each newly created plugin in the dstRenderer.
    Returns
    On success the non-negative number of successfully copied (plus overwritten) plugins and -1 on error.

◆ CopyPlugins() [2/2]

static int VRay.Util.CopyPlugins ( VRayRenderer  srcRenderer,
VRayRenderer  dstRenderer,
string  pluginType,
OnCopyPluginParamsPreCreate  preCreateCallback,
OnCopyPluginParamsPostCreate  postCreateCallback 
)
static

Copies some of the specified plugins of type (class) pluginType of the srcRenderer and some of their successors, depending on a user-defined pre-create callback to the dstRenderer and at the end, invoking a user-defined post-create callback on the created plugins after all have been processed. it will be skipped as well as the successors that were attached to it as we have no reference to them. WARNING: One should decide how to handle singleton plugins (plugins which have at most one instance in a scene)! WARNING: We highly recommend that you don't modify plugins (including deletion, clearing the scene etc.) of srcRenderer and dstRenderer for the whole duration of this call! Doing so could lead to unexpected results including crashes. What can you do with the preCreateCallback? You get as arguments the dstRenderer and the srcPlugin. You will return a structure PreCreateCallbackOptions with some fields described in PreCreateCallbackOptions. What can you do with the postCreateCallback? You get as arguments the dstPlugin, srcPluginName, autoRenamedResult and preCreateCallbackReturnedName. Some more information about some of the arguments:

  • srcPluginName - A string that is the same as srcPlugin name.
  • autoRenamedResult - An integer enumerable that is used to indicate how the renaming process has finished.
  • preCreateCallbackReturnedName - A string that is the same as "Name" field in the returned structure in the preCreateCallback.
    Parameters
    srcRendererThe source renderer (a valid VRayRenderer object). All plugins in the following lists must be of this renderer.
    dstRendererThe destination renderer (a valid VRayRenderer object).
    pluginTypeThe type (class) of the plugins to be processed.
    preCreateCallbackCalled on each plugin of type pluginType and and some of their successors.
    postCreateCallbackCalled on each newly created plugin in the dstRenderer.
    Returns
    On success the non-negative number of successfully copied (plus overwritten) plugins and -1 on error.

◆ CopyPlugins< T >()

static int VRay.Util.CopyPlugins< T > ( VRayRenderer  srcRenderer,
VRayRenderer  dstRenderer,
OnCopyPluginParamsPreCreate  preCreateCallback,
OnCopyPluginParamsPostCreate  postCreateCallback 
)
static

Copies some of the specified plugins of type (class) pluginType of the srcRenderer and some of their successors, depending on a user-defined pre-create callback to the dstRenderer and at the end, invoking a user-defined post-create callback on the created plugins after all have been processed. REMARK: if a plugin scheduled to be visited by the preCreateCallback is deleted, it will not be counted as an error and it will be skipped as well as the successors that were attached to it as we have no reference to them. WARNING: One should decide how to handle singleton plugins (plugins which have at most one instance in a scene)! WARNING: We highly recommend that you don't modify plugins (including deletion, clearing the scene etc.) of srcRenderer and dstRenderer for the whole duration of this call! Doing so could lead to unexpected results including crashes. What can you do with the preCreateCallback? You get as arguments the dstRenderer and the srcPlugin. You will return a structure PreCreateCallbackOptions with some fields described in PreCreateCallbackOptions. What can you do with the postCreateCallback? You get as arguments the dstPlugin, srcPluginName, autoRenamedResult and preCreateCallbackReturnedName. Some more information about some of the arguments:

  • srcPluginName - A string that is the same as srcPlugin name.
  • autoRenamedResult - An integer enumerable that is used to indicate how the renaming process has finished.
  • preCreateCallbackReturnedName - A string that is the same as "Name" field in the returned structure in the preCreateCallback.
    Template Parameters
    TThe type (class) of the plugin.
    Parameters
    srcRendererThe source renderer (a valid VRayRenderer object). All plugins in the following lists must be of this renderer.
    dstRendererThe destination renderer (a valid VRayRenderer object).
    preCreateCallbackCalled on each plugin of type T and and some of their successors.
    postCreateCallbackCalled on each newly created plugin in the dstRenderer.
    Returns
    On success the non-negative number of successfully copied (plus overwritten) plugins and -1 on error.
Type Constraints
T :Plugin 

◆ GetChildPlugins()

static PluginLink[] VRay.Util.GetChildPlugins ( Plugin  root,
bool  recursive 
)
static

Returns a list of plugin dependency links. Any reference to another plugin from a property (including list properties) will append a PluginLink struct to the list. Properties are checked in the order of their definition in the plugin descriptor.

Parameters
rootThe plugin to start from
recursiveIf true, after processing all the properties of one plugin, recursively check the dependency plugins

◆ GetIESPrescribedIntensity()

static float VRay.Util.GetIESPrescribedIntensity ( string  fileName)
static

Returns the prescribed intensity from an ies file

Parameters
fileNamestring Path to the ies file
Returns
Prescribed intensity from an ies file

◆ GetParentPlugins()

static PluginLink[] VRay.Util.GetParentPlugins ( Plugin  child)
static

Returns a list of plugins that directly reference the given child plugin.

Parameters
childThe plugin which we is used by "parents"

◆ OnCopyPluginParamsPostCreate()

delegate void VRay.Util.OnCopyPluginParamsPostCreate ( Plugin  dstPlugin,
string  srcPluginName,
ReasonsForAutoRename  autoRenamedResult,
string  preCreateCallbackReturnedName 
)

Called on each newly created plugin in the dstRenderer.

Parameters
dstPluginA copied plugin in the dstRenderer.
srcPluginNameA string that is the same as srcPlugin name.
autoRenamedResultAn integer enumerable which is used to indicate how the renaming process has finished.
preCreateCallbackReturnedNameA string that is the same as "Name" field in the returned structure in the preCreateCallback.

◆ OnCopyPluginParamsPreCreate()

delegate PreCreateCallbackOptions VRay.Util.OnCopyPluginParamsPreCreate ( VRayRenderer  dstRenderer,
Plugin  srcPlugin 
)

Called on each plugin in the includeListOfPlugins and some of their successors. What can you do with the preCreateCallback? You get as arguments the dstRenderer and the srcPlugin. You will return a structure PreCreateCallbackOptions with the following fields:

  • name - A string with which we will try to rename the plugin in the dstRenderer. If it is an empty string, then this plugin creation will be skipped and successors will not be processed. Default is empty string.
  • skipOnlyCurrentPlugin - A boolean variable which, if true and combined with the field "Name" being an empty string, then the plugin is skipped, but successors will be processed. Default is false.
  • bool skipAllSuccessorsOfCurrentPlugin - A boolean variable which, if true will ensure that no successors of the currently processed plugin will be processed. Default is false.
  • overwriteExistingPlugin - A boolean variable which, if set to true, if there is a plugin in the dstRenderer with the same name as the one specified in the field "Name", it will try to overwrite it (reusing the existing instance and not recreating it from scratch). Keep in mind that they may not be of the same type, and if it occurs, then the created plugin will have an auto-generated name and the postCreateCallback integer enumerable argument autoRenamedResult will be set to the corresponding value. Default is false.
    Parameters
    dstRendererThe renderer to which you will copy the plugins.
    srcPluginThe plugin that is currently processed.
    Returns
    The a filled PreCreateCallbackOptions structure on which depend the creation of the plugin and other datails.

The documentation for this class was generated from the following file: