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

Wrapper for a given VRayRenderer's VFB functions More...

Classes

class  Layer
 
class  VFBLayerManager
 This class groups all VFB layers related methods. 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, applySettingsVFB and the Layer Manager method reset). More...
 

Public Member Functions

bool ApplySettingsVFB ()
 Fill in the lens effects settings from the SettingsVFB plugin into the VFB GUI. Nothing is changed if the plugin does not exist in the scene or its 'cc_settings' param is empty. More...
 
void ClearImage ()
 Clears the current image buffer
 
void EnableProgressBar (bool enable=true)
 Enables the progress bar in the VFB window. More...
 
bool FillSettingsVFB (string instanceName=null)
 Fill in the lens effects settings from the VFB GUI into the SettingsVFB plugin. The plugin is created if it does not already exist in the scene. More...
 
string GetLayers ()
 Get VFB2 layers as JSON. More...
 
bool GetMinimumSize (out int width, out int height)
 Query the minimum size required by the VFB layout More...
 
IntPtr GetNativeHandle ()
 Returns the VFB as a native UI handle. More...
 
byte[] GetPersistentState ()
 Gets the V-Ray VFB Persistent state. More...
 
bool GetPositionAndSize (out int x, out int y, out int w, out int h)
 Gets the V-Ray VFB window position and size. More...
 
IntPtr GetQWidget ()
 Returns the VFB as a QWidget*
 
string GetSettings ()
 Get VFB2 settings as JSON. More...
 
byte[] GetState (bool includeMain=true, bool includeHistory=true)
 Gets the V-Ray VFB state. More...
 
IntPtr GetWindowHandle ()
 Returns the window handle associated with the current V-Ray VFB. It's actually HWND on Windows. WARNING: Use this method with extreme caution or better do not use it at all! Always use higher level methods when available. More...
 
bool LoadColorCorrectionsPreset (string filename)
 Loads the global state of the color correction controls More...
 
bool LoadImage (string fileName)
 Load an image from disk into the framebuffer. All image channels are loaded. More...
 
