#include <kernel.h>
The main API access point to Mudbox, contains low level functions and data.
There is exactly one Kernel object, you use the Kernel() global function to access it.
Public Member Functions | |
Kernel (void) | |
Constructor. There is exactly one kernel in Mudbox, so you should never try to create one. More... | |
void | Log (const QString &sMessage) |
Writes a message to Mudbox's internal log. More... | |
DumpFcnTyp | GetImageStatsFcn () const |
void | SetImageStatsFcn (DumpFcnTyp f) |
DumpFcnTyp | GetPaintBufferStatsFcn () const |
void | SetPaintBufferStatsFcn (DumpFcnTyp f) |
MBCrashInfo * | GetCrashInfo () |
void | SetCrashHelpString (const QString &st) |
void | AddStringToCrashBuffer (const QString &prefix, const QString &entry) |
void | LogMemoryStatus (bool bCompact=true) |
Logs the current memory status. For debugging purposes only. More... | |
void | LogMemoryBlocks (float fSizeLimit=0.01) |
Logs current memory blocks (which are used by the Store class). More... | |
bool | CreateNewScene () |
Creates a new scene. More... | |
void | RecordCommand (const QString &sCommand) |
Records a command to the mudbox automation file. More... | |
class Scene * | CreateDefaultScene (void) |
Creates a default mudbox scene and returns it. More... | |
const ClassDesc * | PreferredDescendant (const ClassDesc *pClass) const |
Returns the 'preferred descendant' of a public interface, which must be used to create instances. More... | |
Node * | CreateClassInstance (const ClassDesc *pClass) const |
Creates an instance of the preferred descendant of an interface class. More... | |
Image * | LoadImage (const QString &sFileName, bool tiled=false) const |
Creates a new image instance, loads a file to it, and returns the pointer. More... | |
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. More... | |
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. More... | |
void | Redraw (void) |
Forces a full refresh of the 3d viewport. More... | |
class Scene * | Scene (void) const |
Returns a pointer to the current scene. More... | |
mudbox::Preferences * | Preferences (void) const |
Returns a pointer to the preferences. More... | |
class mudbox::Interface * | Interface (void) const |
Returns a pointer to the interface. More... | |
class Statistics * | Statistics (void) const |
Returns a pointer to the program statistics. More... | |
class ViewPort * | ViewPort (void) const |
Returns a pointer to the current viewport. More... | |
QString | MudboxVersionName (void) const |
Returns a QString containing the version name of the application. More... | |
QString | MudboxBuildID (void) const |
Returns a QString containg the build id of the application. More... | |
void | RegisterWindowPlugin (WindowPlugin *plugin) const |
Registers the Mudbox Community web browser. More... | |
mudbox::TrayAccessor * | TrayAccessor (void) const |
Returns a pointer to the tray accessor. More... | |
bool | ExtractArchiveFile (QString sArchiveFilePath, QString sDestPath) |
Extracts an archived file to destination. More... | |
bool | CreateArchiveFile (QString sArchiveFilePath, QStringList files) |
QString | DataDirectory (void) const |
Returns the path to the data directory set by the user. More... | |
QString | ApplicationDirectory (void) const |
Returns the path to where the Mudbox application is installed. More... | |
QString | ProjectFilesDirectory (void) const |
Returns the path of the project files. More... | |
QString | SafeWritableDirectory (void) const |
Returns the root path to where the application can safely write files. More... | |
QString | PluginDirectory (const QString &pluginName) const |
Returns the path from which the specified plugin was loaded. More... | |
int | CommandLineParameterCount (void) const |
returns the total number of command line paraters More... | |
QString | CommandLineParameterName (int iIndex) const |
Returns the name of the specified command line parameter. More... | |
QString | CommandLineParameterValue (int iIndex) const |
Returns the value of the given command line parameter. More... | |
bool | IsTestModeOn (void) const |
Returns true if the application is in testing mode (i.e. More... | |
bool | IsBetaVersion (void) const |
Returns true if the application is a beta/alpha version. More... | |
Image * | ExtractUnprojectedTextures (const QString &sChannel, int iWidth, int iHeight, enum Image::Format fmt=Image::e8integer, bool bTiledImg=false, bool allLayers=false) |
Creates a 4 channel image containing the unprojected textures of the scene using the current camera position and settings. More... | |
Image * | ExtractUnprojectedTextures (int iWidth, int iHeight, enum Image::Format fmt=Image::e8integer, bool bTiledImg=false, bool allLayers=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. More... | |
class XRef * | XRef () const |
Returns the xref resolver used by the application. More... | |
void | ReportVideoMemoryUsage (qint64 iSize) |
Informs the kernel of video memory usage changes. More... | |
qint64 | VideoMemoryUsage (void) const |
Returns the total amount of video memory currently in use in bytes. More... | |
qint64 | TotalVideoMemory (void) const |
Returns the total amount of video memory detected in the system, in bytes. More... | |
bool | DoOperation (Operation *pOp, bool bMerge=false) |
This function executes an operation and makes it possible to undo/redo the operation later. More... | |
const QList< class ImageIOHandler * > & | ExternalImageIOHandlers (void) const |
void | FlushUndoQueue () |
This function flushes the undo/redo queue. More... | |
QString | TriggerFileEvent (FileEventNotifier::Type eType, const QString &sFileName) const |
Trigger a file event. More... | |
Public Member Functions inherited from Node | |
Node (const QString &sStringID="", const QString &sDisplayName="") | |
Standard constructor. More... | |
virtual | ~Node (void) |
virtual void | Initialize (void) |
void | LoadTemplate (const QString &sFileName="", bool bStartEvent=false) |
Use an external XML file to initialize the attributes. More... | |
void | SaveTemplate (const QString &sFileName="", bool bSaveOnlyVisible=false) |
Save current attributes as an XML template. More... | |
unsigned int | Version (void) const |
Returns the current version of the node. This number increases when the content of the node changed (when ContentChanged() called). More... | |
void | SetVersion (unsigned int iVersion) |
Sets the current version number for the node. More... | |
unsigned int | ReferenceCount (void) const |
Returns the number of pointers referencing this node. More... | |
Attribute * | ReferencePointer (unsigned int iIndex) const |
Returns the address of an attribute which refers to this node. The type of the attribute is always aptr. More... | |
Node * | ReferenceNode (unsigned int iIndex) const |
Returns the address of a node referencing this node. More... | |
virtual QString | Name (const ClassDesc *pClass=0) const |
Deprecated. More... | |
virtual void | SetName (const QString &sName) |
Deprecated. More... | |
virtual QString | StringID (const ClassDesc *pClass=0) const |
Returns the string id of the node. More... | |
virtual void | SetStringID (const QString &sStringID) |
Sets the string id of the node. More... | |
virtual QString | DisplayName (void) const |
Returns the display name of the node. More... | |
virtual void | SetDisplayName (const QString &sDisplayName) |
Sets the display name of the node. More... | |
virtual QString | HelpID (void) const |
Returns the help entry id of the node. Can be overwritten in derived classes. More... | |
virtual void | SetHelpID (const QString &sHelpID) |
Sets the help entry id of the node. More... | |
void | Annex (Node *pSource, const QString &sCategory="") |
Relink all the attributes of the source node to this one. More... | |
virtual void | Serialize (Stream &s) |
Serializes the node. More... | |
bool | IsKindOf (const ClassDesc *pClass) const |
Returns true if this node is derived from the pClass class. More... | |
void | ContentChanged (void) const |
This function must be called if the content of the node is changed. More... | |
virtual void | CheckValidity (DiagnosticLevel iLevel=dgnLevel2) const |
Checks the validity of this node. More... | |
virtual void | CopyTo (Node *pNode) const |
virtual Node * | Duplicate (void) const |
virtual void | OnNodeEvent (const Attribute &cAttribute, NodeEventType cType) |
This function is called if an event occurs with any of the attributes of the node. More... | |
virtual void | OnEvent (const EventGate &cEvent) |
This function is called when a generic event occurs. See EventGate class. More... | |
void | RequestDeferredEvent (Attribute &cAttribute) |
Request for a deferred event, which will occur only in the main loop. More... | |
unsigned int | AttributeCount (void) const |
Returns the number of attributes owned by the node. More... | |
Attribute * | AttributeByIndex (int iIndex) const |
Returns a specified attribute (or 0 if iIndex is greater than the number of attributes). More... | |
Attribute * | AttributeByName (const QString &sName) const |
Returns a specified attribute by its name. Returns 0 if the attribute not found. More... | |
Attribute * | AttributeByID (const QString &sID) const |
Returns a specified attribute by its ID. Returns 0 if the attribute not found. More... | |
void | SetAttributeValue (const QString &sAttributeID, const QString &sNewValue) |
Set the value of an attribute from a string. More... | |
QString | AttributeValue (const QString &sAttributeID) const |
Returns the current value of an attribute as a string. More... | |
void | LogAttributes (void) const |
Write all attributes into the log file. More... | |
virtual QWidget * | CreatePropertiesWindow (QWidget *pParent) |
Create a window which displays the attributes of the node. Can be overriden to provide a custom interface. More... | |
Attribute * | AddAttribute (Attribute::AttributeType type, const QString &id) |
Allows SDK users to add attributes at runtime. More... | |
Node * | Next (void) const |
Returns the next node in the chain. Used to enumerate the current nodes. See also First(). More... | |
int | ID (void) const |
Returns an ID for the node. The ID is unique in the whole application life. More... | |
bool | SetID (int iID) |
Set ID for the node. More... | |
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(). More... | |
aevent | StrokeBeginEvent |
This event is triggered when a new stroke is started. See the class EventGate for more details. More... | |
aevent | StrokeEndEvent |
This event is triggered when a stroke has ended. See the class EventGate for more details. More... | |
aevent | TangentMirrorUpdateEvent |
This event is triggered when tangent mirror information is updated. More... | |
aevent | LowMemoryEvent |
This event is triggered when the memory status gets critical. More... | |
aevent | RestoreMemoryEvent |
This event is triggered when memory status is no longer critical. More... | |
aevent | PostUndoRedoEvent |
This event is triggered after an undo or redo operation is completed. More... | |
aptr< FileEventNotifier > | FileEvent |
This is a pointer to the latest file event. More... | |
aevent | ScenePreDeletedEvent |
This event is triggered before a scene is going to be deleted. More... | |
Public Attributes inherited from Node | |
AttributeThisPointer | m_pThis |
DECLARE_CLASS | |
Additional Inherited Members | |
Public Types inherited from Node | |
enum | DiagnosticLevel { dgnLevel1, dgnLevel2, dgnLevel3 } |
Indicates the level of validity checking that is performed in CheckValidity() More... | |
Static Public Member Functions inherited from Node | |
static void | StartHashing () |
This is called once in main once static ctors are done. More... | |
static Node * | First (void) |
This function will return the first node in the memory. Used to enumerate all the current nodes. See also Next(). More... | |
static Node * | ByID (int iID) |
Returns the node with the specified ID, or zero if such a node does not exists. More... | |
static Node * | ByName (const QString &sClass, const QString &sName) |
Search for a node with the name sName. More... | |
Constructor. There is exactly one kernel in Mudbox, so you should never try to create one.
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)
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void LogMemoryStatus | ( | bool | bCompact = true | ) |
Logs the current memory status. For debugging purposes only.
[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.
[in] | fSizeLimit | Specifies the minimum size of block that will be logged (this value times the largest block) |
bool CreateNewScene | ( | ) |
Creates a new scene.
If the current scene has been modified since it was opened, the user will be prompted to save it before it is replaced by the new scene. If the user chooses to cancel, this will return false. Otherwise this method will return true.
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:
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:
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.)
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.
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.
[in] | sFileName | Path of the image file to be opened. |
[in] | tiled | true if the image is to be versioned and tiled. |
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.
[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.
[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 |
Forces a full refresh of the 3d viewport.
This function is obsolete, use ViewPort::Redraw instead.
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.
Returns a QString containing the version name of the application.
void RegisterWindowPlugin | ( | WindowPlugin * | plugin | ) | const |
Registers the Mudbox Community web browser.
mudbox::TrayAccessor* TrayAccessor | ( | void | ) | const |
Returns a pointer to the tray accessor.
Extracts an archived file to destination.
bool CreateArchiveFile | ( | QString | sArchiveFilePath, |
QStringList | files | ||
) |
Returns the path to where the Mudbox application is installed.
Returns the root path to where the application can safely write files.
Returns the path from which the specified plugin was loaded.
Returns the name of the specified command line parameter.
Returns the value of the given command line parameter.
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.
Image* ExtractUnprojectedTextures | ( | const QString & | sChannel, |
int | iWidth, | ||
int | iHeight, | ||
enum Image::Format | fmt = Image::e8integer , |
||
bool | bTiledImg = false , |
||
bool | allLayers = 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.
[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. |
[in] | allLayers | all the layers, or only the current one |
Image* ExtractUnprojectedTextures | ( | int | iWidth, |
int | iHeight, | ||
enum Image::Format | fmt = Image::e8integer , |
||
bool | bTiledImg = false , |
||
bool | allLayers = false |
||
) |
[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. |
[in] | allLayers | all the layers, or only the current one |
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.
[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. |
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.
[in] | iSize | The amount of video memory memory used (positive numbers) or released (negative numbers) in bytes |
Returns the total amount of video memory currently in use in bytes.
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.
[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. |
const QList<class ImageIOHandler *>& ExternalImageIOHandlers | ( | void | ) | const |
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.
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:
[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. |
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 StrokeBeginEvent |
aevent StrokeEndEvent |
aevent TangentMirrorUpdateEvent |
aevent LowMemoryEvent |
aevent RestoreMemoryEvent |
aevent PostUndoRedoEvent |
|
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.
aevent ScenePreDeletedEvent |