Kernel Class Reference


Detailed Description

The main API access point to Mudbox, contains the most basic functions and data.

There is exactly one Kernel object, you use the Kernel() global function to access it.

Definition at line 90 of file kernel.h.

#include <kernel.h>

Inheritance diagram for Kernel:
Inheritance graph
[legend]

List of all members.

Public Types

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   SceneRenderMode {
  srmNormal = 0, srmFlatTexturesOnBlack, srmFlatTexturesOnWhite, srmFlatNoTextures,
  srmNoTextures
}
 

Describes how to render the scene off-screen with RenderScene.

More...

Public Member Functions

  Kernel (void)
  Constructor. There is exactly one kernel in Mudbox, so you should never try to create one.
void  Log (const QString &sMessage)
  Writes a message to Mudbox's internal log.
void  LogMemoryStatus (bool bCompact=true)
  Logs the current memory status. For debugging purposes only.
void  LogMemoryBlocks (float fSizeLimit=0.01)
  Logs current memory blocks (which are used by the Store class).
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)
  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  AddLayerCallbackMenuItem (Interface::LayerUIType ltType, const QString &sItemName, void(*pCallback)())
Mesh CreateMesh (Topology::FaceType eType)
  Creates an empty mesh object and returns a pointer to it.
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) 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  RecordCommand (const QString &sCommand)
  Records a command to the mudbox automation file.
class Scene CreateDefaultScene (void)
  Creates a default mudbox scene and returns it.
const ClassDesc PreferredDescendant (const ClassDesc *pClass) const
  Returns the 'preferred descendant' of a public interface, which must be used to create instances.
Node CreateClassInstance (const ClassDesc *pClass) const
  Creates an instance of the preferred descendant of an interface class.
Image LoadImage (const QString &sFileName) const
  Creates a new image instance, loads a file to it, and returns the pointer.
void  GLCheckError (const char *sSourceFileName, const char *sFunctionName, unsigned int iLine) const
  Checks to see if there was an OpenGL error, and writes it to the mudbox log. Used for debugging.
void  GLCheckStates (const char *sSourceFileName, const char *sFunctionName, unsigned int iLine) const
  Checks if the opengl states are all set to their default values, and writes the result to the Mudbox log. Used for debugging.
void  Redraw (void)
  Forces a full refresh of the 3d viewport.
class Scene Scene (void) const
  Returns a pointer to the current scene.
mudbox::Preferences Preferences (void) const
  Returns a pointer to the preferences.
class mudbox::Interface Interface (void) const
  Returns a pointer to the interface.
class Statistics Statistics (void) const
  Returns a pointer to the program statistics.
class ViewPort ViewPort (void) const
  Returns a pointer to the current viewport.
QWidget *  MainWindow (void) const
  Returns a pointer to the main window.
QString  MudboxVersionName (void) const
  Returns a QString containing the version name of the application.
void  AddView (QString className, QString windowTitle, const bool select=false) const
  Adds a view in the central widget.
void  RegisterWindowPlugin (WindowPlugin *plugin) const
  Registers the Mudbox Community web browser.
mudbox::TrayAccessor TrayAccessor (void) const
  Returns a pointer to the tray accessor.
bool  ExtractArchiveFile (QString sArchiveFilePath, QString sDestPath)
  Extracts an archived file to destination.
bool  CreateArchiveFile (QString sArchiveFilePath, QStringList files)
void  AddToCreateMeshMenu (QFileInfo fileInfo)
  Adds a mesh to the Create->Mesh menu.
QString  DataDirectory (void) const
  Returns the path to the data directory set by the user.
QString  ApplicationDirectory (void) const
  Returns the path to where the Mudbox application is installed.
QString  ProjectFilesDirectory (void) const
  Returns the path of the project files.
QString  SafeWritableDirectory (void) const
  Returns the root path to where the application can safely write files.
QString  PluginDirectory (const QString &pluginName) const
  Returns the path from which the specified plugin was loaded.
