SOLVED Enable/Disable parameters in the Attribute Manager by their parent Group ID


Is it possible to enable/disable parameters in the Attribute Manager by their parent group id (enable/disable all the Description Resource inside an group). I don't want to do enable/disable parameters separately one by one in the NodeData::GetDEnabling().



you could overwrite GetDDescription, there you could set the DESC_HIDE flag of a description element. However, I do not think that DESC_HIDE is being parsed for containers and this also will actually hide the element and not just grey it out, which can lead to some funky behaviour if not applied cautiously.

It seems far easier to use GetDEnabling. What is preventing you from defining a list or dictionary of elements to hide? You could also do this programmatically by parsing the description.



I thought to use list or dictionary of elements to enable/disable them, I thought it was possible to automatically get all elements ids inside an group and then enable/disable them.

Thank you for your help.


I thought it was possible to automatically get all elements ids inside an group and then enable/disable them.


I am not sure if this is a question, but it is possible. I am too lazy to get up and get my laptop, but it could look something like this (in a sort of very detailed pseudo code):

def get_group_children_data(node, groups_to_collect):
    ''' Returns group to element relations of the description of the
     passed node as a dictionary.
        node (c4d.C4DAtom): The node to evaluate the description of.
        groups_to_collect (list[c4d.DescID]): A list of DescIDs of
         the groups we want to collect all children for.
        dict: A hash map of the group to children relations.
            key (str): The string representation of the DescID of the group.
            value (list): The DescIDs of all children.
    data = {}
    # GetDescription() is a member of C4DAtom, returning the description
    # of a node. The Description type has a __iter__ implementation which
    # provides all we need in this case (the blanked out first element
    # of the __iter__ triple is the actual element description, but we
    # won't need it), desc_id is the DescID of an element and group_id the
    # DescID of the container it is parented to.
    for _, desc_id, group_id in node.GetDescription(c4d.DESCFLAGS_DESC_NONE):
        # Step over group ids we are not interested in
        if group_id not in groups_to_collect:
        # Initialize a bin when we encounter a group id the first time
        if str(group_id) not in data:
            # This is sort of an ugly hack here, almost all (all?) types of
            # c4d are not hashable (do not implement __hash__()), which means
            # that they cannot be use as keys in hash maps among other things.
            # You could also use DescID.GetHashCode() instead of str() here.
            data[str(group_id)] = []
        # Add the element.
        data[str(group_id)] += [desc_id]
    return data
def GetDEnabling(self, node, id, t_data, flags, itemdesc):
        # _group_data is the result of the function above.
        for group_id, element_ids in self._group_data.items():
            if group_id == str(should_be_disabled_id) and id in element_ids:
                return False




Sorry I forgot to mention that I'm working in C++.
Never mind, after testing the Classic Method I noticed that is simple and not take lot of lines of code. So, I will just use the classic method

Thanks again.


just for your information: GetDEnabling() gives you the description of the parameter with the itemdesc parameter. From that BaseContainer, you should be able to read the ID of the parameter's parent group (see Description Settings Manual - Groups).

best wishes,