Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
SoQtMaterialEditor Class Reference

VSG extension Component which lets you edit a material interactively. More...

#include <Inventor/Qt/SoQtMaterialEditor.h>

+ Inheritance diagram for SoQtMaterialEditor:

Public Types

enum  UpdateFrequency {
  CONTINUOUS ,
  AFTER_ACCEPT
}
 Update frequency. More...
 
typedef void SoQtMaterialEditorCB(void *userData, const SoMaterial *mtl)
 
- Public Types inherited from SoQtComponent
typedef void SoQtComponentCB(void *userData, SoQtComponent *comp)
 

Public Member Functions

 SoQtMaterialEditor (QWidget *parent=qApp->activeWindow(), const char *name=NULL, SbBool buildInsideParent=TRUE)
 Constructor.
 
 ~SoQtMaterialEditor ()
 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 (SoQtMaterialEditorCB *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 (SoQtMaterialEditorCB *f, void *userData=NULL)
 Removes the material changed callback.
 
void setUpdateFrequency (SoQtMaterialEditor::UpdateFrequency freq)
 Sets the update frequency.
 
SoQtMaterialEditor::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 SoMaterialgetMaterial () const
 Gets the current material value.
 
- Public Member Functions inherited from SoQtComponent
SbBool isVisible ()
 Returns TRUE if this component is mapped onto the screen.
 
virtual QWidget * getWidget () const
 This returns the base widget handle for this component.
 
SbBool isTopLevelShell () const
 Returns TRUE if this component is a top level shell component (has its own window).
 
QWidget * getShellWidget () const
 Returns the topLevelShell widget handle (NULL if the topLevelShell hasn't been created by this component).
 
QWidget * getParentWidget () const
 Returns the parent widget handle.
 
void setSize (const SbVec2s &size)
 Convenience routine on the widget handle.
 
SbVec2s getSize ()
 Convenience routine on the widget handle.
 
virtual SbBool setFullScreen (const SbBool enable)
 Switches the viewer into (or out of) fullscreen mode.
 
SbBool isFullScreen (void) 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.
 
SbGlContextHelper::Display getDisplay ()
 On UNIX, returns the X display associated with this components widget.
 
void setTitle (const char *newTitle)
 Sets window title.
 
void setTitle (const SbString &newTitle)
 Sets window title.
 
void setTitle (const QString &newTitle)
 Sets window title.
 
const QString getTitle () const
 Gets window title.
 
void setIconTitle (const QString &newIconTitle)
 Included for portability only.
 
const QString getIconTitle () const
 Included for portability only.
 
SbString getWidgetName () const
 Returns the widget handle name.
 
SbString getClassName () const
 Returns the class name.
 
void setWindowCloseCallback (SoQtComponentCB *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 set to something other than NULL.
 

Public Attributes

SbBool alwaysOnTop
 Boolean indicating if the editor should be always on top of the other windows.
 
SoQtMaterialPalettem_pMaterialPalette
 Pointer to a material palette editor.
 
- Public Attributes inherited from SoQtComponent
SbString helpFileName
 Name of help file to open when the viewer Help button is pressed.
 

Additional Inherited Members

- Static Public Member Functions inherited from SoQtComponent
static SoQtComponentgetComponent (QWidget *widget)
 Returns the SoQtComponent for this widget handle.
 

Detailed Description

VSG extension 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.

SEE ALSO

SoQtComponent, SoQtDirectionalLightEditor, SoMaterial

Definition at line 98 of file SoQtMaterialEditor.h.

Member Typedef Documentation

◆ SoQtMaterialEditorCB

typedef void SoQtMaterialEditorCB(void *userData, const SoMaterial *mtl)

Definition at line 61 of file SoQtMaterialEditor.h.

Member Enumeration Documentation

◆ UpdateFrequency

Update frequency.

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 107 of file SoQtMaterialEditor.h.

Constructor & Destructor Documentation

◆ SoQtMaterialEditor()

SoQtMaterialEditor::SoQtMaterialEditor ( QWidget *  parent = qApp->activeWindow(),
const char *  name = NULL,
SbBool  buildInsideParent = TRUE 
)

Constructor.

◆ ~SoQtMaterialEditor()

SoQtMaterialEditor::~SoQtMaterialEditor ( )

Destructor.

Member Function Documentation

◆ addMaterialChangedCallback()

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).

Definition at line 356 of file SoQtMaterialEditor.h.

◆ attach()

void SoQtMaterialEditor::attach ( SoMaterial material,
int  index = 0 
)

Attaches the editor to a material node and edits the material of the given index.

◆ detach()

void SoQtMaterialEditor::detach ( )

Detaches the editor from the material node.

◆ getMaterial()

const SoMaterial & SoQtMaterialEditor::getMaterial ( ) const
inline

Gets the current material value.

Definition at line 184 of file SoQtMaterialEditor.h.

◆ getUpdateFrequency()

SoQtMaterialEditor::UpdateFrequency SoQtMaterialEditor::getUpdateFrequency ( )
inline

Gets the update frequency.

See the UpdateFrequency enum declaration.

Definition at line 168 of file SoQtMaterialEditor.h.

◆ hide()

virtual void SoQtMaterialEditor::hide ( )
virtual

This hides the component.

Reimplemented from SoQtComponent.

◆ isAttached()

SbBool SoQtMaterialEditor::isAttached ( )
inline

Returns TRUE if the editor is attached.

Definition at line 143 of file SoQtMaterialEditor.h.

◆ removeMaterialChangedCallback()

void SoQtMaterialEditor::removeMaterialChangedCallback ( SoQtMaterialEditorCB f,
void *  userData = NULL 
)
inline

Removes the material changed callback.

Definition at line 362 of file SoQtMaterialEditor.h.

◆ setMaterial()

void SoQtMaterialEditor::setMaterial ( const SoMaterial mtl)

Sets a new material value.

◆ setUpdateFrequency()

void SoQtMaterialEditor::setUpdateFrequency ( SoQtMaterialEditor::UpdateFrequency  freq)

Sets the update frequency.

See the UpdateFrequency enum declaration.

◆ show()

virtual void SoQtMaterialEditor::show ( )
virtual

This shows the component.

Reimplemented from SoQtComponent.

Member Data Documentation

◆ alwaysOnTop

SbBool SoQtMaterialEditor::alwaysOnTop

Boolean indicating if the editor should be always on top of the other windows.

Definition at line 189 of file SoQtMaterialEditor.h.

◆ m_pMaterialPalette

SoQtMaterialPalette* SoQtMaterialEditor::m_pMaterialPalette

Pointer to a material palette editor.

Definition at line 194 of file SoQtMaterialEditor.h.


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