vray.VFBLayerManager

class vray.VFBLayerManager

Bases: object

A namespace-like class for VFBLayerManager related methods. It’s associated with one specific VFB instance (respectively to one specific VrayRenderer instance) and does not affect any other instances. Note: if you want to manipulate values related to externally loaded configurations (e.g. OCIO) concerning the Display Corrections layer, the VFB must be loaded and set to the correct profile in order to access the related values. Note: When beginning the rendering, the layers will be reloaded so all layer handles are invalidated. The same is true after every loadAllLayers, setAllLayers. A nice practice is to check whether the layer handle is valid before using it. Note: When beginning a rendering by default the parameters from SettingVFB ‘vfb2_layers’ and ‘cc_settings’ are used to overwrite the contents of the Layer Manager. If this is not a desired effect, then you can set the ‘dont_affect_settings’ parameter of the SettingsVFB plugin in the scene to true (the default value is false). If you don’t want to use this parameter, you can use a combination of fillSettingsVFB and applySettingsVFB methods to write the changes of the layers to the vrscene plugin which will be later read when the rendering starts. If you want to work with the VFB layer settings from a loaded vrscene, you must manage the “loading” and “unloading” of those settings (using fillSettingsVFB, applySettingsVFBand the Layer Manager method reset).

Methods

__init__()

bakeLayersToLUT

Bakes classNames to a LUT (.cube) file.

createLayer

Creates a new layer of the specified class, attaches it to the specified parent and returns the newly created layer. The following table of rules explains where the new layer will be attached (it may not be a child of the parent specified): DC - Display Correction, CC - Color Correction, PE - Post Effect, Ref - Reference, NA - NOT ALLOWED Rules should be checked from top to bottom as they are in the table. The N field is for reference below. ——————————————————————————————-| N | Selected Type | New Type | Position | ————————- |-------------------------|————————————–| 1 | * | DisplayCorrection | Last child of Root | 2 | Nothing selected | Folder/ CC/Ext / PE/Ref | Last child of first DC | 9 | Source layer selected | Folder/ CC/Ext / PE/Ref | Use the composite folder as selected | 3 | DC / Folder | Folder/ CC/Ext / PE/Ref | Last child of Selected | 4 | CC/Ext w PE/Ref parent| Folder/ PE / Ref | Directly Above Parent of Selected | 5 | CC/Ext w PE/Ref parent| CC/Ext | Directly Above Selected | 6 | CC/Ext | Folder/CC/Ext/PE/Ref | Directly Above Selected | 16| Ext | CC | Last child of Selected | 7 | Ref | Color Correction | Last child of Selected | 8 | Ref | Folder / PE / Ref | Directly Above Selected | 10| PE | CC/Ext/Folder | Last child of first DC | 11| CC/Ref | Mask | Last mask child of the selected | 12| Mask | Mask | Last mask child of selected parent | 13| * | Overlay | Add to root | 14| Overlay | CC/Ext | Last child of first DC | 15| DC | PE | see addPostEffectLayer |.

deleteLayer

Deletes the layer.

findAllLayersWithLayerClass

Finds all the layers with the specified class name.

findAllLayersWithUserName

Finds all the layers with the specified layer user name.

getAllBlendableLayers

Returns the list of all the layers which are blendable.

getAllEnabledLayers

Returns the list of all the layers which are enabled.

getAllLayers

Loads all classNames from a JSON string.

getAllLayersAsLayerObjects

Get all layers as a list of Layers.

getCreatableLayerClasses

Returns the list of layer classes which the user can create.

getDenoiserLayer

Gets the denoiser layer.

getDisplayCorrectionLayer

Gets the display correction layer.

getLayersCount

Get the number of classNames.

getLensEffectsLayer

Gets the lens effects layer.

getLightMixLayer

Gets the light mix layer.

getRootLayer

Gets the root layer.

getSharpenBlurLayer

Gets the sharpen/blur layer.

getSourceLayer

Gets the source layer.

getStampLayer

Gets the stamp layer.

loadAllLayers

Loads all classNames from a file.

lockLayers

Lock the classNames critical section - used when need to access the classNames and that might happen from different threads.

reset

Resets all the parameters to their default values.

saveAllLayers

Saves all classNames from a file.

setAllLayers

Saves and returns all classNames into a JSON string.

tryLockLayers

Tries to lock the classNames critical section and returns immediately.

unlockLayers

Unlock the classNames critical section.

bakeLayersToLUT()

Bakes classNames to a LUT (.cube) file.

Positional (in this order): * filename, string - the name of the file

createLayer()

Creates a new layer of the specified class, attaches it to the specified parent and returns the newly created layer. The following table of rules explains where the new layer will be attached (it may not be a child of the parent specified):

