Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
SoWinMaterialEditor Class Reference

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

#include <Inventor/Win/SoWinMaterialEditor.h>

+ Inheritance diagram for SoWinMaterialEditor:

Public Types

enum  UpdateFrequency {
  CONTINUOUS ,
  AFTER_ACCEPT
}
 UpdateFrequency is how often new values should be sent to the node or the callback routine. More...
 
typedef void SoWinMaterialEditorCB(void *userData, const SoMaterial *mtl)
 
- Public Types inherited from SoWinComponent
typedef void SoWinComponentCB(void *userData, SoWinComponent *comp)
 

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 SoMaterialgetMaterial () 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 SoWinComponentgetComponent (SoWidget w)
 Returns the SoWinComponent for this window 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

SoWinComponent, SoWinDirectionalLightEditor, SoMaterial

Definition at line 99 of file SoWinMaterialEditor.h.

Member Typedef Documentation

◆ SoWinMaterialEditorCB

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

Definition at line 62 of file SoWinMaterialEditor.h.

Member Enumeration Documentation

◆ UpdateFrequency

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 105 of file SoWinMaterialEditor.h.

Constructor & Destructor Documentation

◆ SoWinMaterialEditor()

SoWinMaterialEditor::SoWinMaterialEditor ( SoWidget  parent = NULL,
const char *  name = NULL,
SbBool  buildInsideParent = TRUE 
)

Constructor.

◆ ~SoWinMaterialEditor()

virtual SoWinMaterialEditor::~SoWinMaterialEditor ( )
virtual

Destructor.

Member Function Documentation

◆ addMaterialChangedCallback()

void SoWinMaterialEditor::addMaterialChangedCallback ( SoWinMaterialEditorCB 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 347 of file SoWinMaterialEditor.h.

◆ attach()

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

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

◆ detach()

void SoWinMaterialEditor::detach ( )

Detaches the editor from the material node.

◆ getMaterial()

const SoMaterial & SoWinMaterialEditor::getMaterial ( ) const
inline

Gets the current material value.

Definition at line 182 of file SoWinMaterialEditor.h.

◆ getUpdateFrequency()

SoWinMaterialEditor::UpdateFrequency SoWinMaterialEditor::getUpdateFrequency ( )
inline

Gets the update frequency.

See the UpdateFrequency enum declaration.

Definition at line 167 of file SoWinMaterialEditor.h.

◆ hide()

virtual void SoWinMaterialEditor::hide ( )
virtual

This hides the component.

It calls the appropriate unrealize or unmanage routines.

Reimplemented from SoWinComponent.

◆ isAttached()

SbBool SoWinMaterialEditor::isAttached ( )
inline

Returns TRUE if the editor is attached.

Definition at line 141 of file SoWinMaterialEditor.h.

◆ removeMaterialChangedCallback()

void SoWinMaterialEditor::removeMaterialChangedCallback ( SoWinMaterialEditorCB f,
void *  userData = NULL 
)
inline

Removes the material changed callback.

Definition at line 353 of file SoWinMaterialEditor.h.

◆ setMaterial()

void SoWinMaterialEditor::setMaterial ( const SoMaterial mtl)

Sets a new material value.

◆ setUpdateFrequency()

void SoWinMaterialEditor::setUpdateFrequency ( SoWinMaterialEditor::UpdateFrequency  freq)

Sets the update frequency.

See the UpdateFrequency enum declaration.

◆ show()

virtual void SoWinMaterialEditor::show ( )
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.

Member Data Documentation

◆ alwaysOnTop

SbBool SoWinMaterialEditor::alwaysOnTop

Definition at line 184 of file SoWinMaterialEditor.h.

◆ m_pMaterialPalette

SoWinMaterialPalette* SoWinMaterialEditor::m_pMaterialPalette

Definition at line 185 of file SoWinMaterialEditor.h.


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