SOXTMATERIALEDITOR(3iv)
π SoXtMaterialEditor π
okay bestie, gather round, because today we're talking about SoXtMaterialEditor(3IV) β and no, it's not a manual about your fave eyeshadow palette (though honestly? the vibe is similar). It lives in section 3IV of the manual, and it's the component that lets you edit a material interactively. Like, drag a slider, watch a sphere change. Iconic behaviour fr fr.
β¨ NAME β¨
SoXtMaterialEditor β a Component which lets you edit a material interactively. that's it, that's the whole job, and it does it gorgeously π
π¦ INHERITS FROM π¦
SoXtComponent > SoXtMaterialEditor
so it's a whole lineage situation. SoXtComponent is the parent, SoXtMaterialEditor is the main character offspring β¨
π SYNOPSIS π
first things first, you gotta let it in:
#include <Inventor/Xt/SoXtMaterialEditor.h>
now, the callback type. this is the little function signature you write yourself if you wanna be notified when stuff changes:
typedef void SoXtMaterialEditorCB(void *userData, const SoMaterial
*mtl)
and here's the enum that controls when those callbacks fire. two moods only:
enum UpdateFrequency {
SoXtMaterialEditor::CONTINUOUS
send updates with every mouse motion
SoXtMaterialEditor::AFTER_ACCEPT
only send updates after user hits accept button
}
like, do you want play-by-play commentary (CONTINUOUS) or the final verdict (AFTER_ACCEPT)? both valid, no judgment π«Ά
πΈ Methods from class SoXtMaterialEditor πΈ
these are your methods, the ones this class brings to the group chat:
SoXtMaterialEditor(Widget parent = NULL, const char
*name = NULL, SbBool buildInsideParent = TRUE)
~SoXtMaterialEditor()
void attach(SoMaterial *material, int index = 0)
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()
void setMaterial(const SoMaterial &mtl)
const SoMaterial & getMaterial() const
π Methods from class SoXtComponent π
inherited from the parent, but still serving:
virtual void show()
virtual void hide()
SbBool isVisible()
Widget getWidget() const
SbBool isTopLevelShell() const
Widget getShellWidget() const
Widget getParentWidget() const
void setSize(const SbVec2s &size)
SbVec2s getSize()
Display * getDisplay()
void setTitle(const char *newTitle)
const char * getTitle() const
void setIconTitle(const char *newIconTitle)
const char * getIconTitle() const
void setWindowCloseCallback(SoXtComponentCB *func, void
*data = NULL)
static SoXtComponent * getComponent(Widget w)
const char * getWidgetName() const
const char * getClassName() const
π DESCRIPTION π
okay so here's the tea. this class edits the material properties of an SoMaterial node. but here's the twist β you can also just use the editor directly with callbacks, no attaching required. it doesn't need to be in a situationship with a node to be useful, iykyk.
so what does the component actually look like? it's giving:
- a render area showing a test sphere
- some sliders
- a set of radio buttons
- and a menu
the sphere displays the current material being edited. so you literally see your choices in real time. gorgeous.
there's one slider for each material coefficient. those fields are:
ambient,diffuse,specular,emissiveβ all of which are colorstransparencyandshininessβ which are scalar values
a color editor can be opened to edit the color slider base color. and a material list displays palettes of predefined materials from which to choose. so you got options, bestie π¨
lowkey important: 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. it's not cheating, it's just serial monogamy π
π METHODS π
SoXtMaterialEditor(Widget parent = NULL, const char
*name = NULL, SbBool buildInsideParent = TRUE)
~SoXtMaterialEditor()
Constructor and destructor. the hello and the goodbye. π
void attach(SoMaterial *material, int index = 0)void detach()
attach/detach the editor to a material node and edit the material of the given index. so you're like "hey material, you're mine now" and then later "okay we're done here" π
SbBool isAttached()
Returns TRUE if the editor is attached. are we in a relationship? yes or no, no maybes π«Ά
void addMaterialChangedCallback(SoXtMaterialEditorCB *f,
void *userData = NULL)
void removeMaterialChangedCallback(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). so if you don't wanna attach it to a node, you just subscribe to the drama instead β¨
void setUpdateFrequency(SoXtMaterialEditor::UpdateFrequency freq)
SoXtMaterialEditor::UpdateFrequency getUpdateFrequency()
Sets/gets the update frequency. See the UpdateFrequency enum declaration. it's literally right up there in the synopsis, go look π
void setMaterial(const SoMaterial &mtl)
const SoMaterial & getMaterial() const
Set a new material value, and get the current material value. give and take, the circle of life πΈ
π RESOURCES π
these are the X resources you can set to customize the look. defaults included, don't come for me:
*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 π§
go read these next, bestie, they're all in the same friend group:
SoXtComponentSoXtMaterialListSoXtDirLightEditorSoMaterial
that's the whole page!! you ate that π β¨
cute lil sign-off: this was SoXtMaterialEditor(3IV), and yeah the source/version and date fields at the bottom are literally the exact same string as the top β SoXtMaterialEditor(3IV)() β so I'm just telling you here instead of copy-pasting it like a robot. periodt. ππ¦
π¦ where this page comes from
- debian bookworm: inventor-doc 2.1.5-10+dfsg-2 Β· LGPL-2.0-or-later
- debian trixie: inventor-doc 2.1.6+ds-2 Β· LGPL-2.0-or-later
- ubuntu jammy: inventor-doc 2.1.5-10-24
- ubuntu noble: inventor-doc 2.1.5-10+dfsg-2.1build2 Β· LGPL-2.0-or-later
- ubuntu questing: inventor-doc 2.1.6+ds-2
- ubuntu resolute: inventor-doc 2.1.6.1+ds-1 Β· LGPL-2.0-or-later
- ubuntu stonking: inventor-doc 2.1.6.1+ds-1 Β· LGPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms