Component which lets you edit a material interactively. More...
#include <Inventor/Xt/SoXtMaterialEditor.h>
Public Types | |
enum | UpdateFrequency { CONTINUOUS, AFTER_ACCEPT } |
Public Member Functions | |
SoXtMaterialEditor (SoWidget parent=NULL, const char *name=NULL, SbBool buildInsideParent=TRUE) | |
~SoXtMaterialEditor () | |
void | attach (SoMaterial *material, int index=0) |
void | attach (SoVRMLMaterial *material) |
void | detach () |
SbBool | isAttached () |
void | addMaterialChangedCallback (SoXtMaterialEditorCB *f, void *userData=NULL) |
void | removeMaterialChangedCallback (SoXtMaterialEditorCB *f, void *userData=NULL) |
void | setUpdateFrequency (SoXtMaterialEditor::UpdateFrequency freq) |
SoXtMaterialEditor::UpdateFrequency | getUpdateFrequency () |
virtual void | show () |
virtual void | hide () |
void | setMaterial (const SoMaterial &mtl) |
void | setMaterial (const SoVRMLMaterial &mtl) |
const SoMaterial & | getMaterial () const |
SbBool | isAttachedVRML () |
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.
!!------------------------------------------------ !! 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
SoXtComponent, SoXtMaterialList, SoXtDirectionalLightEditor, SoMaterial
SoXtMaterialEditor::SoXtMaterialEditor | ( | SoWidget | parent = NULL , |
|
const char * | name = NULL , |
|||
SbBool | buildInsideParent = TRUE | |||
) |
Constructor.
SoXtMaterialEditor::~SoXtMaterialEditor | ( | ) |
Destructor.
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).
void SoXtMaterialEditor::attach | ( | SoVRMLMaterial * | material | ) |
Attaches the editor to a VRML material node and edits the material.
void SoXtMaterialEditor::attach | ( | SoMaterial * | material, | |
int | index = 0 | |||
) |
Attaches the editor to a material node and edits the material of the given index.
void SoXtMaterialEditor::detach | ( | ) |
Detaches the editor from the material node.
const SoMaterial& SoXtMaterialEditor::getMaterial | ( | ) | const [inline] |
Gets the current material value.
SoXtMaterialEditor::UpdateFrequency SoXtMaterialEditor::getUpdateFrequency | ( | ) | [inline] |
Gets the update frequency.
See the UpdateFrequency enum declaration.
virtual void SoXtMaterialEditor::hide | ( | ) | [virtual] |
This hides the component.
Reimplemented from SoXtComponent.
SbBool SoXtMaterialEditor::isAttached | ( | ) | [inline] |
Returns TRUE if the editor is attached.
SbBool SoXtMaterialEditor::isAttachedVRML | ( | ) | [inline] |
Returns TRUE if attached material is a VRML material.
void SoXtMaterialEditor::removeMaterialChangedCallback | ( | SoXtMaterialEditorCB * | f, | |
void * | userData = NULL | |||
) | [inline] |
Removes the material changed callback.
void SoXtMaterialEditor::setMaterial | ( | const SoVRMLMaterial & | mtl | ) |
Set a new VRML material value.
void SoXtMaterialEditor::setMaterial | ( | const SoMaterial & | mtl | ) |
Sets a new material value.
void SoXtMaterialEditor::setUpdateFrequency | ( | SoXtMaterialEditor::UpdateFrequency | freq | ) |
Sets the update frequency.
See the UpdateFrequency enum declaration.
virtual void SoXtMaterialEditor::show | ( | ) | [virtual] |
This shows the component.
Reimplemented from SoXtComponent.