MatAssignData Message? [SOLVED]



  • On 06/11/2016 at 10:00, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   18 
    Platform:    Mac  ;  Mac OSX  ; 
    Language(s) :     C++  ;

    ---------
    Hello,

    Is there a message that gets sent/fired when a MatAssignData object gets updated (ex: InsertObject or DeleteObject gets called)? Tried looking through the SDK examples, but it seems no examples use MatAssignData.

    I'm hoping my MaterialData plugin can do something when its MatAssignData gets updated.

    Thanks,
    Ian



  • On 08/11/2016 at 13:43, xxxxxxxx wrote:

    Hi Ian, thanks for writing us.

    Actually a plausible workaround to get acknowledged about a material assignment to an object is to override in your MaterialData-derived class the Message() method and filter for:

    • MSG_MATERIALDRAGANDDROP - which occurs when a material is assigned to an object by drag 'n drop in the viewport or my using click on Apply on the contextual menu reached by RMB-clicking on a material thumbnail -;
    • MSG_DRAGANDDROP - which occurs when a the material is dragged on an Object or on an existing Texture Tag.

    Last but not least, it's also relevant to know that if an object is dragged 'n dropped from the Object Manager to the Material Assignment list in your material "Assign" tab neither MSG_MATERIALDRAGANDDROP nor MSG_DRAGANDDROP are  fired and you would be able to detect the assignment (at least from the test I run)

    Feel free to come back if any  further detail is required.

    Best, Riccardo


Log in to reply