void LogMessage (LogLevelType level, string message)
 Logs a message to the VFB log (if it's enabled). More...
 
void ResetState ()
 Resets the V-Ray VFB as if it was just created. More...
 
bool SaveColorCorrectionsPreset (string filename)
 Saves the global state of the color correction controls More...
 
bool SaveImage (String fileName, ImageWriterOptions options=null)
 Saves the current image from renderer to file. This allows you to save as some formats (TIFF, EXR) not supported by the VRayImage class. ImageWriterOptions allows more control especially for EXRs. More...
 
bool SetLayers (string json)
 Set VFB2 layers. More...
 
void SetNativeParentWindow (IntPtr handle)
 Sets the native parent of the current V-Ray VFB window. More...
 
void SetParentWindow (IntPtr hWnd)
 Sets the parent of the current V-Ray VFB window. WARNING: Use this method with extreme caution or better do not use it at all! Always use higher level methods when available. More...
 
void SetPersistentState (byte[] state)
 Sets the V-Ray VFB Persistent state. More...
 
void SetPosition (int x, int y)
 Sets the V-Ray VFB window position. More...
 
void SetPositionAndSize (int x, int y, int w, int h)
 Sets the V-Ray VFB window position and size. More...
 
void SetProgressText (string text)
 Sets a text string to the VFB progress bar. The text is only shown if the progress bar window is enabled. More...
 
void SetProgressTextAndValue (string text, float value)
 Sets a progress text and value to the VFB progress bar The text is only shown if the progress bar window is enabled More...
 
void SetProgressValue (float value=-1.0f)
 Sets a progress bar value to the VFB progress bar. The text is only shown if the progress bar window is enabled More...
 
bool SetProjectPath (string projectPath)
 Set the directory that will be used if "Use project path" is enabled in the History settings More...
 
void SetQWidgetParent (IntPtr parentWidget)
 Sets the QWidget parent of the current V-Ray VFB window. More...
 
bool SetSettings (string json)
 Set VFB2 settings. More...
 
void SetState (byte[] state, bool setMain=true, bool setHistory=true)
 Sets the V-Ray VFB state. More...
 
bool SetTitlePrefix (string prefix)
 Sets a prefix for the VFB window title More...
 
void SetUpdateAvailable (bool available)
 Sets a notification for available update in the VFB. More...
 

Static Public Member Functions

static void Enable (bool isEnabled)
 Globally enables/disables the V-Ray frame buffer. The method must be called before instantiating any VRayRenderer instances. Once the frame buffer has been disabled the CLR needs to be restarted in order to enable the buffer again. By default the frame buffer is enabled but can be hidden with the showFrameBuffer option set to false for the RendererOptions. More...
 
static void SetGUIMessageProcessing (bool enableMessageProcessing)
 Call this before operating with a renderer to enable or disable GUI message processing during internal waits. Note that the message processing is enabled by default. More...
 
static void SetUseParentEventLoop ()
 Call this before creating a renderer for the first time if you are going to parent it to your Win32 window. WARNING: You will get a deadlock if you call setUseParentEventLoop and you don't execute vfb.setParentWindow before showing the VFB
 

Properties

bool AlwaysOnTop [set]
 Sets/resets always on top.
 
bool ClearImageConfirmation [get, set]
 Confirmation dialog when clearing the image buffer through the VFB "Clear Image".
 
bool Interactivity [get, set]
 Moving and rotating the scene with the mouse in V-Ray VFB.
 
VFBLayerManager LayerManager [get]
 The layer manager.
 
VRayRenderer Renderer [get]
 The renderer to which this VFB belongs.
 
bool Shown [get, set]
 Show/hide frame buffer.
 

Detailed Description

Wrapper for a given VRayRenderer's VFB functions

Member Function Documentation

◆ ApplySettingsVFB()

bool VRay.VFB.ApplySettingsVFB ( )

Fill in the lens effects settings from the SettingsVFB plugin into the VFB GUI. Nothing is changed if the plugin does not exist in the scene or its 'cc_settings' param is empty.

Returns
True on success

◆ Enable()

static void VRay.VFB.Enable ( bool  isEnabled)
static

Globally enables/disables the V-Ray frame buffer. The method must be called before instantiating any VRayRenderer instances. Once the frame buffer has been disabled the CLR needs to be restarted in order to enable the buffer again. By default the frame buffer is enabled but can be hidden with the showFrameBuffer option set to false for the RendererOptions.

Parameters
isEnabledTrue if the frame buffer should be enabled.

◆ EnableProgressBar()

void VRay.VFB.EnableProgressBar ( bool  enable = true)

Enables the progress bar in the VFB window.

Parameters
enableEnable. Default is true.

◆ FillSettingsVFB()

bool VRay.VFB.FillSettingsVFB ( string  instanceName = null)

Fill in the lens effects settings from the VFB GUI into the SettingsVFB plugin. The plugin is created if it does not already exist in the scene.

Parameters
instanceNameThe name of the new instance if one has to be created
Returns
True on success

◆ GetLayers()

string VRay.VFB.GetLayers ( )

Get VFB2 layers as JSON.

Returns
JSON layers info

◆ GetMinimumSize()

bool VRay.VFB.GetMinimumSize ( out int  width,
out int  height 
)

Query the minimum size required by the VFB layout

Parameters
width[output] - the minimum width.
height[output] - the minimum height.
Returns
true if w and h were successfully updated (i.e. data is meaningful), false otherwise.

◆ GetNativeHandle()

IntPtr VRay.VFB.GetNativeHandle ( )

Returns the VFB as a native UI handle.

Returns
HWND on Windows, NSView (and not NSWindow!!) on MacOS.

The reason to return an NSView on MacOS is because it is trivial to retrieve the NSWindow owning a given NSView, while doing the opposite is more complicated especially if the VFB is docked within a parent window owning multiple views.

◆ GetPersistentState()

byte[] VRay.VFB.GetPersistentState ( )

Gets the V-Ray VFB Persistent state.

Returns
A byte array containing the VFB Persistent state as binary data.

◆ GetPositionAndSize()

bool VRay.VFB.GetPositionAndSize ( out int  x,
out int  y,
out int  w,
out int  h 
)

Gets the V-Ray VFB window position and size.

Parameters
xThe x position in screen coordinates.
yThe y position in screen coordinates.
wThe width.
hThe height.
Returns
True on succsess, false otherwise.

◆ GetSettings()

string VRay.VFB.GetSettings ( )

Get VFB2 settings as JSON.

Returns
JSON settings string.

◆ GetState()

byte[] VRay.VFB.GetState ( bool  includeMain = true,
bool  includeHistory = true 
)

Gets the V-Ray VFB state.

Parameters
includeMainWhether to include the main VFB state data - window state, buttons, etc.
includeHistoryWhether to include the history settings.
Returns
A byte array containing the VFB state as binary data.

◆ GetWindowHandle()

IntPtr VRay.VFB.GetWindowHandle ( )

Returns the window handle associated with the current V-Ray VFB. It's actually HWND on Windows. WARNING: Use this method with extreme caution or better do not use it at all! Always use higher level methods when available.

Returns
Current V-Ray VFB window handle.

◆ LoadColorCorrectionsPreset()

bool VRay.VFB.LoadColorCorrectionsPreset ( string  filename)

Loads the global state of the color correction controls

Parameters
filenamePath to the preset to be loaded including the ".vccglb" extension
Returns
True on success, false on failure

◆ LoadImage()

bool VRay.VFB.LoadImage ( string  fileName)

Load an image from disk into the framebuffer. All image channels are loaded.

Parameters
fileNamePath to the image file
Returns
True on success

◆ LogMessage()

void VRay.VFB.LogMessage ( LogLevelType  level,
string  message 
)

Logs a message to the VFB log (if it's enabled).

Parameters
levelThe log level.
messageThe log message.

◆ ResetState()

void VRay.VFB.ResetState ( )

Resets the V-Ray VFB as if it was just created.

This will not clear the image, use ClearImage() for that.

◆ SaveColorCorrectionsPreset()

bool VRay.VFB.SaveColorCorrectionsPreset ( string  filename)

Saves the global state of the color correction controls

Parameters
filenamePath to the preset to be saved. Automatically appends ".vccglb" extension
Returns
True on success, false on failure

◆ SaveImage()

bool VRay.VFB.SaveImage ( String  fileName,
ImageWriterOptions  options = null 
)

Saves the current image from renderer to file. This allows you to save as some formats (TIFF, EXR) not supported by the VRayImage class. ImageWriterOptions allows more control especially for EXRs.

Parameters
fileName
options
Returns
True if the operation finished successfully and false otherwise.

◆ SetGUIMessageProcessing()

static void VRay.VFB.SetGUIMessageProcessing ( bool  enableMessageProcessing)
static

Call this before operating with a renderer to enable or disable GUI message processing during internal waits. Note that the message processing is enabled by default.

Parameters
enableMessageProcessingTrue to enable and false to disable the GUI message processing.

◆ SetLayers()

bool VRay.VFB.SetLayers ( string  json)

Set VFB2 layers.

Parameters
jsonJSON layers info.
Returns
true on success

◆ SetNativeParentWindow()

void VRay.VFB.SetNativeParentWindow ( IntPtr  handle)

Sets the native parent of the current V-Ray VFB window.

Parameters
handleThe parent handle. HWND on Windows, NSWindow on MacOS.

When the VFB is meant to be parented but undocked, the passed handle should be the VFB window owner. In this case, the VFB will be a free floating window while enforcing windows ordering and preventing it to fall behind its owner. When the VFB is docked, the passed handle will be the vfb parent window where is embedded the VFB as a widget.

◆ SetParentWindow()

void VRay.VFB.SetParentWindow ( IntPtr  hWnd)

Sets the parent of the current V-Ray VFB window. WARNING: Use this method with extreme caution or better do not use it at all! Always use higher level methods when available.

Parameters
hWndThe parent window handle. It's actually HWND on Windows.

◆ SetPersistentState()

void VRay.VFB.SetPersistentState ( byte[]  state)

Sets the V-Ray VFB Persistent state.

Parameters
stateA byte array containing the VFB Persistent state binary data as previously returned by GetPersistentState()

◆ SetPosition()

void VRay.VFB.SetPosition ( int  x,
int  y 
)

Sets the V-Ray VFB window position.

Parameters
xThe x position in screen coordinates.
yThe y position in screen coordinates.

◆ SetPositionAndSize()

void VRay.VFB.SetPositionAndSize ( int  x,
int  y,
int  w,
int  h 
)

Sets the V-Ray VFB window position and size.

Parameters
xThe x position in screen coordinates.
yThe y position in screen coordinates.
wThe width.
hThe height.

◆ SetProgressText()

void VRay.VFB.SetProgressText ( string  text)

Sets a text string to the VFB progress bar. The text is only shown if the progress bar window is enabled.

Parameters
textText string to set.

◆ SetProgressTextAndValue()

void VRay.VFB.SetProgressTextAndValue ( string  text,
float  value 
)

Sets a progress text and value to the VFB progress bar The text is only shown if the progress bar window is enabled

See also
enableProgressBar
Parameters
textText string to set.
valueValue to be set in the range of 0..1.

◆ SetProgressValue()

void VRay.VFB.SetProgressValue ( float  value = -1.0f)

Sets a progress bar value to the VFB progress bar. The text is only shown if the progress bar window is enabled

See also
enableProgressBar
Parameters
valueValue to be set in the range of 0..1.

◆ SetProjectPath()

bool VRay.VFB.SetProjectPath ( string  projectPath)

Set the directory that will be used if "Use project path" is enabled in the History settings

Parameters
projectPathThe path
Returns
true on success, false on failure

◆ SetQWidgetParent()

void VRay.VFB.SetQWidgetParent ( IntPtr  parentWidget)

Sets the QWidget parent of the current V-Ray VFB window.

Parameters
parentWidgetThe QWidget* instance to use as parent.

◆ SetSettings()

bool VRay.VFB.SetSettings ( string  json)

Set VFB2 settings.

Parameters
jsonJSON settings string
Returns
true on success

◆ SetState()

void VRay.VFB.SetState ( byte[]  state,
bool  setMain = true,
bool  setHistory = true 
)

Sets the V-Ray VFB state.

Parameters
stateA byte array containing the VFB state binary data as previously returned by GetState()
setMainWhether to set the main VFB state data - window state, buttons, etc.
setHistoryWhether to set the history settings.

Setting a missing part of the data will be silently skipped (i.e. 'state' has only history state, but setMain=true)

◆ SetTitlePrefix()

bool VRay.VFB.SetTitlePrefix ( string  prefix)

Sets a prefix for the VFB window title

Parameters
prefixPrefix
Returns
true on success, false on failure

◆ SetUpdateAvailable()

void VRay.VFB.SetUpdateAvailable ( bool  available)

Sets a notification for available update in the VFB.

Parameters
availabletrue if an update is available, false otherwise.

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