Material selection signal
pciccone
Posts: 661
Hello again.
Is it possible to be notified of what material is selected without scanning all the materials? The DzScene class provides the notification of the event happening but not the details on which object and material have been selected.
Thanks in advance.
Comments
if you connect at the shape level, there are the following two signals:
void materialSelected( DzMaterial *mat );
void materialUnselected( DzMaterial *mat );
Thank you. So, this means that I will have to connect to each object in the scene. In other words there is no Scene-level signaling for this kind of event. Am I correct?
Thanks in advance.
DzNode, DzObject and DzShape each provide a materialSelectionChanged() signal. DzMaterial provides a selectionStateChanged() signal. Each class in the chain causes the next higher in that chain to emit its signal, ultimately causing the signal on DzScene to emit.
Rather than trigger your subroutine each time the signal is emitted, in order to keep from significantly impacting performance, the recommended approach is to create a custom event, if/when one does not already exist, when the DzScene::materialChanged() signal is emitted and then process the material list once; using the static functions on DzMaterial. If you need shape or node information, from a DzMaterial you can get a DzShapeListIterator, and from DzShape you can get the DzNode.
-Rob
I have to say, Rob, your support at the technical level is nothing less than spectacular! :)