Component which lets you edit a material interactively. More...
#include <Inventor/Qt/SoQtMaterialEditor.h>
Public Types | |
enum | UpdateFrequency { CONTINUOUS, AFTER_ACCEPT } |
Public Member Functions | |
SoQtMaterialEditor (QWidget *parent=qApp->activeWindow(), const char *name=NULL, SbBool buildInsideParent=TRUE) | |
~SoQtMaterialEditor () | |
void | attach (SoMaterial *material, int index=0) |
void | attach (SoVRMLMaterial *material) |
void | detach () |
SbBool | isAttached () |
void | addMaterialChangedCallback (SoQtMaterialEditorCB *f, void *userData=NULL) |
void | removeMaterialChangedCallback (SoQtMaterialEditorCB *f, void *userData=NULL) |
void | setUpdateFrequency (SoQtMaterialEditor::UpdateFrequency freq) |
SoQtMaterialEditor::UpdateFrequency | getUpdateFrequency () |
virtual void | show () |
virtual void | hide () |
void | setMaterial (const SoMaterial &mtl) |
void | setMaterial (const SoVRMLMaterial &mtl) |
const SoMaterial & | getMaterial () const |
SbBool | isAttachedVRML () |
Public Attributes | |
SbBool | alwaysOnTop |
SoQtMaterialPalette * | m_pMaterialPalette |
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.
SoQtComponent, SoQtDirectionalLightEditor, SoMaterial
SoQtMaterialEditor::SoQtMaterialEditor | ( | QWidget * | parent = qApp->activeWindow() , |
|
const char * | name = NULL , |
|||
SbBool | buildInsideParent = TRUE | |||
) |
Constructor.
SoQtMaterialEditor::~SoQtMaterialEditor | ( | ) |
Destructor.
void SoQtMaterialEditor::addMaterialChangedCallback | ( | SoQtMaterialEditorCB * | f, | |
void * | userData = NULL | |||
) | [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).
void SoQtMaterialEditor::attach | ( | SoVRMLMaterial * | material | ) |
Attaches the editor to a VRML material node and edits the material.
void SoQtMaterialEditor::attach | ( | SoMaterial * | material, | |
int | index = 0 | |||
) |
Attaches the editor to a material node and edits the material of the given index.
void SoQtMaterialEditor::detach | ( | ) |
Detaches the editor from the material node.
const SoMaterial& SoQtMaterialEditor::getMaterial | ( | ) | const [inline] |
Gets the current material value.
SoQtMaterialEditor::UpdateFrequency SoQtMaterialEditor::getUpdateFrequency | ( | ) | [inline] |
Gets the update frequency.
See the UpdateFrequency enum declaration.
virtual void SoQtMaterialEditor::hide | ( | ) | [virtual] |
This hides the component.
Reimplemented from SoQtComponent.
SbBool SoQtMaterialEditor::isAttached | ( | ) | [inline] |
Returns TRUE if the editor is attached.
SbBool SoQtMaterialEditor::isAttachedVRML | ( | ) | [inline] |
Returns TRUE if attached material is a VRML material.
void SoQtMaterialEditor::removeMaterialChangedCallback | ( | SoQtMaterialEditorCB * | f, | |
void * | userData = NULL | |||
) | [inline] |
Removes the material changed callback.
void SoQtMaterialEditor::setMaterial | ( | const SoVRMLMaterial & | mtl | ) |
Sets a new VRML material value.
void SoQtMaterialEditor::setMaterial | ( | const SoMaterial & | mtl | ) |
Sets a new material value.
void SoQtMaterialEditor::setUpdateFrequency | ( | SoQtMaterialEditor::UpdateFrequency | freq | ) |
Sets the update frequency.
See the UpdateFrequency enum declaration.
virtual void SoQtMaterialEditor::show | ( | ) | [virtual] |
This shows the component.
Reimplemented from SoQtComponent.
Boolean indicating if the editor should be always on top of the other windows.
SoQtMaterialPalette* SoQtMaterialEditor::m_pMaterialPalette |
Pointer to a material palette editor.