bool  IsTestModeOn (void) const
  Returns true if the application is in testing mode (i.e.
bool  IsBetaVersion (void) const
  Returns true if the application is a beta/alpha version.
void  RefreshUI (void) const
  Refresh all dialogs.
Image RenderScene (const QString &sChannel, int iWidth, int iHeight, SceneRenderMode renderMode, enum Image::Format fmt=Image::e8integer, bool bTiledImg=true)
  Renders the scene, and returns it in an image.
Image RenderScene (int iWidth, int iHeight, SceneRenderMode renderMode, enum Image::Format fmt=Image::e8integer, bool bTiledImg=true)
  Renders the scene, and returns it in an image.
Image RenderScene (int iWidth, int iHeight, enum Image::Format fmt=Image::e8integer, bool bTiledImg=true) const
  Renders the scene, including background and post-process filters, and returns it in an image.
Image ExtractUnprojectedTextures (const QString &sChannel, int iWidth, int iHeight, enum Image::Format fmt=Image::e8integer, bool bTiledImg=false)
  Creates a 4 channel image containing the unprojected textures of the scene using the current camera position and settings.
Image ExtractUnprojectedTextures (int iWidth, int iHeight, enum Image::Format fmt=Image::e8integer, bool bTiledImg=false)
Image ExtractShadingMap (int iWidth, int iHeight, enum Image::Format fmt=Image::e8integer, bool bTiledImg=false)
  Creates a 4 channel image containing the shading of the scene using the current camera position and settings.
int  ViewportWidth () const
  Returns the current width of the viewport in pixels.
int  ViewportHeight () const
  Returns the current height of the viewport in pixels.
class XRef XRef () const
  Returns the xref resolver used by the application.
void  ReportVideoMemoryUsage (qint64 iSize)
  Informs the kernel of video memory usage changes.
qint64  VideoMemoryUsage (void) const
  Returns the total amount of video memory currently in use in bytes.
qint64  TotalVideoMemory (void) const
  Returns the total amount of video memory detected in the system, in bytes.
bool  DoOperation (Operation *pOp, bool bMerge=false)
  This function executes an operation and makes it possible to undo/redo the operation later.
void  FlushUndoQueue ()
  This function flushes the undo/redo queue.
QString  TriggerFileEvent (FileEventNotifier::Type eType, const QString &sFileName) const
  Trigger a file event.

Public Attributes

astring  NextCommand
  This attribute always contains the next command. Plugins can link their own attribute to this one, and can process commands this way. See RecordCommand().
aevent  PreRenderEvent
  This event is triggered when a new frame is about to be drawn.
aevent  FrameEvent
  This event is triggered when a new frame is displayed on the viewport. See the class EventGate for more details.
aevent  StrokeBeginEvent
  This event is triggered when a new stroke is started. See the class EventGate for more details.
aevent  StrokeEndEvent
  This event is triggered when a stroke has ended. See the class EventGate for more details.
aevent  EndRenderEvent
  This event is triggered when rendering a new image of the scene is finished. See the class EventGate for more details.
aevent  TangentMirrorUpdateEvent
  This event is triggered when tangent mirror information is updated.
aevent  GeometryAddedEvent
  This event is triggered when a new geometry is added to the scene, or a new scene which is not empty is created.
aevent  GeometryRemovedEvent
  This event is triggered when a geometry is removed from the scene.
aevent  GeometryAboutToRemovedEvent
  This event is triggered when a geometry is going to be removed from the scene.
aevent  GeometryTransformedEvent
  This event is triggered when a geometry is transformed by translate/rotate/scale tools.
aevent  LowMemoryEvent
  This event is triggered when the memory status gets critical.
aevent  RestoreMemoryEvent
  This event is triggered when memory status is no longer critical.
aevent  PostRenderEvent
  This event is triggered at the end of rendering the scene into a rendertarget.
aptr< FileEventNotifier FileEvent
  This is a pointer to the latest file event.
aptr< KeyboardEventNotifier KeyboardEvent
  This is a pointer to the latest keyboard event.
aptr< Node SelectedNode
  This pointer contains the address of the currently selected node in the scene.
aptr< BrushOperation SelectedBrush
  This pointer contains the address of the currently selected brush.
aptr< Geometry m_pGeometryToAdd
  This pointer contains the address of the currently mesh being imported/loaded.
aevent  PostUIInitializationEvent
  This event is triggered after the Mudbox main UI window is created.
aevent  PaintSelectionEvent
  This event is triggered when selection set of faces vary, i.e. more faces or less faces are selected.
aevent  PaintLayerAddedEvent
  This event is triggered after a paint layer is created.
aevent  PaintLayerRemovedEvent
  This event is triggered after a paint layer is deleted.
aevent  ScenePreDeletedEvent
  This event is triggered before a scene is going to be deleted.

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:
buttonNone 
buttonOk 
buttonCancel 
buttonClose 
buttonYes 
buttonYesToAll 
buttonNo 
buttonNoToAll 
buttonAbort 
buttonRetry 
buttonIgnore 
buttonHelp 

Definition at line 103 of file kernel.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 118 of file kernel.h.

enum StatusType
Enumerator:
stNormal 

message

stWarning 

warning

stError 

error

Definition at line 124 of file kernel.h.

Describes how to render the scene off-screen with RenderScene.

Enumerator:
srmNormal 

Renders the scene as it would appear in the interactive viewport.

srmFlatTexturesOnBlack 

flat shaded, textures on black material background, no grids, curves or background

srmFlatTexturesOnWhite 

flat shaded, textures on white material background, no grids, curves or background

srmFlatNoTextures 

flat shaded, no textures, grids, curves or background

srmNoTextures 

flat shading off, textures off, no grids, curves or background

Definition at line 484 of file kernel.h.


Constructor & Destructor Documentation

Kernel ( void  )

Constructor. There is exactly one kernel in Mudbox, so you should never try to create one.


Member Function Documentation

void Log ( const QString &  sMessage )

Writes a message to Mudbox's internal log.

The log can be viewed inside Mudbox in the "log" view, or by readin the mudbox.log file written by the application. (located at your documents/Mudbox/2009/data/Logs/mudbox.log on windows)

Examples:
PLYImport/Importer.cpp.
void LogMemoryStatus ( bool  bCompact = true )

Logs the current memory status. For debugging purposes only.

Parameters:
[in] bCompact If true, write the status in a more compact form.
void LogMemoryBlocks ( float  fSizeLimit = 0.01 )

Logs current memory blocks (which are used by the Store class).

Blocks smaller than fSizeLimit*(largest block size) will not be logged. This call is mostly used to detect memory leaks.

Parameters:
[in] fSizeLimit Specifies the minimum size of block that will be logged (this value times the largest block)
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 Kernel::msgInformation, Kernel::msgWarning, Kernel::msgQuestion or Kernel::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 Kernel::msgInformation, Kernel::msgWarning, Kernel::msgQuestion or Kernel::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 
)

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 Kernel::HUDmsgPin or Kernel::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 Kernel::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 Kernel::stNormal, Kernel::stWarning, or Kernel::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()->AddClassMenuItem( Kernel::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.
void AddLayerCallbackMenuItem ( Interface::LayerUIType  ltType,
const QString &  sItemName,
void(*)()  pCallback 
)
Mesh* CreateMesh ( Topology::FaceType  eType )

Creates an empty mesh object and returns a pointer to it.

Mesh objects must be entirely triangles, or entirely quads.

Parameters:
[in] eType The mesh type, one of Topology::typeTriangular or Topology::typeQuadric
Examples:
PLYImport/Importer.cpp.
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 
) 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)"
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] sSelectedFilter The filter that should be used by default
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 RecordCommand ( const QString &  sCommand )

