SOLVED Trigger on BaseShader change

I am wondering how to detect a change in BITMAPSHADER_FILENAME of a BaseShader?

Say I have a GeDialog which lists information of the current active object.
A material was created and assigned to the object.That material has a Xbitmap BaseShader.
The dialog displays the filename of the bitmap by parsing the BaseMaterial's color BaseChannel.
If its BaseShader is an instance of Xbitmap it gets the BITMAPSHADER_FILENAME parameter.
Now, when the user replaces the bitmap of the color channel with another bitmap, what trigger could be used to detect this from within the GeDialog?
Is some kind of message sent (EVMSG_xxx)?

I 'd like to broaden the question a little. Next to knowing how to detect a change of bitmap in a material, what would be the best way to detect a change of material? How to detect when user removes or assigns a material to a BaseObject?

In the meantime I went for a simplified solution, as I only need to monitor a single texture from a single material. I thus went with a MessageData plugin, and listen to the EVMSG_CHANGE. Then I check if the current material's texture filename is still the same and perform the necessary when different.
Obviously this will not work when user changes the content of the bitmap file on disk, without changing the name ... but it's a start.


There's nothing more than that.

Some remarks:

  • You can simple react to the CoreMessage, EVMSG_CHANGE and EVMSG_DOCUMENTRECALCULATED inside your GeDialog without the need to use a MessageData. You also could need to react to this message MESSAGE_ACTIVE_NODESPACE_CHANGED

  • You can also checked for the dirty state of the Document with GetHDirty using the mask HDIRTYFLAGS::MATERIAL | HDIRTYFLAGS::SHADER and store it in a class variable to compare if it does changed.

That's what the AssetInspector is doing to check if something have changed.


Thanks for reminding me of the GeDialog::CoreMessage.
I totally overlooked that.