TutorialApplication

Functions

int

MainLoop

RED_RC

Close

RED_RC

ShowSystemInformation

RED_RC

CreateCommand

RED_RC

RunCommand

RED_RC

DeleteCommand

RED_RC

RemoveCommand

int

GetCommandState

void

SetCommandState

RED_RC

AddToolBar

RED_RC

AddMenu

RED_RC

RemoveUIComponent

void

EnableUI

RED_RC

AddCommand

RED_RC

AddSeparator

RED_RC

OpenFileDialog

RED_RC

ShowInspector

void

HideInspector

bool

IsInspectorVisible

RED_RC

SetInspectedObject

RED_RC

GetInspectedObject

RED_RC

RefreshInspector

RED_RC

SetSelectedItem

RED_RC

SetUserVariables

void

UpdateUserVariables

void

GetUserVariables

void

UpdateUserVariable

void

SetEventCallback

EVENT_CALLBACK

GetEventCallback

void

SetMessage

RED_RC

SetViewpoint

Object *

GetResourceManager

Object *

GetViewpoint

Object *

GetWindow

RED_RC

SetLoopMode

LOOP_MODE

GetLoopMode

void

ResizeWindow

void

GetContentSize

void

GetContentPosition

RED_RC

SaveContent

RED_RC

SendEvent

RED_RC

Invalidate

RED_RC

Redraw

RED_RC

StopFrameTracingIfNeeded

RED_RC

AddStringsMap

const Map < unsigned int, String > &

GetStringsMap

String

GetStringFromID

RED_RC

TakeSnapshot

void

DisplayError

void

DisplayError

void

DisplayError

void

DisplayMessage

void

ShowProgressBar

void

UpdateProgressBar

void

ShowFPS

void

ShowResolution

float

GetTime

float

GetREDTimeElapsed

RED_RC

SetBackgroundColor

String

GetFilePath

void

UpdateFPSCounter

CHOICE

Ask

bool

SaveImageStamp

RED_RC

OpenURL

RED_RC

AddFrameTracingImages

RED_RC

RemoveFrameTracingImages

RED_RC

ClearFrameTracingImages

RED_RC

LoadREDFile

RED_RC

LoadFBXFile

RED_RC

SetRecentFiles

const Vector < String > &

GetRecentFiles

String

GetCurrentExecutablePath

void

GetMouseCursorPosition

void

SetMouseCursorPosition

void

HideMouseCursor

void

ShowMouseCursor

void

SetCustomLicense

Detailed Description

class TutorialApplication

This class defines a set of functions to quickly build RED-based applications.

@related class RFK::EventInfo, class RFK::UserVariable

This class is the entry point of most of the Redsdk tutorials as it provides packed and easy accesses to modern UI, cross-platform applications. You can use it to quickly prototype your own concepts in a very short time.

The framework owns the application main loop and automatically handles every UI and interaction events. The user has just to register custom callbacks on the events he wants to hear about. He also can customize the application look and functionalities by creating UI components and application commands.

Creating an application with the framework usually starts with the registration of one or several callbacks and then a call to RFK::TutorialApplication::MainLoop:

\coderef RSDK/FirstApp.e/Src/REDFirstApp.cpp wf_first_app_01

In the code above, the OnInit callback is called once the application is ready to enter its message loop while the OnMouse callback gets called on every user mouse interaction. It’s then up to the developer to decide what actions to perform on each event.

Additionaly, commands can be created and registered to the application. Those appear as toolbar buttons and/or menu entries depending on where the user insert them.

Finally high-level UI components are provided for convenience like a geometry inspector or a customizable variables editor.

See the \ref wf_first_app tutorial for a simple illustration of using the RFK::TutorialApplication.

Public Static Functions

static int MainLoop(const RED::String &iTitle, const RED::String &iLicense, RFK::LOOP_MODE iLoopMode = RFK::LM_PASSIVE, double iFeedbackInterval = 500.0, RED::WindowRenderInfo *iWindowRenderInfo = NULL, bool iUseHybridREDsdk = true)

Runs the application main loop.

The call exits when the application gets closed.

If the application requires some additional file dependencies, the full list can be passed to the call. Each dependency will be checked and a download operation will be launched for every missing one upon user acceptance. If any dependency is not satisfied (due to user cancellation or download failure), a RFK::EVT_ERROR event is sent but the application still enters the main loop.