Records a command to the mudbox automation file.

As commands are executed in Mudbox, it records them into an automation file so that they can be played back later, usually for testing or debugging purposes. If you want your plugin actions to be recorded, call this method to record what it did. The format of this recordins should be a unique name for the command, followed by a list of arguments.

Note: this method takes the same arguments as standard printf, making it easy to specify arguments in your call.

If you record your plugin commands, then you also need to be able to play them back from your recording. To do this, define a variable of type astring in your plugin, and connect it to the m_sNextCommand variable of the Kernel, which always contains the string value of the next command to be performed. This connection is done like this:

        astring myNextCommand;
        ...
        myNextCommand.Connect( Kernel()->m_sNextCommand );

Once you have done this, myNextCommand will change every time the variable in the Kernel changes, and you can capture that even to see if it is your command string. If it is, you run the command like this:

        void myClass::OnNodeEvent( const Attribute &cAttribute, NodeEventType eType )
        {
            if ( eType == etValueChanged && cAttribute == myNextCommand )
            {
                // get the first word in the command
                String sOperation = myNextCommand.Value().Section( ' ', 0 ); 
                if ( sOperation == "myCommandName" ){
                    ...get arguments and process your command here
class Scene* CreateDefaultScene ( void  )

Creates a default mudbox scene and returns it.

const ClassDesc* PreferredDescendant ( const ClassDesc pClass ) const

Returns the 'preferred descendant' of a public interface, which must be used to create instances.

In the mudbox SDK you will find lots of interfaces defined without any functionality, such as Texture and Image. Plugins can implement these interfaces by defining their own classes inherited from an SDK interface. When the functionality is needed somewhere, then this function can tell you what the best available implementation is. You can then create one instance of that class and access the functionality you need. You should use the CreateInstance() global templated function to create those object. (It uses PreferredDescendant() internally, but provides a more comfortable way to access those functionalities.)

Node* CreateClassInstance ( const ClassDesc pClass ) const

Creates an instance of the preferred descendant of an interface class.

See PreferredDescendant() for more details. We recommend using the CreateInstance() global function instead of this.

Image* LoadImage ( const QString &  sFileName ) const

Creates a new image instance, loads a file to it, and returns the pointer.

It is the responsibility of the caller to delete the returned Image.

/b Note: This function will be removed from future releases of the SDK.

Parameters:
[in] sFileName Path of the image file to be opened.
void GLCheckError ( const char *  sSourceFileName,
const char *  sFunctionName,
unsigned int  iLine 
) const

Checks to see if there was an OpenGL error, and writes it to the mudbox log. Used for debugging.

Parameters:
[in] sSourceFileName The name of the file where this is being called
[in] sFunctionName The name of the function from which this is being called
[in] iLine The line number where this is being called
void GLCheckStates ( const char *  sSourceFileName,
const char *  sFunctionName,
unsigned int  iLine 
) const

Checks if the opengl states are all set to their default values, and writes the result to the Mudbox log. Used for debugging.

Parameters:
[in] sSourceFileName The name of the file where this is being called
[in] sFunctionName The name of the function from which this is being called
[in] iLine The line number where this is being called
void Redraw ( void  )

Forces a full refresh of the 3d viewport.

This function is obsolete, use ViewPort::Redraw instead.

Examples:
SampleViewportFilter/SampleViewportFilter.cpp, and TextureSwapperViewportFilter/TextureSwapperViewportFilter.cpp.
class Scene* Scene ( void  ) const

Returns a pointer to the current scene.

Examples:
SampleViewportFilter/SampleViewportFilter.cpp.
mudbox::Preferences* Preferences ( void  ) const

Returns a pointer to the preferences.

class mudbox::Interface* Interface ( void  ) const

Returns a pointer to the interface.

class Statistics* Statistics ( void  ) const

Returns a pointer to the program statistics.

class ViewPort* ViewPort ( void  ) const

Returns a pointer to the current viewport.

QWidget* MainWindow ( void  ) const

Returns a pointer to the main window.

QString MudboxVersionName ( void  ) const

Returns a QString containing the version name of the application.

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

Adds a view in the central widget.

void RegisterWindowPlugin ( WindowPlugin plugin ) const

Registers the Mudbox Community web browser.

Returns a pointer to the tray accessor.

bool ExtractArchiveFile ( QString  sArchiveFilePath,
QString  sDestPath 
)

Extracts an archived file to destination.

bool CreateArchiveFile ( QString  sArchiveFilePath,
QStringList  files 
)
void AddToCreateMeshMenu ( QFileInfo  fileInfo )

Adds a mesh to the Create->Mesh menu.

QString DataDirectory ( void  ) const

Returns the path to the data directory set by the user.

QString ApplicationDirectory ( void  ) const

Returns the path to where the Mudbox application is installed.

QString ProjectFilesDirectory ( void  ) const

Returns the path of the project files.

QString SafeWritableDirectory ( void  ) const

Returns the root path to where the application can safely write files.

QString PluginDirectory ( const QString &  pluginName ) const

Returns the path from which the specified plugin was loaded.

bool IsTestModeOn ( void  ) const

Returns true if the application is in testing mode (i.e.

was started with the -test command line parameter).

bool IsBetaVersion ( void  ) const

Returns true if the application is a beta/alpha version.

void RefreshUI ( void  ) const

Refresh all dialogs.

Image* RenderScene ( const QString &  sChannel,
int  iWidth,
int  iHeight,
SceneRenderMode  renderMode,
enum Image::Format  fmt = Image::e8integer,
bool  bTiledImg = true 
)

Renders the scene, and returns it in an image.

Does not include extra things like the HUD or the cursor ring. Returns a pointer to an image object that the scene was rendered into. You can specify the desired size for the rendering, or leave the input variables set to 0 to render at the current screen resolution.

You can also describe a render mode -- the different render modes can be used together to extract unprojected textures or extract shading/shadow information.

currently only 8 bit images are supported by this operation Note: Once the image is returned, it is your responsibility to delete it when you are done with it.

Parameters:
[in] sChannel the name of the channel to render
[in] iWidth The width of the rendering in pixels. Set to 0 to use current screen size.
[in] iHeight The height of the rendering in pixels. Set to 0 to use current screen size.
renderMode describes variations on how to render the scene.
[in] fmt Desired image format.
[in] bTiledImg hint -- true if the resulting image is to be tiled, false if contiguous.
Image* RenderScene ( int  iWidth,
int  iHeight,
SceneRenderMode  renderMode,
enum Image::Format  fmt = Image::e8integer,
bool  bTiledImg = true 
)

Renders the scene, and returns it in an image.

Does not include extra things like the HUD or the cursor ring. Returns a pointer to an image object that the scene was rendered into. You can specify the desired size for the rendering, or leave the input variables set to 0 to render at the current screen resolution.

You can also describe a render mode -- the different render modes can be used together to extract unprojected textures or extract shading/shadow information.

currently only 8 bit images are supported by this operation Note: Once the image is returned, it is your responsibility to delete it when you are done with it.

Parameters:
[in] iWidth The width of the rendering in pixels. Set to 0 to use current screen size.
[in] iHeight The height of the rendering in pixels. Set to 0 to use current screen size.
renderMode describes variations on how to render the scene.
[in] fmt Desired image format.
[in] bTiledImg hint -- true if the resulting image is to be tiled, false if contiguous.
Image* RenderScene ( int  iWidth,
int  iHeight,
enum Image::Format  fmt = Image::e8integer,
bool  bTiledImg = true 
) const

Renders the scene, including background and post-process filters, and returns it in an image.

Does not include extra things like the HUD or the cursor ring. Returns a pointer to an image object that the scene was rendered into. You can specify the desired size for the rendering, or leave the input variables set to 0 to render at the current screen resolution.

currently only 8 bit images are supported by this operation Note: Once the image is returned, it is your responsibility to delete it when you are done with it.

Parameters:
[in] iWidth The width of the rendering in pixels. Set to 0 to use current screen size.
[in] iHeight The height of the rendering in pixels. Set to 0 to use current screen size.
[in] fmt Desired image format.
[in] bTiledImg hint -- true if the resulting image is to be tiled, false if contiguous.
Image* ExtractUnprojectedTextures ( const QString &  sChannel,
int  iWidth,
int  iHeight,
enum Image::Format  fmt = Image::e8integer,
bool  bTiledImg = false 
)

Creates a 4 channel image containing the unprojected textures of the scene using the current camera position and settings.

The image will be rendered at the specified size, or if the specified width and height are 0, it will use the current viewport size. currently only 8 bit images are supported by this operation Resulting images currently must be untiled.

Parameters:
[in] sChannel the name of the channel to render
[in] iWidth The width of the rendering in pixels. Set to 0 to use current screen size.
[in] iHeight The height of the rendering in pixels. Set to 0 to use current screen size.
[in] fmt Desired image format. Currently must be e8integer
[in] bTiledImg hint -- true if the resulting image is to be tiled, false if contiguous.
Image* ExtractUnprojectedTextures ( int  iWidth,
int  iHeight,
enum Image::Format  fmt = Image::e8integer,
bool  bTiledImg = false 
)
Parameters:
[in] iWidth The width of the rendering in pixels. Set to 0 to use current screen size.
[in] iHeight The height of the rendering in pixels. Set to 0 to use current screen size.
[in] fmt Desired image format. Currently must be e8integer
[in] bTiledImg hint -- true if the resulting image is to be tiled, false if contiguous.
Image* ExtractShadingMap ( int  iWidth,
int  iHeight,
enum Image::Format  fmt = Image::e8integer,
bool  bTiledImg = false 
)

Creates a 4 channel image containing the shading of the scene using the current camera position and settings.

The image will be rendered at the specified size, or if the specified width and height are 0, it will use the current viewport size. The result of this image, blended over a flat shaded version of the scene will appear as though the shading and shadowing were turned on. currently only 8 bit images are supported by this operation Resulting images currently must be untiled.

Parameters:
[in] iWidth The width of the rendering in pixels. Set to 0 to use current screen size.
[in] iHeight The height of the rendering in pixels. Set to 0 to use current screen size.
[in] fmt Desired image format. Currently must be e8integer
[in] bTiledImg hint -- true if the resulting image is to be tiled, false if contiguous.
int ViewportWidth ( ) const

Returns the current width of the viewport in pixels.

int ViewportHeight ( ) const

Returns the current height of the viewport in pixels.

class XRef* XRef ( ) const

Returns the xref resolver used by the application.

void ReportVideoMemoryUsage ( qint64  iSize )

Informs the kernel of video memory usage changes.

When a plugin allocates or frees video memory, it should call this function to inform mudbox about the change. If it doesn't call this function, then Mudbox will not know how much video memory is available. This information is used to optimize some operations. When video memory is deallocated, the iSize parameter should be negative.

Parameters:
[in] iSize The amount of video memory memory used (positive numbers) or released (negative numbers) in bytes
qint64 VideoMemoryUsage ( void  ) const

Returns the total amount of video memory currently in use in bytes.

qint64 TotalVideoMemory ( void  ) const

Returns the total amount of video memory detected in the system, in bytes.

bool DoOperation ( Operation pOp,
bool  bMerge = false 
)

This function executes an operation and makes it possible to undo/redo the operation later.

If a plugin wants an operation to be undoable, it must execute the operation using this function call.

See also:
mudbox::Operation
Parameters:
[in] pOp Address of the operation which has to be executed.
[in] bMerge When this parameter is true, this operation will be undone/redone in a common step with the previous one.
void FlushUndoQueue ( )

This function flushes the undo/redo queue.

You may want to call this function if you do something not undoable and don't want to go back.

QString TriggerFileEvent ( FileEventNotifier::Type  eType,
const QString &  sFileName 
) const

Trigger a file event.

The returned filepath can be different than the one passed as parameter.

The mudbox kernel triggers file events every time when it: 1. About to open a file for reading 2. About to open a file for writing 3. Read a file 4. Wrote a file 5. About to let the user browse for a file to read 6. About to let the user browse for a file to write When a file operation happens in Mudbox, the events listed above are triggered. If your plugins reads or writes files, they should trigger the appropriate events by calling this method. The returned string is the filename, which is usually the same as the passed sFileName, but it might be modified by an entity that intercepted the file event.

Parameters:
[in] eType One of FileEventNotifier::typeBrowseForRead, FileEventNotifier::typeBrowseForWrite, FileEventNotifier::typePreRead, FileEventNotifier::typePostRead, FileEventNotifier::typePreWrite or FileEventNotifier::typePostWrite
[in] sFileName The filepath that is the intended target of the operation. This can be changed by whoever intercepts the event.

Member Data Documentation

QString menuFile [static]

Definition at line 131 of file kernel.h.

QString menuEdit [static]

Definition at line 132 of file kernel.h.

QString menuCreate [static]

Definition at line 133 of file kernel.h.

QString menuCurves [static]

Definition at line 134 of file kernel.h.

QString menuDisplay [static]

Definition at line 135 of file kernel.h.

QString menuHelp [static]

Definition at line 136 of file kernel.h.

QString menuPlugins [static]

Definition at line 137 of file kernel.h.

QString menuMesh [static]

Definition at line 138 of file kernel.h.

QString menuRender [static]

Definition at line 139 of file kernel.h.

QString menuScripts [static]

Definition at line 140 of file kernel.h.

QString menuMaps [static]

Definition at line 141 of file kernel.h.

QString menuWindows [static]

Definition at line 142 of file kernel.h.

This attribute always contains the next command. Plugins can link their own attribute to this one, and can process commands this way. See RecordCommand().

Definition at line 367 of file kernel.h.

This event is triggered when a new frame is about to be drawn.

Definition at line 633 of file kernel.h.

This event is triggered when a new frame is displayed on the viewport. See the class EventGate for more details.

Definition at line 636 of file kernel.h.

This event is triggered when a new stroke is started. See the class EventGate for more details.

Definition at line 639 of file kernel.h.

This event is triggered when a stroke has ended. See the class EventGate for more details.

Definition at line 642 of file kernel.h.

This event is triggered when rendering a new image of the scene is finished. See the class EventGate for more details.

Definition at line 645 of file kernel.h.

This event is triggered when tangent mirror information is updated.

Definition at line 648 of file kernel.h.

This event is triggered when a new geometry is added to the scene, or a new scene which is not empty is created.

Definition at line 651 of file kernel.h.

This event is triggered when a geometry is removed from the scene.

Definition at line 654 of file kernel.h.

This event is triggered when a geometry is going to be removed from the scene.

Definition at line 657 of file kernel.h.

This event is triggered when a geometry is transformed by translate/rotate/scale tools.

Definition at line 660 of file kernel.h.

This event is triggered when the memory status gets critical.

Plugins should deallocate temporary buffers to help the situation. See the class EventGate for more details.

Definition at line 666 of file kernel.h.

This event is triggered when memory status is no longer critical.

Plugins can allocate their temporary buffers and fill them with data if they wish. See the class EventGate for more details.

Definition at line 670 of file kernel.h.

This event is triggered at the end of rendering the scene into a rendertarget.

Plugins can use this event to render additional content to the rendertargets, like gizmos or overlays. See the class EventGate for more details.

Definition at line 674 of file kernel.h.

aptr<FileEventNotifier> FileEvent [mutable]

This is a pointer to the latest file event.

Plugins can use this pointer to catch file event. When a new file event is triggered, this pointer will change its value to the new file event. Plugins can also have their own pointer with the same type. At startup they can connect their pointer to this pointer in kernel by calling the Connect() function on their pointer. This means that when the FileEvent pointer in kernel changes, their own pointer will also change. They can then catch this in their OnNodeEvent() function. Using this pointer to anything else than connecting an own pointer to it is forbidden.

Definition at line 702 of file kernel.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::Connect() function. The class can then catch and respond any changes made to this variable in its the OnNodeEvent() function.

Definition at line 710 of file kernel.h.

This pointer contains the address of the currently selected node in the scene.

Plugins can connect their own pointers of the same type to this attribute to respond to selection related events.

See also:
Attribute::Connect().

Definition at line 714 of file kernel.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 718 of file kernel.h.

This pointer contains the address of the currently mesh being imported/loaded.

This pointer will be set to 0 right after the import fineshed. 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(). In the future this aptr will be moved to the Scene class, but the problem currently is that if the plugin connect to this aptr of a scene, the plugin will catch the node event after the scene is different, for example new scene is created.

Definition at line 725 of file kernel.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 730 of file kernel.h.

This event is triggered when selection set of faces vary, i.e. more faces or less faces are selected.

Definition at line 733 of file kernel.h.

This event is triggered after a paint layer is created.

Definition at line 736 of file kernel.h.

This event is triggered after a paint layer is deleted.

Definition at line 739 of file kernel.h.

This event is triggered before a scene is going to be deleted.

Definition at line 742 of file kernel.h.


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

Kernel Kernel Kernel Kernel Kernel Kernel Kernel Kernel Kernel Kernel
Kernel Kernel Kernel Kernel Kernel Kernel Kernel Kernel Kernel Kernel