Open Inventor Release 2024.1.1
 
Loading...
Searching...
No Matches
SoXtMaterialEditor Class Reference

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

#include <Inventor/Xt/SoXtMaterialEditor.h>

+ Inheritance diagram for SoXtMaterialEditor:

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 SoXtMaterialEditorCB(void *userData, const SoMaterial *mtl)
 
- Public Types inherited from SoXtComponent
typedef void SoXtComponentCB(void *data, SoXtComponent *v)
 

Public Member Functions

 SoXtMaterialEditor (SoWidget parent=NULL, const char *name=NULL, SbBool buildInsideParent=TRUE)
 Constructor.
 
 ~SoXtMaterialEditor ()
 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 (SoXtMaterialEditorCB *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 (SoXtMaterialEditorCB *f, void *userData=NULL)
 Removes the material changed callback.
 
void setUpdateFrequency (SoXtMaterialEditor::UpdateFrequency freq)
 Sets the update frequency.
 
SoXtMaterialEditor::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 SoXtComponent
SbBool isVisible ()
 Returns TRUE if this component is mapped onto the screen.
 
SoWidget getWidget () const
 This returns the base widget 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 widget (NULL if the shell hasn't been created by this component).
 
SoWidget getParentWidget () const
 Returns the parent widget, be it a shell or not.
 
void setSize (const SbVec2s &size)
 Convenience routine on the widget.
 
SbVec2s getSize ()
 Convenience routine on the widget.
 
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 () const
 Queries if it is possible to put the viewer in fullscreen mode.
 
Display * getDisplay ()
 Returns the X display associated with this components widget.
 
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)
 Sets icon title.
 
void setIconTitle (const SbString &newIconTitle)
 Sets icon title.
 
SbString getIconTitle () const
 Gets icon title.
 
void setWindowCloseCallback (SoXtComponentCB *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.
 
SbString getWidgetName () const
 Returns the widget name.
 
SbString getClassName () const
 Returns the class name.
 

Additional Inherited Members

- Static Public Member Functions inherited from SoXtComponent
static void displayHelp (const char *filename, UINT contextID)
 Static method to display the specified topic of the specified help file.
 
static SoXtComponentgetComponent (SoWidget w)
 This returns the SoXtComponent for this widget.
 

Detailed Description

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.

RESOURCES

      !!------------------------------------------------
      !! Material Editor !!
      !!------------------------------------------------
      *IvMaterialEditorTitle.labelString: Material Editor
      *IvMaterialEditorIconTitle.labelString: Mat Editor
      *IvMaterialAmbientTitle.labelString: Material Ambient Color
      *IvMaterialDiffuseTitle.labelString: Material Diffuse Color
      *IvMaterialSpecularTitle.labelString: Material Specular Color
      *IvMaterialEmissiveTitle.labelString: -Material Emissive Color
      *IvMaterialEditorMaterial.labelString: Material /
      *IvMaterialEditorAmb.labelString: Amb /
      *IvMaterialEditorDiff.labelString: Diff /
      *IvMaterialEditorSpec.labelString: Spec /
      *IvMaterialEditorEmis.labelString: Emis /
      *IvMaterialEditorColor.labelString: Color
      *IvMEMenuBar.IvEdit.labelString: Edit
      *IvMEMenuBar*IvEditPullDown.IvMaterialList.labelString: Material List
      *IvMEMenuBar*IvEditPullDown.IvContinuous.labelString: Continuous
      *IvMEMenuBar*IvEditPullDown.IvManual.labelString: Manual
      *IvMEMenuBar*IvEditPullDown.IvCopy.labelString: Copy
      *IvMEMenuBar*IvEditPullDown.IvPaste.labelString: Paste
      *IvMEMenuBar*IvEditPullDown.IvHelp.labelString: Help
      *IvControls.IvEditColor.labelString: Edit Color
      *IvsliderForm.IvtextForm.IvAmb.labelString: Amb:
      *IvsliderForm.IvtextForm.IvDiff.labelString: Diff
      *IvsliderForm.IvtextForm.IvSpec.labelString: Spec
      *IvsliderForm.IvtextForm.IvEmis.labelString: Emis
      *IvsliderForm.IvtextForm.IvShininess.labelString: Shininess
      *IvsliderForm.IvtextForm.IvTransp.labelString: Transp:
      *IvMETop.IvAccept.labelString: Accept
    

SEE ALSO

SoXtComponent, SoXtMaterialList, SoXtDirectionalLightEditor, SoMaterial

Definition at line 157 of file SoXtMaterialEditor.h.

Member Typedef Documentation

◆ SoXtMaterialEditorCB

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

Definition at line 85 of file SoXtMaterialEditor.h.

Member Enumeration Documentation

◆ UpdateFrequency

enum SoXtMaterialEditor::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 163 of file SoXtMaterialEditor.h.

Constructor & Destructor Documentation

◆ SoXtMaterialEditor()

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

Constructor.

◆ ~SoXtMaterialEditor()

SoXtMaterialEditor::~SoXtMaterialEditor ( )

Destructor.

Member Function Documentation

◆ addMaterialChangedCallback()

void SoXtMaterialEditor::addMaterialChangedCallback ( SoXtMaterialEditorCB 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 367 of file SoXtMaterialEditor.h.

◆ attach()

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

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

◆ detach()

void SoXtMaterialEditor::detach ( )

Detaches the editor from the material node.

◆ getMaterial()

const SoMaterial & SoXtMaterialEditor::getMaterial ( ) const
inline

Gets the current material value.

Definition at line 239 of file SoXtMaterialEditor.h.

◆ getUpdateFrequency()

SoXtMaterialEditor::UpdateFrequency SoXtMaterialEditor::getUpdateFrequency ( )
inline

Gets the update frequency.

See the UpdateFrequency enum declaration.

Definition at line 223 of file SoXtMaterialEditor.h.

◆ hide()

virtual void SoXtMaterialEditor::hide ( )
virtual

This hides the component.

Reimplemented from SoXtComponent.

◆ isAttached()

SbBool SoXtMaterialEditor::isAttached ( )
inline

Returns TRUE if the editor is attached.

Definition at line 199 of file SoXtMaterialEditor.h.

◆ removeMaterialChangedCallback()

void SoXtMaterialEditor::removeMaterialChangedCallback ( SoXtMaterialEditorCB f,
void *  userData = NULL 
)
inline

Removes the material changed callback.

Definition at line 373 of file SoXtMaterialEditor.h.

◆ setMaterial()

void SoXtMaterialEditor::setMaterial ( const SoMaterial mtl)

Sets a new material value.

◆ setUpdateFrequency()

void SoXtMaterialEditor::setUpdateFrequency ( SoXtMaterialEditor::UpdateFrequency  freq)

Sets the update frequency.

See the UpdateFrequency enum declaration.

◆ show()

virtual void SoXtMaterialEditor::show ( )
virtual

This shows the component.

Reimplemented from SoXtComponent.


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