It sends a RFK::EVT_INIT event after the initialization and the dependencies check but before entering the loop.

Parameters
  • iTitle – title of the application window.

  • iLicense – The REDSDK license to use.

  • iLoopMode – loop mode.

  • iFeedbackInterval – feedback interval in the case of a software rendering.

  • iWindowRenderInfo – optional pointer to the window render info.

  • iUseHybridREDsdk – If true, REDsdk is operated in hybrid mode (see RED::OPTIONS_RAY_ENABLE_SOFT_TRACER).

Returns

0 if everything went fine,

1 in case of a critical Qt initialization error (no panel popup),

1 in case of a critical error (after an error panel popup),

RED_RC enumeration values cast into (int).

static RED_RC Close(int iCommand = 0)

Closes the application.

Sends a EVT_CLOSE event.

This method can be used as a callback target in a call to CreateCommand.

Parameters

iCommand – ignored parameter.

Returns

RED_OK on success, a RED_RC describing the error otherwise.

static RED_RC ShowSystemInformation(int iCommand = 0)

Shows system information.

Opens a dialog showing the current software & hardware graphics configuration and recommendations.

This method can be used as a callback target in a call to CreateCommand.

Parameters

iCommand – ignored parameter.

Returns

RED_OK on success, a RED_RC describing the error otherwise.

static RED_RC CreateCommand(int &oCommandID, const RED::String &iDescription, const RED::String &iIconPath, const RED::String &iShortCut, RFK::COMMAND_CALLBACK iDo, RFK::COMMAND_CALLBACK iUndo = NULL, int iFlags = 0)

Creates a command to be added to a UI component (toolbar, menu…).

A command can be created only after a call to MainLoop. To do so, you can create your commands from within a user-defined callback set on the EVT_INIT event.

Parameters
  • oCommandID – the returned command ID on success.

  • iDescription – of the command.

  • iIconPath – path to the command icon file (can be PNG or JPG).

  • iShortCut – command shortcut (e.g “CTRL+O”) or empty string if no shortcut.

  • iDo – callback called on command activation.

  • iUndo – optional callback called on command undo.

  • iFlags – bitwise combination of command flags. The 16 leftmost bits are reserved to store the ID of a command group (if different from 0). All the checkable commands (CMD_FLAG_CHECKABLE flag set) belonging to the same command group are mutually exclusive, meaning that only one of the group commands can be checked at a given time.

Returns

RED_OK on success, another RED_RC describing the error otherwise.

static RED_RC RunCommand(int iCommandID)

Executes the given command.

Parameters

iCommandID – ID of the command to execute.

Returns

RED_OK on success, another RED_RC describing the error otherwise.

static RED_RC DeleteCommand(int iCommandID)

Deletes a command.

The deleted command is removed from all the UI components.

Parameters

iCommandID – ID of the command to delete.

Returns

RED_OK on success, another RED_RC describing the error otherwise.

static RED_RC RemoveCommand(int iCommandID, int iUIID = -1)

Removes a command from (a single or) all the UI components.

Parameters
  • iCommandID – ID of the command to remove.

  • iUIID – ID of the UI component from which the command must be removed, or -1 to remove all the command occurences.

Returns

RED_OK on success, another RED_RC describing the error otherwise.

static int GetCommandState(int iCommandID)

Gets the current state of a command as a bitwise combination of command flags.

Parameters

iCommandID – ID of the command to access.

Returns

the current state of a command as a bitwise combination of command flags, or -1 for an invalid command.

static void SetCommandState(int iCommandID, int iFlags)

Sets the current state of a command as a bitwise combination of command flags.

All flags relative to the command should be specified in iFlags, and not only one flag that needs to be modified for instance. For instance a SetCommandState( CMD_FLAG_CHECKED ) will turn on the checked property of the command, but at the same time CMD_FLAG_CHECKABLE should be specified too otherwise the command won’t be checkable after the call.

The group of the command can’t be modified through this method.

Parameters
  • iCommandID – The ID of the command to modify.

  • iFlags – The bitwise combination of flags that describe the new state of the command.

static RED_RC AddToolBar(int &oUIID, const RED::String &iLabel)

