class RFK::TutorialApplication

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

#include <RFKTutorialApplication.h>

Public static functions:

static RED_RCAddCommand ( int iUIID, int iCommandID )
static RED_RCAddFrameTracingImages ( RED::Object * iColorImage, RED::Object * iDepthImage, RED::Object * iViewpoint )
static RED_RCAddMenu ( int & oUIID, const RED::String & iLabel, int iParentID = -1 )
static RED_RCAddSeparator ( int iUIID )
static RED_RCAddStringsMap ( const RED::Map< unsigned int, RED::String > & iStringsMap )
static RED_RCAddToolBar ( int & oUIID, const RED::String & iLabel )
static CHOICEAsk ( const RED::String & iQuestion )
static RED_RCClearFrameTracingImages ( )
static RED_RCClose ( int iCommand = 0 )
static RED_RCCreateCommand ( 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 )
static RED_RCDeleteCommand ( int iCommandID )
static voidDisplayError ( RED_RC iRC, const char * iCaller, const void * iObject, const char * iExpression, const char * iInfo )
static voidDisplayError ( RED_RC iRC, const char * iFile, int iLine )
static voidDisplayError ( const RED::String & iHeader, const RED::String & iMessage )
static voidDisplayMessage ( const RED::String & iHeader, const RED::String & iMessage )
static voidEnableUI ( bool iEnabled )
static intGetCommandState ( int iCommandID )
static voidGetContentPosition ( int & oTop, int & oLeft )
static voidGetContentSize ( int & oWidth, int & oHeight )
static RED::StringGetCurrentExecutablePath ( )
static RFK::EVENT_CALLBACKGetEventCallback ( RFK::EVENT iEvent, void ** iParam = NULL )
static RED::StringGetFilePath ( const RED::String & iExtensions )
static RED_RCGetInspectedObject ( RED::Object *& oObject, RFK::INSPECTOR iInspector )
static LOOP_MODEGetLoopMode ( )
static voidGetMouseCursorPosition ( int & oX, int & oY )
static const RED::Vector< RED::String > &GetRecentFiles ( )
static floatGetREDTimeElapsed ( )
static RED::Object *GetResourceManager ( )
static RED::StringGetStringFromID ( unsigned int iID )
static const RED::Map< unsigned int, RED::String > &GetStringsMap ( )
static floatGetTime ( )
static voidGetUserVariables ( RED::Vector< RFK::UserVariable > & oUserVariables )
static RED::Object *GetViewpoint ( )
static RED::Object *GetWindow ( )
static voidHideInspector ( RFK::INSPECTOR iInspector )
static voidHideMouseCursor ( )
static RED_RCInvalidate ( )
static boolIsInspectorVisible ( RFK::INSPECTOR iInspector )
static RED_RCLoadFBXFile ( RED::Object *& oCamera, unsigned int & oDataContext, const RED::String & iPath, const RED::LayerSet * iRealTimeLayerSet, const RED::LayerSet * iPhotorealisticLayerSet )
static RED_RCLoadREDFile ( RED::Object *& oCamera, unsigned int & oDataContext, RED::FileInfo * oFileInfo, const RED::String & iPath, RED::StreamingPolicy * iPolicy = NULL )
static intMainLoop ( const RED::String & iTitle, RFK::LOOP_MODE iLoopMode = RFK::LM_PASSIVE, double iFeedbackInterval = 500.0, RED::WindowRenderInfo * iWindowRenderInfo = NULL, bool iUseHybridREDsdk = true )
static RED_RCOpenFileDialog ( RED::Vector< RED::String > & oFilesList, const RED::String & iCaption, const RED::String & iDirectory, const RED::String & iFilter )
static RED_RCOpenURL ( const RED::String & iURL )
static RED_RCRedraw ( )
static RED_RCRefreshInspector ( RFK::INSPECTOR iInspector )
static RED_RCRemoveCommand ( int iCommandID, int iUIID = -1 )
static RED_RCRemoveFrameTracingImages ( RED::Object * iColorImage, RED::Object * iDepthImage, RED::Object * iViewpoint )
static RED_RCRemoveUIComponent ( int iUIID )
static voidResizeWindow ( int iWidth, int iHeight )
static RED_RCRunCommand ( int iCommandID )
static RED_RCSaveContent ( const RED::String & iFile )
static boolSaveImageStamp ( const RED::String & iFilePath, unsigned char * iRGBA, int iWidth, int iHeight, RED::String iText )
static RED_RCSendEvent ( RFK::EVENT iEvent, RFK::EventInfo & iEventInfo )
static RED_RCSetBackgroundColor ( const RED::Color & iColor )
static voidSetCommandState ( int iCommandID, int iFlags )
static voidSetCustomLicense ( const RED::String & iLicenseKey, unsigned int iCustomerID )
static voidSetEventCallback ( RFK::EVENT iEvent, RFK::EVENT_CALLBACK iCallback, void * iParam = NULL )
static RED_RCSetInspectedObject ( RFK::INSPECTOR iInspector, RED::Object * iObject, const RED::Map< unsigned int, RED::String > * iIDToNames = NULL )
static RED_RCSetLoopMode ( RFK::LOOP_MODE iLoopMode )
static voidSetMessage ( const RED::String & iMessage )
static voidSetMouseCursorPosition ( int iX, int iY )
static RED_RCSetRecentFiles ( const RED::Vector< RED::String > & iRecentFiles )
static RED_RCSetSelectedItem ( RFK::INSPECTOR iInspector, const RED::ShapePath & iItem )
static RED_RCSetUserVariables ( const RED::Vector< RFK::UserVariable > & iUserVariables )
static RED_RCSetViewpoint ( RED::Object * iViewpoint )
static voidShowFPS ( bool iShow )
static RED_RCShowInspector ( RFK::INSPECTOR iInspector, RED::Object * iObject = NULL, bool iClosable = true, const RED::Map< unsigned int, RED::String > * iIDToNames = NULL )
static voidShowMouseCursor ( )
static voidShowProgressBar ( bool iShow )
static voidShowResolution ( bool iShow )
static RED_RCShowSystemInformation ( int iCommand = 0 )
static RED_RCStopFrameTracingIfNeeded ( )
static RED_RCTakeSnapshot ( int iCommand = 0 )
static voidUpdateFPSCounter ( float iFrameTime )
static voidUpdateProgressBar ( float iValue, bool iForceRefresh = false )
static voidUpdateUserVariable ( const RFK::UserVariable & iUserVariable )
static voidUpdateUserVariables ( const RED::Vector< RFK::UserVariable > & iUserVariables )

