Interface Class Reference

This reference page is linked to from the following overview topics: Mudbox 2013.



Detailed Description

The Interface class provides access to user interface related functions and events.

To get a pointer to the current Mudbox interface, call Kernel()->Interface().

Definition at line 43 of file interface.h.

#include <interface.h>

Inheritance diagram for Interface:
Inheritance graph
[legend]

List of all members.

Public Types

enum   LayerUIType { ltSculptUI, ltPaintUI }
enum   MessageBoxType { msgInformation, msgWarning, msgQuestion, msgError }
enum   MessageBoxButton {
  buttonNone = 0x00000000, buttonOk = 0x00000400, buttonCancel = 0x00400000, buttonClose = 0x00200000,
  buttonYes = 0x00004000, buttonYesToAll = 0x00008000, buttonNo = 0x00010000, buttonNoToAll = 0x00020000,
  buttonAbort = 0x00040000, buttonRetry = 0x00080000, buttonIgnore = 0x00100000, buttonHelp = 0x01000000
}
enum   HUDMessageType { HUDmsgPin, HUDmsgFade }
enum   StatusType { stNormal, stWarning, stError }
enum   HotkeySetName { HotkeySetMudbox = 0, HotkeySetMaya = 1, HotkeySet3dsMax = 2, HotkeySetSoftimage = 3 }

Public Member Functions

  Interface (void)
QWidget MainWindow (void) const
  Returns a pointer to the main window.
void  ShowNewPaintLayerDialog (void)
void  ShowBrushRing (bool bShow)
  This function turns on/off displaying the brush indicator ring.
bool  RestorePreviousBrush (void)
  Restores the current brush to the previous one.
void  ActivateLayerSystem (LayerUIType eType)
  Activates the given system in the Layer UI window.
void  Load (QString filename, Scene::LoadData &cData)
  Loads scene data.
void  ShowProperties (Node *pNode, bool bFloating) const
  Open a new properties dialog for the given node.
int  MessageBox (MessageBoxType iType, const QString &sTitle, const QString &sText, int iButtons=buttonNone, int iDefaultButton=buttonNone)
  Displays a modal message box to the user.
int  OneTimeMessageBox (MessageBoxType iType, const QString &sTitle, const QString &sText, int buttons=0)
  Displays a informational modal message box to the user with a checkbox option to not show the dialog again.
void  HUDMessageShow (const QString &sMessage, HUDMessageType iType=HUDmsgFade)
  Displays a message as text overlay (HUD) in the 3d view.
void  HUDMessageHide ()
  Hides a text overlay (HUD) message created with a call to HUDMessageShow().
void  SetStatus (StatusType iType, const QString &sMsg)
  Display a message in the status bar, which is on the bottom edge of the Mudbox window.
void  AddClassMenuItem (const QString &sMenu, const QString &sSubmenu, const ClassDesc *pClass, const QString &sCreatorText, const int &index=-1, const int &subindex=-1, const bool addSeparator=false)
  Adds a new submenu to the interface that can be used to create and edit instances of a class you define in your plug-in.
void  AddCallbackMenuItem (const QString &sMenu, const QString &sSubmenu, const QString &sItemName, void(*pCallback)(), const QString &sID="", const int &index=-1, const int &subindex=-1, const bool addSeparator=false)
  Adds a new menu item that calls a callback function you specify in your plug-in.
void  SelectHotkeySet (HotkeySetName newKeySet, bool forceSetHotkey=false)
  Changes the hotkeys to more closely match those in other Autodesk applications.
HotkeySetName  CurrentHotkeySet () const
  Returns a code indicating the current Hotkey presets in use by Mudbox.
void  AddToCreateMeshMenu (QFileInfo fileInfo)
  Adds a mesh to the Create->Mesh menu.
void  AddObjectListContextMenuItem (const ClassDesc *pObjectType, const QString &sItemName, void(*pCallback)(), int index=-1, bool addSeparator=false)
void  AddLayerCallbackMenuItem (mudbox::Interface::LayerUIType ltType, const QString &sItemName, void(*pCallback)())
void  ProgressStart (const QString &sDescription, unsigned int iMaxValue)
  Displays a progress bar, to show a process beginning. This will set the current progess value to 0.
