Solved InExclude detect 'Remove All' context menu command

Hello!

  1. With MSG_DESCRIPTION_INEX_DELETED we can detect deleting InExclude item event. But in case choosing 'Remove All' context menu command it is not working? How to fix that?
    Thank you!

Screenshot 2023-02-07 at 17.05.52.png

Checkout my python tutorials, plugins, scripts, xpresso presets and more
https://mikeudin.net

Hey @mikeudin,

Thank you for reaching out to us. Just as an FYI, I did delete the duplicate thread. There is no message for that. The best option is to listen for c4d.MSG_DESCRIPTION_CHECKUPDATE which will be emitted when you invoke the command.

These are all the message IDs which are emitted when one invokes "Remove All":

1028476
1041699
16
17  // MSG_DESCRIPTION_CHECKUPDATE
19
20
200000169
31
431000094
440000249

MSG_DESCRIPTION_CHECKUPDATE is one of the better message IDs to piggy-back on here, but you could also pick another one. You can look up the message symbol for an integer most easily in Message Manual: Plugin Messages.

Cheers,
Ferdinand

Result:
message.gif

I used this code:

import c4d

op: c4d.BaseObject

def main() -> c4d.BaseObject:
    return c4d.BaseObject(c4d.Onull)

def message(mid, data) -> bool:
    if mid == c4d.MSG_DESCRIPTION_INEX_DELETED:
        print (mid, data)
    elif mid == c4d.MSG_DESCRIPTION_CHECKUPDATE:
        data = op[c4d.ID_USERDATA, 1]
        print (f"{data.GetObjectCount() =  }")
    else:
        # print ("ID/DATA", mid, data)
        pass
    return True

MAXON SDK Specialist
developers.maxon.net

Hey @mikeudin,

Thank you for reaching out to us. Just as an FYI, I did delete the duplicate thread. There is no message for that. The best option is to listen for c4d.MSG_DESCRIPTION_CHECKUPDATE which will be emitted when you invoke the command.

These are all the message IDs which are emitted when one invokes "Remove All":

1028476
1041699
16
17  // MSG_DESCRIPTION_CHECKUPDATE
19
20
200000169
31
431000094
440000249

MSG_DESCRIPTION_CHECKUPDATE is one of the better message IDs to piggy-back on here, but you could also pick another one. You can look up the message symbol for an integer most easily in Message Manual: Plugin Messages.

Cheers,
Ferdinand

Result:
message.gif

I used this code:

import c4d

op: c4d.BaseObject

def main() -> c4d.BaseObject:
    return c4d.BaseObject(c4d.Onull)

def message(mid, data) -> bool:
    if mid == c4d.MSG_DESCRIPTION_INEX_DELETED:
        print (mid, data)
    elif mid == c4d.MSG_DESCRIPTION_CHECKUPDATE:
        data = op[c4d.ID_USERDATA, 1]
        print (f"{data.GetObjectCount() =  }")
    else:
        # print ("ID/DATA", mid, data)
        pass
    return True

MAXON SDK Specialist
developers.maxon.net

Thank you @ferdinand ! 👏 Will chek it!

Checkout my python tutorials, plugins, scripts, xpresso presets and more
https://mikeudin.net