Adds a new toolbar to the application.

A toolbar can be added only after a call to MainLoop. To do so, you can set the application layout from within a user-defined callback set on the EVT_INIT event.

Parameters
  • oUIID – the returned ID of the toolbar on success.

  • iLabel – label of the toolbar.

Returns

RED_OK on success, another RED_RC describing the error otherwise.

static RED_RC AddMenu(int &oUIID, const RED::String &iLabel, int iParentID = -1)

Adds a new menu to the application.

A menu can be added only after a call to MainLoop. To do so, you can set the application layout from within a user-defined callback set on the EVT_INIT event.

A menu can be added to another menu and then becomes a sub-menu. You can do that by specifying the UI component ID of the menu parent. This ID must be a valid menu ID (obtained from a previous call to AddMenu) or -1 otherwise an error is returned.

Parameters
  • oUIID – the returned ID of the menu on success.

  • iLabel – label of the menu.

  • iParentID – UI component ID of the menu parent for a sub-menu (optional; default is -1 for no parent, meaning a root menu displayed in the menu bar).

Returns

RED_OK on success, another RED_RC describing the error otherwise.

static RED_RC RemoveUIComponent(int iUIID)

Removes a UI component from the application.

Parameters

iUIID – ID of the UI component to remove.

Returns

RED_OK on success, another RED_RC describing the error otherwise.

static void EnableUI(bool iEnabled)

Enables/Disables the UI.

Parameters

iEnabled – true to enable the UI, false otherwise.

static RED_RC AddCommand(int iUIID, int iCommandID)

Adds a command to a UI component.

The new command is added at the end of the already existing UI component commands. The same command can’t be added twice to the same UI component.

Parameters
  • iUIID – ID of the UI component to which the command must be added.

  • iCommandID – ID of the command to add.

Returns

RED_OK on success, another RED_RC describing the error otherwise.

static RED_RC AddSeparator(int iUIID)

Adds a separator after the latest inserted command in a UI component.

Parameters

iUIID – ID of the UI component to which the separator must be added.

Returns

RED_OK on success, another RED_RC describing the error otherwise.

static RED_RC OpenFileDialog(RED::Vector<RED::String> &oFilesList, const RED::String &iCaption, const RED::String &iDirectory, const RED::String &iFilter)

Open a file selection dialog.

Parameters
  • oFilesList – List of selected files.

  • iCaption – Information text.

  • iDirectory – Dialog starting directory.

  • iFilter – File selection filter.

Returns

RED_OK in case of success,

RED_ALLOC_FAILURE if a memory allocation has failed.

static RED_RC ShowInspector(RFK::INSPECTOR iInspector, RED::Object *iObject = NULL, bool iClosable = true, const RED::Map<unsigned int, RED::String> *iIDToNames = NULL)

Shows an object inspector.

An inspector can be shown only if the MainLoop method has been called.

If the given inspector is already shown, the call will set the optional ‘iObject’ as the inspected object and return.

Parameters
  • iInspector – type of the inspector to show.

  • iObject – pointer to the inspected object.

  • iClosable – is the inspector closable?

  • iIDToNames – Auxiliary correspondance table between RED::Object IDs and names that can be displayed by the inspector. This table must remain alive for the entire duration of the inspector display.

Returns

RED_OK on success, another RED_RC describing the error otherwise.

static void HideInspector(RFK::INSPECTOR iInspector)

Hides an inspector.

Parameters

iInspector – type of the inspector to hide.

static bool IsInspectorVisible(RFK::INSPECTOR iInspector)

Tests if an inspector is visible.

Parameters

iInspector – type of the inspector to test.

static RED_RC SetInspectedObject(RFK::INSPECTOR iInspector, RED::Object *iObject, const RED::Map<unsigned int, RED::String> *iIDToNames = NULL)

Sets the currently inspected object for a given inspector.

The passed ‘iObject’ must be of a compatible type with the selected inspector, otherwise a RED_BAD_PARAM value is returned.

Parameters
  • iInspector – type of the inspector.

  • iObject – pointer to the object to inspect.

  • iIDToNames – Auxiliary correspondance table between RED::Object IDs and names that can be displayed by the inspector.

Returns

RED_OK on success, another RED_RC describing the error otherwise.

