Solved Max value of an EditNumberArrows in TagData

Hello,
I'm looking to set the values of an EditNumberArrows gadget in a TagData plugin based on the points of an object to which the BaseTag is attached. I would like to use the points value to set the EditNumberArrows gadget's Max value to the pointCount value.

This is how I'm doing it in the .res file, but I'm not sure how to edit the Max with the point Count inside of the TagData.

    GROUP CONTROLS_GROUP {
        DEFAULT 1;
        LONG CONTROLS_POINT_INDEX { MIN 1; MAX 50; STEP 1; }

Is editing the Max value dynamically possible? Can anyone please advise me on this? Thanks!

Hi @blastframe the usual way is to set the DESC_MAX value in the description of the NodeData.
To do so you have to override the NodeData.GetDDescription method like so

    def GetDDescription(self, node, description, flags):
        # Before adding dynamic parameters, load the parameters from the description resource
        if not description.LoadDescription(node.GetType()):
            return False

        # Check if there is an object attached
        obj = node.GetObject()
        if obj is not None:

            CONTROLS_POINT_INDEX = 1001
            paramSetting = description.GetParameterI(CONTROLS_POINT_INDEX)
            paramSetting[c4d.DESC_MAX] = obj.GetPointCount()

        # After parameters have been loaded and added successfully, return True and DESCFLAGS_DESC_LOADED with the input flags
        return True, flags | c4d.DESCFLAGS_DESC_LOADED

For more information about GetDDescription I invite you to read the C++ Manual about Description Manual.

Cheers,
Maxime.

Hi @blastframe the usual way is to set the DESC_MAX value in the description of the NodeData.
To do so you have to override the NodeData.GetDDescription method like so

    def GetDDescription(self, node, description, flags):
        # Before adding dynamic parameters, load the parameters from the description resource
        if not description.LoadDescription(node.GetType()):
            return False

        # Check if there is an object attached
        obj = node.GetObject()
        if obj is not None:

            CONTROLS_POINT_INDEX = 1001
            paramSetting = description.GetParameterI(CONTROLS_POINT_INDEX)
            paramSetting[c4d.DESC_MAX] = obj.GetPointCount()

        # After parameters have been loaded and added successfully, return True and DESCFLAGS_DESC_LOADED with the input flags
        return True, flags | c4d.DESCFLAGS_DESC_LOADED

For more information about GetDDescription I invite you to read the C++ Manual about Description Manual.

Cheers,
Maxime.

@m_adam Thanks, Maxime!