void  ProgressSet (unsigned int iValue)
  Updates the current progress bar.
void  ProgressAdd (void)
  Updates the current progress bar by adding one to the progress value used.
void  ProgressEnd (void)
  Removes the current progress bar, whether or not the process is complete.
bool  ProgressIsCancelRequested (void)
  Returns true if the user cancelled an operation in progress.
QString  LoadFileDialog (const QString &sTitle, const QString &sPath, const QString &sFilter, QString *sSelectedFilter=0) const
  Opens a modal file dialog so the user can choose an existing file to open.
QString  SaveFileDialog (const QString &sTitle, const QString &sPath, const QString &sFilter, bool bAskForOverwrite=true, QString *sSelectedFilter=0) const
  Opens a modal file dialog so the user can choose a file name to save to.
QString  GetDirectoryDialog (const QString &sTitle, const QString &sPath) const
  Opens a modal file dialog so the user can choose an existing folder.
QStringList  LoadFilesDialog (const QString &sTitle, const QString &sPath, const QString &sFilter) const
  Opens a modal file dialog so the user can choose existing files to open.
void  WaitCursorStart (void)
  Show the wait cursor.
void  WaitCursorEnd (void)
  Restore the previous cursor after calling WaitCursorStart().
void  RefreshUI (void) const
  Refresh all dialogs.
void  AddView (QString className, QString windowTitle, const bool select=false) const
  Adds a view in the central widget.

Public Attributes

aptr< BrushOperation SelectedBrush
  This pointer contains the address of the currently selected brush.
aptr< KeyboardEventNotifier KeyboardEvent
  This is a pointer to the latest keyboard event.
aevent  PostUIInitializationEvent
  This event is triggered after the Mudbox main UI window is created.

Static Public Attributes

static QString  menuFile
static QString  menuEdit
static QString  menuCreate
static QString  menuCurves
static QString  menuDisplay
static QString  menuHelp
static QString  menuPlugins
static QString  menuMesh
static QString  menuRender
static QString  menuScripts
static QString  menuMaps
static QString  menuWindows

Member Enumeration Documentation

Enumerator:
ltSculptUI 

Sculpt Layer UI.

ltPaintUI 

Paint Layer UI.

Definition at line 48 of file interface.h.

Enumerator:
buttonNone 
buttonOk 
buttonCancel 
buttonClose 
buttonYes 
buttonYesToAll 
buttonNo 
buttonNoToAll 
buttonAbort 
buttonRetry 
buttonIgnore 
buttonHelp 

Definition at line 60 of file interface.h.

        {
            buttonNone      = 0x00000000,
            buttonOk        = 0x00000400,
            buttonCancel    = 0x00400000,
            buttonClose     = 0x00200000,
            buttonYes       = 0x00004000,
            buttonYesToAll  = 0x00008000,
            buttonNo        = 0x00010000,
            buttonNoToAll   = 0x00020000,
            buttonAbort     = 0x00040000,
            buttonRetry     = 0x00080000,
            buttonIgnore    = 0x00100000,
            buttonHelp      = 0x01000000
        };
Enumerator:
HUDmsgPin 

keep the HUD message up until specifically cancelled

HUDmsgFade 

make the message fade away after a few seconds

Definition at line 75 of file interface.h.

enum StatusType
Enumerator:
stNormal 

message

stWarning 

warning

stError 

error

Definition at line 81 of file interface.h.

Enumerator:
HotkeySetMudbox 
HotkeySetMaya 
HotkeySet3dsMax 
HotkeySetSoftimage 

Definition at line 88 of file interface.h.


Constructor & Destructor Documentation

Interface ( void  )

Member Function Documentation

QWidget* MainWindow ( void  ) const

Returns a pointer to the main window.

void ShowNewPaintLayerDialog ( void  )
void ShowBrushRing ( bool  bShow )

This function turns on/off displaying the brush indicator ring.