static RED_RC GetInspectedObject(RED::Object *&oObject, RFK::INSPECTOR iInspector)

Gets the currently inspected object for a given inspector.

Parameters
  • oObject – returned pointer to the object inspected.

  • iInspector – type of the inspector.

Returns

RED_OK on success, another RED_RC describing the error otherwise.

static RED_RC RefreshInspector(RFK::INSPECTOR iInspector)

Refresh the given inspector.

Parameters

iInspector – type of the inspector.

Returns

RED_OK on success, another RED_RC describing the error otherwise.

static RED_RC SetSelectedItem(RFK::INSPECTOR iInspector, const RED::ShapePath &iItem)

Set an item selected in the given inspector.

Parameters
  • iInspector – type of the inspector.

  • iItem – item to select.

Returns

RED_OK on success, another RED_RC describing the error otherwise.

static RED_RC SetUserVariables(const RED::Vector<RFK::UserVariable> &iUserVariables)

Sets a list of user variables.

The user variables are displayed in their own window. Depending on its type, each user variable receives a dedicated control to let the user modify its value.

Each time one of those variables is modified, a EVT_UVAR event is send.

The updated list of user variables can be obtained by calling GetUserVariables.

Parameters

iUserVariables – The user variables list.

Returns

RED_OK on success, another RED_RC describing the error otherwise.

static void UpdateUserVariables(const RED::Vector<RFK::UserVariable> &iUserVariables)

Update the value of all the user variables.

This method changes the value of the RFK::UserVariable that has been sent to the user variable inspector using RFK::TutorialApplication::SetUserVariables first. All the user variables are updated from the iUserVariables array of variables. The matching is done on type and name of the variables.

Parameters

iUserVariables – The user variables to change.

Returns

RED_OK on success, another RED_RC describing the error otherwise.

static void GetUserVariables(RED::Vector<RFK::UserVariable> &oUserVariables)

Gets the list of user variables.

The returned list reflect the latest changes in user variables values.

Parameters

oUserVariables – the list of user variables.

static void UpdateUserVariable(const RFK::UserVariable &iUserVariable)

Update the value of a view only user variable.

This method changes the value of a RFK::UserVariable that has been sent to the user variable inspector using RFK::TutorialApplication::SetUserVariables first, and whose display uses the RFK::UVW_EDIT type. Those variables are not meant to be edited, just viewed.

Parameters

iUserVariable – The user variable to change.

static void SetEventCallback(RFK::EVENT iEvent, RFK::EVENT_CALLBACK iCallback, void *iParam = NULL)

Sets a user callback for a given application event.

Parameters
  • iEvent – event to check for.

  • iCallback – callback to call on event ‘iEvent’.

  • iParam – pointer to an optional parameter to be passed to ‘iCallback’.

static RFK::EVENT_CALLBACK GetEventCallback(RFK::EVENT iEvent, void **iParam = NULL)

Gets the user callback for the given application event.

Parameters
  • iEvent – event to check for.

  • iParam – pointer to the optional parameter set to ‘iCallback’.

Returns

the callback set on event ‘iEvent’.

static void SetMessage(const RED::String &iMessage)

Sets the message displayed in the application status bar.

Parameters

iMessage – message to display.

static RED_RC SetViewpoint(RED::Object *iViewpoint)

Sets the viewpoint rendered in the application window.

Pass a NULL viewpoint to stop rendering data.

If a viewpoint has already been set, it’s removed through a call to RemoveViewpoint before the new one is set instead.

Parameters

iViewpoint – pointer to the viewpoint.

Returns

RED_OK on success, a RED_RC describing the error otherwise.

static RED::Object *GetResourceManager()

Returns a pointer to the RED resource manager.

Returns

the resource manager.

static RED::Object *GetViewpoint()

Returns a pointer to the RED viewpoint.

Returns

the application viewpoint.

static RED::Object *GetWindow()

Returns a pointer to the RED window.

Returns

the application window.

static RED_RC SetLoopMode(RFK::LOOP_MODE iLoopMode)

Sets the loop mode.

Parameters

iLoopMode – loop mode to set.

Returns

RED_OK on success, a RED_RC describing the error otherwise.

static LOOP_MODE GetLoopMode()

Returns the loop mode.

Returns