Detailed description:

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

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:

// Set the program callbacks.
RFK::TutorialApplication::SetEventCallback( RFK::EVT_INIT, OnInit );
RFK::TutorialApplication::SetEventCallback( RFK::EVT_MOUSE, DefaultOnMouse );

// Run the application.
return RFK::TutorialApplication::MainLoop( "Tutorial - First application" );

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 First App tutorial for a simple illustration of using the RFK::TutorialApplication.

Functions documentation

public static RED_RC RFK::TutorialApplication::AddCommand(intiUIID,
intiCommandID
)

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:

iUIIDID of the UI component to which the command must be added.
iCommandIDID of the command to add.

Returns:

RED_OK on success, another RED_RC describing the error otherwise.

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 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:

iColorImagethe image to fill with the color result.
iDepthImagethe image to fill with the depth result.
iViewpointthe viewpoint for which raw images are requested.

Returns:

RED_OK on success, RED_BAD_PARAM in case of bad parameters, RED_FAIL otherwise.
public static RED_RC RFK::TutorialApplication::AddMenu(int &oUIID,
const RED::String &iLabel,
intiParentID = -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:

oUIIDthe returned ID of the menu on success.
iLabellabel of the menu.
iParentIDUI 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.

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

Parameters:

iUIIDID of the UI component to which the separator must be added.

Returns:

RED_OK on success, another RED_RC describing the error otherwise.
public static RED_RC RFK::TutorialApplication::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:

iStringsMapmap of correspondence between RED::Object IDs and strings.

Returns:

RED_OK on success, a RED_RC describing the error otherwise.
public static RED_RC RFK::TutorialApplication::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:

oUIIDthe returned ID of the toolbar on success.
iLabellabel of the toolbar.

Returns:

RED_OK on success, another RED_RC describing the error otherwise.
public static CHOICE RFK::TutorialApplication::Ask(const RED::String &iQuestion)

Opens a Yes/No dialog with the given text.

Parameters:

iQuestionthe text to display.

Returns:

the user's choice (YES or NO).

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.
public static RED_RC RFK::TutorialApplication::Close(intiCommand = 0)

Closes the application.

Sends a EVT_CLOSE event.

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

Parameters:

iCommandignored parameter.

Returns:

RED_OK on success, a RED_RC describing the error otherwise.
public static RED_RC RFK::TutorialApplication::CreateCommand(int &oCommandID,
const RED::String &iDescription,
const RED::String &iIconPath,
const RED::String &iShortCut,
RFK::COMMAND_CALLBACKiDo,
RFK::COMMAND_CALLBACKiUndo = NULL,
intiFlags = 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:

oCommandIDthe returned command ID on success.
iDescriptionof the command.
iIconPathpath to the command icon file (can be PNG or JPG).
iShortCutcommand shortcut (e.g "CTRL+O") or empty string if no shortcut.
iDocallback called on command activation.
iUndooptional callback called on command undo.
iFlagsbitwise 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.

Deletes a command.

The deleted command is removed from all the UI components.

Parameters:

iCommandIDID of the command to delete.

Returns:

RED_OK on success, another RED_RC describing the error otherwise.
public static void RFK::TutorialApplication::DisplayError(RED_RCiRC,
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:

iRCError code.
iCallerName of the calling method or function.
iObjectRelevant object address for the error.
iExpressionCalled source expression string.
iInfoExtra information string.
public static void RFK::TutorialApplication::DisplayError(RED_RCiRC,
const char *iFile,
intiLine
)

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:

iRCthe error code.
iFilename of the file where the error occured.
iLineline in the file where the error occured.
public static void RFK::TutorialApplication::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.
public static void RFK::TutorialApplication::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.
public static void RFK::TutorialApplication::EnableUI(booliEnabled)

Enables/Disables the UI.

Parameters:

iEnabledtrue to enable the UI, false otherwise.

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

Parameters:

iCommandIDID 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.
public static void RFK::TutorialApplication::GetContentPosition(int &oTop,
int &oLeft
)

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

Parameters:

oTopoutput top position.
oLeftoutput left position.
public static void RFK::TutorialApplication::GetContentSize(int &oWidth,
int &oHeight
)

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

Parameters:

oWidthoutput width.
oHeightoutput height.

Returns:

the current path to the executable.

Gets the user callback for the given application event.

Parameters:

iEventevent to check for.
iParampointer to the optional parameter set to 'iCallback'.

Returns:

the callback set on event 'iEvent'.

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

Parameters:

iExtensionsallowed 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).

Gets the currently inspected object for a given inspector.

Parameters:

oObjectreturned pointer to the object inspected.
iInspectortype of the inspector.

Returns:

RED_OK on success, another RED_RC describing the error otherwise.

Returns the loop mode.

Returns:

the current loop mode.

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

Parameters:

oX:Mouse coordinate.
oY:Mouse coordinate.

Returns:

the list of the recent files.

Gets the current elapsed time in RED drawing in milliseconds.

Returns:

the current elapsed time in RED drawing in milliseconds.

Returns a pointer to the RED resource manager.

Returns:

the resource manager.

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.

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

Returns:

the map of correspondence between RED::Object IDs and strings.
public static float RFK::TutorialApplication::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.

Gets the list of user variables.

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

Parameters:

oUserVariablesthe list of user variables.

Returns a pointer to the RED viewpoint.

Returns:

the application viewpoint.

Returns a pointer to the RED window.

Returns:

the application window.

Hides an inspector.

Parameters:

iInspectortype of the inspector to hide.

Hides the mouse cursor.

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.

Tests if an inspector is visible.

Parameters:

iInspectortype of the inspector to test.
public static RED_RC RFK::TutorialApplication::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 Input-Output API 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:

oCamerapointer to the loaded camera.
oDataContextvalue 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.
public static RED_RC RFK::TutorialApplication::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 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:

oCamerapointer to the loaded camera.
oDataContextvalue of the context handling the data in the RED::IDataManager .
oFileInfooptional 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.
public static int RFK::TutorialApplication::MainLoop(const RED::String &iTitle,
RFK::LOOP_MODEiLoopMode = RFK::LM_PASSIVE,
doubleiFeedbackInterval = 500.0,
RED::WindowRenderInfo *iWindowRenderInfo = NULL,
booliUseHybridREDsdk = 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:

iTitletitle of the application window.
iLoopModeloop mode.
iFeedbackIntervalfeedback interval in the case of a software rendering.
iWindowRenderInfooptional 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).
public static RED_RC RFK::TutorialApplication::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.

Opens an URL in the system default web browser.

Parameters:

iURLURL to open in the browser.

Returns:

RED_OK on success, RED_FAIL otherwise.

Redraws the content of the window.

Returns:

RED_OK on success, a RED_RC describing the error otherwise.

Refresh the given inspector.

Parameters:

iInspectortype of the inspector.

Returns:

RED_OK on success, another RED_RC describing the error otherwise.
public static RED_RC RFK::TutorialApplication::RemoveCommand(intiCommandID,
intiUIID = -1
)

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

Parameters:

iCommandIDID of the command to remove.
iUIIDID 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.

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:

iColorImagethe color image to remove.
iDepthImagethe depth image to remove.
iViewpointthe viewpoint to remove.

Returns:

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

Removes a UI component from the application.

Parameters:

iUIIDID of the UI component to remove.

Returns:

RED_OK on success, another RED_RC describing the error otherwise.
public static void RFK::TutorialApplication::ResizeWindow(intiWidth,
intiHeight
)

Resizes the window.

Parameters:

iWidthwindow width.
iHeightwindow height.

Executes the given command.

Parameters:

iCommandIDID of the command to execute.

Returns:

RED_OK on success, another RED_RC describing the error otherwise.

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

The output image is in PNG format.

Parameters:

iFilepath to the output file.

Returns:

RED_OK on success, a RED_RC describing the error otherwise.
public static bool RFK::TutorialApplication::SaveImageStamp(const RED::String &iFilePath,
unsigned char *iRGBA,
intiWidth,
intiHeight,
RED::StringiText
)

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:

iFilePaththe file path of the saved image.
iRGBApointer to pixels in char RGBA format (32bit per pixel).
iWidthwidth of the image.
iHeightheight of the image.
iTextstring to print over the image.

Sends an event.

Parameters:

iEventevent to send.
iEventInfoevent parameters.

Returns:

RED_OK on success, a RED_RC describing the error otherwise.

Sets the color of the background.

Parameters:

iColorcolor of the background.

Returns:

RED_OK on success, a RED_RC describing the error otherwise.
public static void RFK::TutorialApplication::SetCommandState(intiCommandID,
intiFlags
)

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.
public static void RFK::TutorialApplication::SetCustomLicense(const RED::String &iLicenseKey,
unsigned intiCustomerID
)

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:

iLicenseKeythe license key.
iCustomerIDthe customer ID.
public static void RFK::TutorialApplication::SetEventCallback(RFK::EVENTiEvent,
RFK::EVENT_CALLBACKiCallback,
void *iParam = NULL
)

Sets a user callback for a given application event.

Parameters:

iEventevent to check for.
iCallbackcallback to call on event 'iEvent'.
iParampointer to an optional parameter to be passed to 'iCallback'.
public static RED_RC RFK::TutorialApplication::SetInspectedObject(RFK::INSPECTORiInspector,
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:

iInspectortype of the inspector.
iObjectpointer 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.

Sets the loop mode.

Parameters:

iLoopModeloop mode to set.

Returns:

RED_OK on success, a RED_RC describing the error otherwise.
public static void RFK::TutorialApplication::SetMessage(const RED::String &iMessage)

Sets the message displayed in the application status bar.

Parameters:

iMessagemessage to display.

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

Parameters:

iX:Mouse coordinate.
iY:Mouse coordinate.

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:

iRecentFileslist of the recent files.

Returns:

RED_OK on success, a RED_RC describing the error otherwise.

Set an item selected in the given inspector.

Parameters:

iInspectortype of the inspector.
iItemitem to select.

Returns:

RED_OK on success, another RED_RC describing the error otherwise.

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:

iUserVariablesThe user variables list.

Returns:

RED_OK on success, another RED_RC describing the error otherwise.

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:

iViewpointpointer to the viewpoint.

Returns:

RED_OK on success, a RED_RC describing the error otherwise.
public static void RFK::TutorialApplication::ShowFPS(booliShow)

Displays or not the FPS widget.

Parameters:

iShowdo we show the FPS?
public static RED_RC RFK::TutorialApplication::ShowInspector(RFK::INSPECTORiInspector,
RED::Object *iObject = NULL,
booliClosable = 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:

iInspectortype of the inspector to show.
iObjectpointer to the inspected object.
iClosableis 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.

Shows the mouse cursor.

public static void RFK::TutorialApplication::ShowProgressBar(booliShow)

Displays or not the progress bar widget.

Parameters:

iShowdo we show the progress bar?
public static void RFK::TutorialApplication::ShowResolution(booliShow)

Displays or not the resolution widget.

Parameters:

iShowdo we show the resolution?

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:

iCommandignored parameter.

Returns:

RED_OK on success, a RED_RC describing the error otherwise.

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.

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:

iCommandignored parameter.

Returns:

RED_OK on success, a RED_RC describing the error otherwise.
public static void RFK::TutorialApplication::UpdateFPSCounter(floatiFrameTime)

Updates the Frames Per Second counter.

Parameters:

iFrameTimetime taken to render the last frame.
public static void RFK::TutorialApplication::UpdateProgressBar(floatiValue,
booliForceRefresh = false
)

Updates the progress bar.

Parameters:

iValuethe value to set to the progress bar between 0.0 and 1.0.
iForceRefreshtrue to force the refresh of the application's UI, false to let the application refresh ASAP (default is false).
public static void RFK::TutorialApplication::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.

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.