bool RestorePreviousBrush ( void  )

Restores the current brush to the previous one.

void ActivateLayerSystem ( LayerUIType  eType )

Activates the given system in the Layer UI window.

Parameters:
[in] eType The layer system to activate.
void Load ( QString  filename,
Scene::LoadData cData 
)

Loads scene data.

This method loads a file from disk the same way the File Menu > Open command does. Note that this method differs from Scene::Load in that it automatically adds filename to the list of recent files, and updates other UI elements, whereas Scene::Load does not.

Parameters:
[in] filename path to the file on disk, by default this can be a .obj, .mud or .fbx file.
[in] cData The load options. Note if m_bMerge is true, the contents of the file are merged into the current scene. Otherwise they are added to a new scene.
void ShowProperties ( Node pNode,
bool  bFloating 
) const

Open a new properties dialog for the given node.

Parameters:
[in] pNode Address of the node whose parameters should be shown.
[in] bFloating Declares if the properties shoulod be in a floating panel or in the docked Properties pane
int MessageBox ( MessageBoxType  iType,
const QString sTitle,
const QString sText,
int  iButtons = buttonNone,
int  iDefaultButton = buttonNone 
)

Displays a modal message box to the user.

Parameters:
[in] iType One of mudbox::Interface::msgInformation, mudbox::Interface::msgWarning, mudbox::Interface::msgQuestion or mudbox::Interface::msgError
[in] sTitle The title of the message box
[in] sText The text of the message
[in] iButtons The buttons to include. Specify this as a bitwise OR of the available MessageBoxButton flags.
[in] iDefaultButton Specifies which of the buttons should be the default when the window opens
int OneTimeMessageBox ( MessageBoxType  iType,
const QString sTitle,
const QString sText,
int  buttons = 0 
)

Displays a informational modal message box to the user with a checkbox option to not show the dialog again.

Returns the ID of the button pressed by the user. Returns QMessageBox::Ok if the user had previously chosen not to show the dialog again

Parameters:
[in] iType One of mudbox::Interface::msgInformation, mudbox::Interface::msgWarning, mudbox::Interface::msgQuestion or mudbox::Interface::msgError
[in] sTitle The title of the message box
[in] sText The text of the message
[in] buttons Buttons to appear in the dialog
void HUDMessageShow ( const QString sMessage,
HUDMessageType  iType = HUDmsgFade 
)

Displays a message as text overlay (HUD) in the 3d view.

You can specify if the message is temporary (fading after a few seconds) or if it should stay "pinned" on the screen until overwritten or dismissed with HUDMessageHide(). New messages will replace previous ones.

Parameters:
[in] sMessage The text of the message (may include some HTML tags, such as for bold or italics)
[in] iType One of mudbox::Interface::HUDmsgPin or mudbox::Interface::HUDmsgFade
Examples:
SampleViewportFilter/SampleViewportFilter.cpp.
void HUDMessageHide ( )

Hides a text overlay (HUD) message created with a call to HUDMessageShow().

Note: if a message was displayed with the mudbox::Interface::HUDmsgFade parameter, then it will go away after a few seconds with no intervention.

void SetStatus ( StatusType  iType,
const QString sMsg 
)

Display a message in the status bar, which is on the bottom edge of the Mudbox window.

Parameters:
[in] iType Determines the color of the message. One of mudbox::Interface::stNormal, mudbox::Interface::stWarning, or mudbox::Interface::stError
[in] sMsg The text of the message
void AddClassMenuItem ( const QString sMenu,
const QString sSubmenu,
const ClassDesc pClass,
const QString sCreatorText,
const int &  index = -1,
const int &  subindex = -1,
const bool  addSeparator = false 
)

Adds a new submenu to the interface that can be used to create and edit instances of a class you define in your plug-in.

For example, if you call:

        Kernel()->Interface()->AddClassMenuItem( mudbox::Interface::menuMaps, "MyItem", myClass::StaticClass(), "Make New Instance" );