the current loop mode.

static void ResizeWindow(int iWidth, int iHeight)

Resizes the window.

Parameters
  • iWidth – window width.

  • iHeight – window height.

static void GetContentSize(int &oWidth, int &oHeight)

Gets the size of the window contents (the 3d viewport).

Parameters
  • oWidth – output width.

  • oHeight – output height.

static void GetContentPosition(int &oTop, int &oLeft)

Gets the position of the window contents (the 3d viewport).

Parameters
  • oTop – output top position.

  • oLeft – output left position.

static RED_RC SaveContent(const RED::String &iFile)

Saves the content of the 3d viewport to an image on disk.

The output image is in PNG format.

Parameters

iFile – path to the output file.

Returns

RED_OK on success, a RED_RC describing the error otherwise.

static RED_RC SendEvent(RFK::EVENT iEvent, RFK::EventInfo &iEventInfo)

Sends an event.

Parameters
  • iEvent – event to send.

  • iEventInfo – event parameters.

Returns

RED_OK on success, a RED_RC describing the error otherwise.

static RED_RC Invalidate()

Invalidates the content of the window.

This method needs to be called when changes have been applied to the data and those changes must be taken into account in the next rendering operation.

Prior to calling Redraw, this method closes the current transaction. After the redraw operation of the window, a new transaction is opened.

Returns

RED_OK on success, a RED_RC describing the error otherwise.

static RED_RC Redraw()

Redraws the content of the window.

Returns

RED_OK on success, a RED_RC describing the error otherwise.

static RED_RC StopFrameTracingIfNeeded()

Stops the frame tracing and start a new transaction if the loop mode is software.

Returns

RED_OK on success, a RED_RC describing the error otherwise.

static RED_RC AddStringsMap(const RED::Map<unsigned int, RED::String> &iStringsMap)

Adds a map of correspondence between RED::Object IDs and strings.

This will be used by the inspector to display a name for each known RED::Object.

Parameters

iStringsMap – map of correspondence between RED::Object IDs and strings.

Returns

RED_OK on success, a RED_RC describing the error otherwise.

static const RED::Map<unsigned int, RED::String> &GetStringsMap()

Gets the map of correspondence between RED::Object IDs and strings.

Returns

the map of correspondence between RED::Object IDs and strings.

static RED::String GetStringFromID(unsigned int iID)

Gets a string from a RED::Object ID.

ID <-> string correspondences are recorded using AddStringsMap.

If the given ID is unknown, the “unknown” string is returned.

Parameters

iID – ID of the requested string.

Returns

a string from a RED::Object ID, or “unknown” if the ID is unknown.

static RED_RC TakeSnapshot(int iCommand = 0)

Takes a snapshot fo the application.

The snapshot is saved in the application directory under the name “snapshot_h_m_s.png” where h is hours, m is minutes and s is seconds.

This method can be used as a callback target in a call to CreateCommand.

Parameters

iCommand – ignored parameter.

Returns

RED_OK on success, a RED_RC describing the error otherwise.

static void DisplayError(RED_RC iRC, const char *iCaller, const void *iObject, const char *iExpression, const char *iInfo)

Displays a message box describing a RED_RC with its code location.

This method is aimed to be called after the RED error callback: RED::REDSDK_ERROR_CALLBACK. This callback can be set with RED::IResourceManager::SetErrorCallback.

Once the message box is closed by the user, the application exits immediately.

Parameters
  • iRC – Error code.

  • iCaller – Name of the calling method or function.

  • iObject – Relevant object address for the error.

  • iExpression – Called source expression string.

  • iInfo – Extra information string.

static void DisplayError(RED_RC iRC, const char *iFile, int iLine)

Displays a message box describing a RED_RC with its code location.

Once the message box is closed by the user, the application exits immediately.

Parameters
  • iRC – the error code.

  • iFile – name of the file where the error occured.

  • iLine – line in the file where the error occured.

static void DisplayError(const RED::String &iHeader, const RED::String &iMessage)

Displays a message box with an error message.

Once the message box is closed by the user, the application exits immediately.

Parameters
  • iHeader – Title of the message box.

  • iMessage – Message text body.

static void DisplayMessage(const RED::String &iHeader, const RED::String &iMessage)

Displays a message box with an error message.

