Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Trigger on BaseShader change

    Cinema 4D SDK
    r19 r20 r21 c++
    2
    4
    549
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C4DSC
      C4DS
      last edited by C4DS

      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)?

      Edit:
      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?

      1 Reply Last reply Reply Quote 0
      • C4DSC
        C4DS
        last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • ManuelM
          Manuel
          last edited by Manuel

          Hello,

          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.

          Cheers,
          Manuel.

          MAXON SDK Specialist

          MAXON Registered Developer

          C4DSC 1 Reply Last reply Reply Quote 1
          • C4DSC
            C4DS @Manuel
            last edited by

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

            1 Reply Last reply Reply Quote 0
            • First post
              Last post