Component which lets you edit a material interactively. More...
#include <Inventor/Win/SoWinMaterialEditor.h>
Public Types | |
enum | UpdateFrequency { CONTINUOUS , AFTER_ACCEPT } |
UpdateFrequency is how often new values should be sent to the node or the callback routine. More... | |
Public Member Functions | |
SoWinMaterialEditor (SoWidget parent=NULL, const char *name=NULL, SbBool buildInsideParent=TRUE) | |
Constructor. | |
virtual | ~SoWinMaterialEditor () |
Destructor. | |
void | attach (SoMaterial *material, int index=0) |
Attaches the editor to a material node and edits the material of the given index. | |
void | detach () |
Detaches the editor from the material node. | |
SbBool | isAttached () |
Returns TRUE if the editor is attached. | |
void | addMaterialChangedCallback (SoWinMaterialEditorCB *f, void *userData=NULL) |
Additional way of using the material editor, by registering a callback which will be called whenever the material changes (check the UpdateFrequency to find when the callbacks will be called). | |
void | removeMaterialChangedCallback (SoWinMaterialEditorCB *f, void *userData=NULL) |
Removes the material changed callback. | |
void | setUpdateFrequency (SoWinMaterialEditor::UpdateFrequency freq) |
Sets the update frequency. | |
SoWinMaterialEditor::UpdateFrequency | getUpdateFrequency () |
Gets the update frequency. | |
virtual void | show () |
This shows the component. | |
virtual void | hide () |
This hides the component. | |
void | setMaterial (const SoMaterial &mtl) |
Sets a new material value. | |
const SoMaterial & | getMaterial () const |
Gets the current material value. | |
Public Member Functions inherited from SoWinComponent | |
SbBool | isVisible () |
Returns TRUE if this component is mapped onto the screen. | |
SoWidget | getWidget () const |
This returns the base window handle for this component. | |
SbBool | isTopLevelShell () const |
Returns TRUE if this component is a top level shell component (has its own window). | |
SoWidget | getShellWidget () const |
Returns the shell window handle (NULL if the shell hasn't been created by this component). | |
SoWidget | getParentWidget () const |
Returns the parent window handle, be it a shell or not. | |
void | setSize (const SbVec2s &size) |
Convenience routine on the window handle. | |
SbVec2s | getSize () |
Convenience routine on the window handle. | |
SbBool | setFullScreen (const SbBool enable) |
Switches the viewer into (or out of) fullscreen mode. | |
SbBool | isFullScreen () const |
Queries if the viewer is in fullscreen mode. | |
void | setFullScreenEnable (const SbBool enable) |
Enables/disables fullscreen mode. | |
SbBool | isFullScreenEnable (void) const |
Queries if it is possible to put the viewer in fullscreen mode. | |
UINT * | getDisplay () |
Included for portability only. | |
SoNONUNICODE void | setTitle (const char *newTitle) |
Sets window title. | |
void | setTitle (const SbString &newTitle) |
Sets window title. | |
SbString | getTitle () const |
Gets window title. | |
SoNONUNICODE void | setIconTitle (const char *newIconTitle) |
Included for portability only. | |
void | setIconTitle (const SbString &newIconTitle) |
Included for portability only. | |
SbString | getIconTitle () const |
Included for portability only. | |
void | setWindowCloseCallback (SoWinComponentCB *func, void *data=NULL) |
Sets which callback to call when the user closes this component (double click in the upper left corner) - by default hide() is called on this component, unless a callback is specified. | |
SbString | getWidgetName () const |
Returns the window handle name. | |
SbString | getClassName () const |
Returns the class name. | |
virtual | ~SoWinComponent () |
Destructor. | |
Public Attributes | |
SbBool | alwaysOnTop |
SoWinMaterialPalette * | m_pMaterialPalette |
Public Attributes inherited from SoWinComponent | |
SbString | helpFileName |
Name of help file to open when the viewer Help button is pressed. | |
UINT | helpContextID |
The context ID of the help topic to open when the viewer Help button is pressed. | |
SbString | helpContextString |
The TopicID of the help topic to open when the viewer Help button is pressed. | |
Additional Inherited Members | |
Static Public Member Functions inherited from SoWinComponent | |
SoDEPRECATED static SoNONUNICODE void | displayHelp (const char *filename, UINT contextID) |
Static method to display the specified topic of the specified help file. | |
static SoDEPRECATED void | displayHelp (const SbString &filename, UINT contextID) |
Static method to display the specified topic of the specified help file. | |
static SoWinComponent * | getComponent (SoWidget w) |
Returns the SoWinComponent for this window handle. | |
Component which lets you edit a material interactively.
This class is used to edit the material properties of an SoMaterial node. The editor can also directly be used using callbacks instead of attaching it to a node. The component consists of a render area displaying a test sphere, some sliders, a set of radio buttons, and a menu. The sphere displays the current material being edited. There is one slider for each material coefficient. Those fields are ambient, diffuse, specular, emissive (all of which are colors); and transparency and shininess (which are scalar values). A color editor can be opened to edit the color slider base color. A material list displays palettes of predefined materials from which to choose.
The editor can currently be attached to only one material at a time. Attaching two different materials will automatically detach the first one before attaching the second.
SoWinComponent, SoWinDirectionalLightEditor, SoMaterial
Definition at line 97 of file SoWinMaterialEditor.h.
UpdateFrequency is how often new values should be sent to the node or the callback routine.
Enumerator | |
---|---|
CONTINUOUS | Send updates with every mouse motion. |
AFTER_ACCEPT | Only send updates after user hits accept button. |
Definition at line 103 of file SoWinMaterialEditor.h.
SoWinMaterialEditor::SoWinMaterialEditor | ( | SoWidget | parent = NULL , |
const char * | name = NULL , |
||
SbBool | buildInsideParent = TRUE |
||
) |
Constructor.
|
virtual |
Destructor.
|
inline |
Additional way of using the material editor, by registering a callback which will be called whenever the material changes (check the UpdateFrequency to find when the callbacks will be called).
Definition at line 345 of file SoWinMaterialEditor.h.
void SoWinMaterialEditor::attach | ( | SoMaterial * | material, |
int | index = 0 |
||
) |
Attaches the editor to a material node and edits the material of the given index.
void SoWinMaterialEditor::detach | ( | ) |
Detaches the editor from the material node.
|
inline |
Gets the current material value.
Definition at line 180 of file SoWinMaterialEditor.h.
|
inline |
Gets the update frequency.
See the UpdateFrequency enum declaration.
Definition at line 165 of file SoWinMaterialEditor.h.
|
virtual |
This hides the component.
It calls the appropriate unrealize or unmanage routines.
Reimplemented from SoWinComponent.
|
inline |
Returns TRUE if the editor is attached.
Definition at line 139 of file SoWinMaterialEditor.h.
|
inline |
Removes the material changed callback.
Definition at line 351 of file SoWinMaterialEditor.h.
void SoWinMaterialEditor::setMaterial | ( | const SoMaterial & | mtl | ) |
Sets a new material value.
void SoWinMaterialEditor::setUpdateFrequency | ( | SoWinMaterialEditor::UpdateFrequency | freq | ) |
Sets the update frequency.
See the UpdateFrequency enum declaration.
|
virtual |
This shows the component.
If this is a topLevelShell component, then show() will Realize and Map the window, else it will simply Manage the widget. In addition, show() will also pop the component window to the top and de-iconify if necessary, to make sure the component is visible by the user.
Reimplemented from SoWinComponent.
SbBool SoWinMaterialEditor::alwaysOnTop |
Definition at line 182 of file SoWinMaterialEditor.h.
SoWinMaterialPalette* SoWinMaterialEditor::m_pMaterialPalette |
Definition at line 183 of file SoWinMaterialEditor.h.