SoXtMaterialEditor — Component which lets you edit a material interactively
Contents
Description
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.
Inherits From
SoXtComponent > SoXtMaterialEditor
Methods
SoXtMaterialEditor(Widgetparent=NULL,constchar*name=NULL,SbBoolbuildInsideParent=TRUE)~SoXtMaterialEditor()
Constructor and destructor.
voidattach(SoMaterial*material,intindex=0)voiddetach()
Attach/detach the editor to a material node and edit the material of the given index.
SbBoolisAttached()
Returns TRUE if the editor is attached.
voidaddMaterialChangedCallback(SoXtMaterialEditorCB*f,void*userData=NULL)voidremoveMaterialChangedCallback(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).
voidsetUpdateFrequency(SoXtMaterialEditor::UpdateFrequencyfreq)SoXtMaterialEditor::UpdateFrequencygetUpdateFrequency()
Sets/gets the update frequency. See the UpdateFrequency enum declaration.
voidsetMaterial(constSoMaterial&mtl)constSoMaterial&getMaterial()const
Set a new material value, and get the current material value.
Name
SoXtMaterialEditor — Component which lets you edit a material interactively
Resources
*SoXtMaterialEditor.tile1Color: #4c4c4c (color name or hex value)
*SoXtMaterialEditor.tile2Color: #999999 (color name or hex value)
*SoXtMaterialEditor.light1Color: white (color name or hex value)
*SoXtMaterialEditor.light2Color: white (color name or hex value)
*SoXtMaterialEditor.updateFrequency: continuous (continuous | manual)
See Also
SoXtComponent,SoXtMaterialList,SoXtDirLightEditor,SoMaterialSoXtMaterialEditor(3IV)()
Synopsis
#include<Inventor/Xt/SoXtMaterialEditor.h>typedefvoidSoXtMaterialEditorCB(void*userData,constSoMaterial*mtl)enumUpdateFrequency{SoXtMaterialEditor::CONTINUOUS
send updates with every mouse motion
SoXtMaterialEditor::AFTER_ACCEPT
only send updates after user hits accept button
}
Methods from class SoXtMaterialEditor:
SoXtMaterialEditor(Widgetparent=NULL,constchar*name=NULL,SbBoolbuildInsideParent=TRUE)~SoXtMaterialEditor()voidattach(SoMaterial*material,intindex=0)voiddetach()SbBoolisAttached()voidaddMaterialChangedCallback(SoXtMaterialEditorCB*f,void*userData=NULL)voidremoveMaterialChangedCallback(SoXtMaterialEditorCB*f,void*userData=NULL)voidsetUpdateFrequency(SoXtMaterialEditor::UpdateFrequencyfreq)SoXtMaterialEditor::UpdateFrequencygetUpdateFrequency()voidsetMaterial(constSoMaterial&mtl)constSoMaterial&getMaterial()const
Methods from class SoXtComponent:
virtualvoidshow()virtualvoidhide()SbBoolisVisible()WidgetgetWidget()constSbBoolisTopLevelShell()constWidgetgetShellWidget()constWidgetgetParentWidget()constvoidsetSize(constSbVec2s&size)SbVec2sgetSize()Display*getDisplay()voidsetTitle(constchar*newTitle)constchar*getTitle()constvoidsetIconTitle(constchar*newIconTitle)constchar*getIconTitle()constvoidsetWindowCloseCallback(SoXtComponentCB*func,void*data=NULL)staticSoXtComponent*getComponent(Widgetw)constchar*getWidgetName()constconstchar*getClassName()const