The application resumes after the box is closed by the user.

Parameters
  • iHeader – Title of the message box.

  • iMessage – Message text body.

static void ShowProgressBar(bool iShow)

Displays or not the progress bar widget.

Parameters

iShow – do we show the progress bar?

static void UpdateProgressBar(float iValue, bool iForceRefresh = false)

Updates the progress bar.

Parameters
  • iValue – the value to set to the progress bar between 0.0 and 1.0.

  • iForceRefresh – true to force the refresh of the application’s UI, false to let the application refresh ASAP (default is false).

static void ShowFPS(bool iShow)

Displays or not the FPS widget.

Parameters

iShow – do we show the FPS?

static void ShowResolution(bool iShow)

Displays or not the resolution widget.

Parameters

iShow – do we show the resolution?

static float GetTime()

Gets the current time in milliseconds.

The time measurement starts on the first call to this method. Then, the method returns, in milliseconds, the total time elapsed since that first call has occurred.

Returns

the current time in milliseconds.

static float GetREDTimeElapsed()

Gets the current elapsed time in RED drawing in milliseconds.

Returns

the current elapsed time in RED drawing in milliseconds.

static RED_RC SetBackgroundColor(const RED::Color &iColor)

Sets the color of the background.

Parameters

iColor – color of the background.

Returns

RED_OK on success, a RED_RC describing the error otherwise.

static RED::String GetFilePath(const RED::String &iExtensions)

Opens a file dialog and lets the user choose a file of a given extension.

Parameters

iExtensions – allowed file extensions (can be “Images (*.png *.jpg)” for example to allow the selection of PNG or JPG files).

Returns

the path to the selected file (or an empty path if cancelled).

static void UpdateFPSCounter(float iFrameTime)

Updates the Frames Per Second counter.

Parameters

iFrameTime – time taken to render the last frame.

static CHOICE Ask(const RED::String &iQuestion)

Opens a Yes/No dialog with the given text.

Parameters

iQuestion – the text to display.

Returns

the user’s choice (YES or NO).

static bool SaveImageStamp(const RED::String &iFilePath, unsigned char *iRGBA, int iWidth, int iHeight, RED::String iText)

Saves an image with a stamp string written at the bottom of it.

This is used to print important information over an image before saving it. Please, note that this method only works for RGBA encoded images.

Parameters
  • iFilePath – the file path of the saved image.

  • iRGBA – pointer to pixels in char RGBA format (32bit per pixel).

  • iWidth – width of the image.

  • iHeight – height of the image.

  • iText – string to print over the image.

static RED_RC OpenURL(const RED::String &iURL)

Opens an URL in the system default web browser.

Parameters

iURL – URL to open in the browser.

Returns

RED_OK on success, RED_FAIL otherwise.

static RED_RC AddFrameTracingImages(RED::Object *iColorImage, RED::Object *iDepthImage, RED::Object *iViewpoint)

Adds images and viewpoint to use during a RED::IWindow::FrameTracingImages.

When the RFK::LOOP_MODE is software (i.e. RFK::LM_SOFTWARE_BY_BLOCKS, RFK::LM_SOFTWARE_BY_SURFACE or RFK::LM_SOFTWARE_PATH_TRACING) the framework loop normally calls the RED::IWindow::FrameTracing function. After calling this function, the loop call is replaced by RED::IWindow::FrameTracingImages. This allows for instance to apply post processes on the images. See the page \ref bk_re_a_tone_mapping_only_rendering_loop.

Two 2D images created by RED::IResourceManager::CreateImage2D must be supplied. Each image must be empty at the time of the call or set with a RED::TGT_TEX_RECT target.

Parameters
  • iColorImage – the image to fill with the color result.

  • iDepthImage – the image to fill with the depth result.

  • iViewpoint – the viewpoint for which raw images are requested.

Returns

RED_OK on success, RED_BAD_PARAM in case of bad parameters, RED_FAIL otherwise.

static RED_RC RemoveFrameTracingImages(RED::Object *iColorImage, RED::Object *iDepthImage, RED::Object *iViewpoint)

Removes images and viewpoint used during a RED::IWindow::FrameTracingImages.

See RFK::TutorialApplication::AddFrameTracingImages for more details about the frame tracing images.