A new submenu (named "MyItem") will be added to the end of the "Maps" menu. This new submenu will initially contain one item, called "Make New Instance". If you select this item, a new instance of myClass will be created, and an editor opened for it so you can change its values. The name of the new instance will also be added to the "MyItem" submenu, so that you can go back and edit it later.

Note that "StaticClass()" is automatically defined for any class that uses the IMPLEMENT_CLASS macro.

Parameters:
[in] sMenu The name of the menu to which your sub-menu will be added.
[in] sSubmenu The name of the sub-menu to be created
[in] pClass The class to be created by the new menu item
[in] sCreatorText The name of the menu item that will create your new class
[in] index The index where you want to insert the new menu item. -1 means append to the end of menu
[in] subindex The index where you want to insert the submenu if it does not exist already, -1 means append to the end of menu
[in] addSeparator Set this to true if you want separators around this item
void AddCallbackMenuItem ( const QString sMenu,
const QString sSubmenu,
const QString sItemName,
void(*)()  pCallback,
const QString sID = "",
const int &  index = -1,
const int &  subindex = -1,
const bool  addSeparator = false 
)

Adds a new menu item that calls a callback function you specify in your plug-in.

The signature of your callback function must be:

        void myCallback();
Parameters:
[in] sMenu The name of the menu to which the item should be added
[in] sSubmenu The name of a submenu to which the item should be added (if you don't want a submenu, pass in an empty QString)
[in] sItemName The display name of the new menu item that will call your callback
[in] pCallback A pointer to the callback function
[in] sID The internal ID of the new menu item
[in] index The index where you want to insert the new menu item. -1 means append to the end of menu
[in] subindex The index where you want to insert the submenu if it does not exist already, -1 means append to the end of menu
[in] addSeparator Set this to true if you want separators around this item.
Examples:
MeshBuilder/MeshBuilder.cpp.
void SelectHotkeySet ( HotkeySetName  newKeySet,
bool  forceSetHotkey = false 
)

Changes the hotkeys to more closely match those in other Autodesk applications.

Parameters:
[in] newKeySet The desired keyset: HotkeySetMudbox, HotkeySetMaya, HotkeySet3dsMax or HotkeySetSoftimage
[in] forceSetHotkey If true, force an update even if there is no change to the current preset
HotkeySetName CurrentHotkeySet ( ) const

Returns a code indicating the current Hotkey presets in use by Mudbox.

void AddToCreateMeshMenu ( QFileInfo  fileInfo )

Adds a mesh to the Create->Mesh menu.

void AddObjectListContextMenuItem ( const ClassDesc pObjectType,
const QString sItemName,
void(*)()  pCallback,
int  index = -1,
bool  addSeparator = false 
)
void AddLayerCallbackMenuItem ( mudbox::Interface::LayerUIType  ltType,
const QString sItemName,
void(*)()  pCallback 
)
void ProgressStart ( const QString sDescription,
unsigned int  iMaxValue 
)

Displays a progress bar, to show a process beginning. This will set the current progess value to 0.

Parameters:
[in] sDescription A name or description for the process whose progress is being shown
[in] iMaxValue A positive value representing the completion of the process
Examples:
PLYImport/Importer.cpp.
void ProgressSet ( unsigned int  iValue )

Updates the current progress bar.

Parameters:
[in] iValue The new progress value (the maximum allowed value was specified in ProgressStart() )
Examples:
PLYImport/Importer.cpp.
void ProgressAdd ( void  )

Updates the current progress bar by adding one to the progress value used.

void ProgressEnd ( void  )

Removes the current progress bar, whether or not the process is complete.

Examples:
PLYImport/Importer.cpp.
bool ProgressIsCancelRequested ( void  )

Returns true if the user cancelled an operation in progress.

When a progress bar is displayed, the user can cancel out of the operation in progress by clicking the cancel button, or by hitting the ESC key. If your plug-in is running a long process with a progress bar showing, it should call this method regularly to see if the user has cancelled the operation.

QString LoadFileDialog ( const QString sTitle,
const QString sPath,
const QString sFilter,
QString sSelectedFilter = 0 
) const

Opens a modal file dialog so the user can choose an existing file to open.

Returns the path to the file.

If the user cancels out of the file dialog, an empty QString is returned.

Parameters:
[in] sTitle The title to display in the file dialog
[in] sPath The initial path to display when the file dialog opens
[in] sFilter A QString that specifies which kind of files should be displayed. For example: "TIFF images (*.tif);;PNG images (*.png)"
[in,out] sSelectedFilter The default filter to be used, and the selected filter by the user, if the pointer is not null
QString SaveFileDialog ( const QString sTitle,
const QString sPath,
const QString sFilter,
bool  bAskForOverwrite = true,
QString sSelectedFilter = 0 
) const

Opens a modal file dialog so the user can choose a file name to save to.

Returns the path to the file.

If the user cancels out of the file dialog, an empty QString is returned.

Parameters:
[in] sTitle The title to display in the file dialog
[in] sPath The initial path to display when the file dialog opens
[in] sFilter A string that filters which kind of files should be displayed. For example: "TIFF images (*.tif);;PNG images (*.png)"
[in] bAskForOverwrite If true, when the user chooses an existing file, he will be asked if he wants to overwrite it.
[in,out] sSelectedFilter The default filter to be used, and the selected filter by the user, if the pointer is not null
QString GetDirectoryDialog ( const QString sTitle,
const QString sPath 
) const

Opens a modal file dialog so the user can choose an existing folder.

Returns the path to the folder.

If the user cancels out of the file dialog, an empty QString is returned.

Parameters:
[in] sTitle The title to display in the file dialog
[in] sPath The initial path to display when the file dialog opens
QStringList LoadFilesDialog ( const QString sTitle,
const QString sPath,
const QString sFilter 
) const

Opens a modal file dialog so the user can choose existing files to open.

Returns the paths to these files.

If the user cancels out of the file dialog, an empty QString is returned.

Parameters:
[in] sTitle The title to display in the file dialog
[in] sPath The initial path to display when the file dialog opens
[in] sFilter A QString that specifies which kind of files should be displayed. For example: "TIFF images (*.tif);;PNG images (*.png)"
void WaitCursorStart ( void  )

Show the wait cursor.

void WaitCursorEnd ( void  )

Restore the previous cursor after calling WaitCursorStart().

void RefreshUI ( void  ) const
void AddView ( QString  className,
QString  windowTitle,
const bool  select = false 
) const

Adds a view in the central widget.


Member Data Documentation

QString menuCreate [static]

Definition at line 98 of file interface.h.

QString menuCurves [static]

Definition at line 99 of file interface.h.

QString menuDisplay [static]

Definition at line 100 of file interface.h.

QString menuHelp [static]

Definition at line 101 of file interface.h.

QString menuMesh [static]
QString menuRender [static]

Definition at line 104 of file interface.h.

QString menuScripts [static]

Definition at line 105 of file interface.h.

QString menuMaps [static]
Examples:
MeshDisplace/displacer.cpp.

Definition at line 106 of file interface.h.

QString menuWindows [static]

Definition at line 107 of file interface.h.

This pointer contains the address of the currently selected brush.

Plugins can connect their own pointer of the same type to this attribute if they want to respond to brush activation events.

See also:
Attribute::Connect().

Definition at line 123 of file interface.h.

This is a pointer to the latest keyboard event.

Plugins can use this pointer to catch and respond to keyboard events. When a new event occurs, the value of this pointer changes to a structure which describes the event. The class should have it's own instance of a pointer with the same type, which should be connected to this pointer using the Attribute::AddTarget() function. The class can then catch and respond any changes made to this variable in its the OnNodeEvent() function.

Definition at line 336 of file interface.h.

This event is triggered after the Mudbox main UI window is created.

Plugins can connect to this event to add additional UI or make modifications to the existing UI widgets in the window, after the window has been created.

Definition at line 341 of file interface.h.


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

Interface Interface Interface Interface Interface Interface Interface Interface Interface Interface
Interface Interface Interface Interface Interface Interface Interface Interface Interface Interface