DC - Display Correction, CC - Color Correction, PE - Post Effect, Ref - Reference, NA - NOT ALLOWED Rules should be checked from top to bottom as they are in the table. The N field is for reference below. ——————————————————————————————-| N | Selected Type | New Type | Position | ————————- |-------------------------|————————————–| 1 | * | DisplayCorrection | Last child of Root | 2 | Nothing selected | Folder/ CC/Ext / PE/Ref | Last child of first DC | 9 | Source layer selected | Folder/ CC/Ext / PE/Ref | Use the composite folder as selected | 3 | DC / Folder | Folder/ CC/Ext / PE/Ref | Last child of Selected | 4 | CC/Ext w PE/Ref parent| Folder/ PE / Ref | Directly Above Parent of Selected | 5 | CC/Ext w PE/Ref parent| CC/Ext | Directly Above Selected | 6 | CC/Ext | Folder/CC/Ext/PE/Ref | Directly Above Selected | 16| Ext | CC | Last child of Selected | 7 | Ref | Color Correction | Last child of Selected | 8 | Ref | Folder / PE / Ref | Directly Above Selected | 10| PE | CC/Ext/Folder | Last child of first DC | 11| CC/Ref | Mask | Last mask child of the selected | 12| Mask | Mask | Last mask child of selected parent | 13| * | Overlay | Add to root | 14| Overlay | CC/Ext | Last child of first DC | 15| DC | PE | see addPostEffectLayer |

Positional (in this order) or keyword arguments:

  • layerClass, string - the layer class name

  • parent, VFBLayer - the parent of the layer

Returns the newly created layer.

deleteLayer()

Deletes the layer. If successfully deleted, the object is invalidated.

Positional (in this order):

  • layer, VFBLayer - the layer to be deleted

Returns true if the layer is successfully deleted and false otherwise.

findAllLayersWithLayerClass()

Finds all the layers with the specified class name.

Positional (in this order):

  • layerClass, string - the layer class name

Returns the list of the layers with the specified class name.

findAllLayersWithUserName()

Finds all the layers with the specified layer user name.

Positional (in this order):

  • userName, string - the layer user name

Returns the list of the layers with the specified user name.

getAllBlendableLayers()

Returns the list of all the layers which are blendable.

getAllEnabledLayers()

Returns the list of all the layers which are enabled.

getAllLayers()

Loads all classNames from a JSON string.

getAllLayersAsLayerObjects()

Get all layers as a list of Layers.

getCreatableLayerClasses()

Returns the list of layer classes which the user can create.

getDenoiserLayer()

Gets the denoiser layer.

getDisplayCorrectionLayer()

Gets the display correction layer.

getLayersCount()

Get the number of classNames.

getLensEffectsLayer()

Gets the lens effects layer.

getLightMixLayer()

Gets the light mix layer.

getRootLayer()

Gets the root layer.

getSharpenBlurLayer()

Gets the sharpen/blur layer.

getSourceLayer()

Gets the source layer.

getStampLayer()

Gets the stamp layer. For this layer there is a specific property called ‘stamp_font’ which is an object containg the fields pointSize, fontStyle, fontStyle, fontWeightand fontFace.pointSize(Size of text, in points) takes up integer valuesand fontFace(Name of the font face(“Arial” etc)) can be set to string values having no more than 100 characters. In particular, some of the fields take very concrete string values, case insensitive:

For fontStyle(Describes the family of a UI font) those are: * ‘stampFontFamily_default’ - Default family.
  • ‘stampFontFamily_decorated’ - Decorated font.

  • ‘stampFontFamily_roman’ - Roman(serif) font.

  • ‘stampFontFamily_script’ - Script font(handwriting).

  • ‘stampFontFamily_sansSerif’ - A sans serif font.

  • ‘stampFontFamily_modern’ - Modern font.

  • ‘stampFontFamily_monospaced’ - Monospaced font.

For fontStyle(Describes the style of a UI font) those are:
  • ‘stampFontStyle_normal’ - Normal style.

  • ‘stampFontStyle_italic’ - Italic style.

For fontWeight(Describes the weight of a UI font) those are:
  • ‘stampFontWeight_normal’ - Normal weight.

  • ‘stampFontWeight_light’ - Light font.

  • ‘stampFontWeight_bold’ - Bold font.

loadAllLayers()

Loads all classNames from a file. WARNING: After successful usage of this method, all layer instances used before its invocations will become invalid, no matter what the getIntegerID method returns. The isValid method will appropriately return the validity of a layer when in doubt.

Positional (in this order): * filename, string - the name of the file

lockLayers()

Lock the classNames critical section - used when need to access the classNames and that might happen from different threads. Uses a small number of spin cycles instead of immediately locking, if another thread already owns the critical section.

reset()

Resets all the parameters to their default values. You MUST lock the layer manager and stop image updates in the render view while this function runs. Otherwise the update thread might access the layer tree while it’s in an inconsistent state and crash.

saveAllLayers()

Saves all classNames from a file.

Positional (in this order): * filename, string - the name of the file

setAllLayers()

Saves and returns all classNames into a JSON string. WARNING: After successful usage of this method, all layer instances used before its invocations will become invalid, no matter what the getIntegerID method returns. The isValid method will appropriately return the validity of a layer when in doubt.

Positional (in this order): * json, string - the classNames as a JSON string

tryLockLayers()

Tries to lock the classNames critical section and returns immediately. Returns true on success and false otherwise.

unlockLayers()

Unlock the classNames critical section.