The tuple [color image, depth image, viewpoint] must be the same as the one defined in the previously called RFK::TutorialApplication::AddFrameTracingImages function.

Parameters
  • iColorImage – the color image to remove.

  • iDepthImage – the depth image to remove.

  • iViewpoint – the viewpoint to remove.

Returns

RED_OK on success, RED_BAD_PARAM in case of bad parameters, RED_FAIL otherwise.

static RED_RC ClearFrameTracingImages()

Removes all the images and viewpoint used during a RED::IWindow::FrameTracingImages.

See RFK::TutorialApplication::AddFrameTracingImages for more details about the frame tracing images.

Returns

RED_OK on success, RED_FAIL otherwise.

static RED_RC LoadREDFile(RED::Object *&oCamera, unsigned int &oDataContext, RED::FileInfo *oFileInfo, const RED::String &iPath, RED::StreamingPolicy *iPolicy = NULL)

Loads a RED file.

This method loads a RED file. If at least one camera is found, all the file DAG roots are linked to the returned camera. If no camera is found, oCamera is NULL and the DAG is not linked to any camera.

See \ref tk_loading_a_red_file if you need to implement your own RED file loader.

If a RED::FileInfo is present in the file, the returned camera is the one with its ID equal to RED::FileInfo::GetDefaultViewID (if it exists; the method fails otherwise). If no RED::FileInfo is present, the camera returned is the first one.

Parameters
  • oCamera – pointer to the loaded camera.

  • oDataContext – value of the context handling the data in the RED::IDataManager .

  • oFileInfo – optional output file info. Can be NULL.

  • iPathRED file path.

  • iPolicy – Optional file streaming policy that can be specified.

Returns

RED_OK on success, a RED_RC describing the error otherwise.

static RED_RC LoadFBXFile(RED::Object *&oCamera, unsigned int &oDataContext, const RED::String &iPath, const RED::LayerSet *iRealTimeLayerSet, const RED::LayerSet *iPhotorealisticLayerSet)

Loads a FBX file.

This method loads a FBX file. If at least one camera is found, all the file DAG roots are linked to the returned camera. If no camera is found, oCamera is NULL and the DAG is not linked to any camera.

See \ref bk_id_io_tools if you need to implement your own FBX file loader.

The function loads all the content of a FBX file (RED::IOOT_ALL) and creates generic materials. The system unit is centimeter (RED::IOSU_CM).

Parameters
  • oCamera – pointer to the loaded camera.

  • oDataContext – value of the context handling the data in the RED::IDataManager .

  • iPathRED file path.

  • iRealTimeLayerSet – Layerset used for real time generic material.

  • iPhotorealisticLayerSet – Layerset used for photorealistic generic material.

Returns

RED_OK on success, a RED_RC describing the error otherwise.

static RED_RC SetRecentFiles(const RED::Vector<RED::String> &iRecentFiles)

Sets the list of recent files.

This list is automatically saved to the system when the application exits and restored next time the application is launched.

The application doesn’t display the content of the list in the UI. It’s the user responsibility to decide if he wants or not to use this list and how it should displayed.

Parameters

iRecentFiles – list of the recent files.

Returns

RED_OK on success, a RED_RC describing the error otherwise.

static const RED::Vector<RED::String> &GetRecentFiles()
Returns

the list of the recent files.

static RED::String GetCurrentExecutablePath()
Returns

the current path to the executable.

static void GetMouseCursorPosition(int &oX, int &oY)

Access the current mouse cursor position. The origin is at the lower left window corner.

Parameters
  • oX – Mouse coordinate.

  • oY – Mouse coordinate.

static void SetMouseCursorPosition(int iX, int iY)

Sets the current mouse cursor position. The origin is at the lower left window corner.

Parameters
  • iX – Mouse coordinate.

  • iY – Mouse coordinate.

static void HideMouseCursor()

Hides the mouse cursor.

static void ShowMouseCursor()

Shows the mouse cursor.

static void SetCustomLicense(const RED::String &iLicenseKey, unsigned int iCustomerID)

Defines a custom license.

When set, this license disables the free license with the 1h limit.

This function must be called before the call to RFK::TutorialApplication::MainLoop.

Parameters
  • iLicenseKey – the license key.

  • iCustomerID – the customer ID.