Solved In-Exclusion in 2023 - no way to insert tags into an In-Exclusion list?


I just installed 2023 and discovered parts of my scripts stopped functioning, because you can’t insert any tag into an In-Exclusion list anymore? :{

The In-ExclusionData is just a simple userData item on a pythonTag..
I included a simple script below, which works in previous versions of C4D - Just a pyTag (on a Null) with 3 pieces of user data (2 buttons and an inex List..)

So, A - I’m hoping this is a temporary bug.
or B - There’s a new way to automatically insert (especially python)Tags in some sort of list. (couldn’t find any changes in de docs..)

Please let me know, really need a solution.
tia, Jochem

import c4d # just a simple example..

def add():
    inexList = op[c4d.ID_USERDATA,3]

    item = op # <<< can't insert "op" or other pyTags anymore?..
    item = op.GetObject().GetTag(5698) # e.g. vibrationTag, seems I can't insert any tag..
    item = op.GetObject() # this works..

    inexList.InsertObject(item, 0)
    op[c4d.ID_USERDATA,3] = inexList

def rem():
    op[c4d.ID_USERDATA,3] = c4d.InExcludeData()

def message(id, data):
        id2 = data['id'][0].id
        if id2 == c4d.ID_USERDATA:
            userDataId = data['id'][1].id
            if userDataId == 1: add()
            if userDataId == 2: rem()

def main(): pass


I am a bit surprised, i tried with previous version and it was never possible to drag and drop other things than objects on a UserData define to the type of In/Exclude list. This of course only apply to UserData where the in/exclude gadget only accept OBase type by default. The best way to define the type of element that the in/exclude will accept is to create a plugin. You could create your parameter using either a resource file or using GetDDescription you will be able to define the description.
Another way to do it would be to create yourself the userData and modify its description. Add the ID of the element you want to support in the parameter DESC_ACCEPT of the description. This must be done from the mainthread and not from the main function of a python tag. You can use a script to modify a userdata, you only need to do it once.

userIdToSearch = 4
allUserdatas = op.GetUserDataContainer()  
for descId, container in allUserdatas:  
  currentId = descId[1].id  
  # Check if the user data is the one we are looking for.
  if currentId == userIdToSearch: 
    # Retrieve the container that store the IDs of the elements that can be dropped.
    accepted = container[c4d.DESC_ACCEPT]
    # Insert the element we want to support.
    accepted.InsData(c4d.Tbase, True)
    # Update the container
    container[c4d.DESC_ACCEPT] = accepted
    # Update the UserData of the object.
    op.SetUserDataContainer(descId, container)


MAXON SDK Specialist

MAXON Registered Developer

Hi @manuel,

Thx for your reply. You might be surprised again... your code also works from the main func of a pyTag :} (But that's probably because of the buttons running in the mainThread..)

Consider it solved, Jochem

Please mark that thread as solved using our forum tools.

MAXON SDK Specialist

MAXON Registered Developer

Done, didn't know I could do it myself :}