Jump to content

Group Menu In Replace Mode?


Recommended Posts

Hi,

How do you make a group menu choicelist replace and not append?

That is I have a string parameter that has a choice menu that lets you pick named prim groups, but it seems to default to the normal append type, where each time you pick a group from the dropdown it adds it to the field. I want to just make it replace so you can only pick one group name at a time.

So this is what I have at the moment

    PRM_Template((PRM_Type)(PRM_STRING|PRM_TYPE_LABEL_NONE),    1, &names[5], 0, &SOP_Node::primNamedGroupMenu),

Any ideas how to modify this to make it replace?

There is a PRM_ChoiceListType called PRM_CHOICELIST_REPLACE but I'm not sure how to combine it with the group menu type which is defined in the SOP_Node class as

static PRM_ChoiceList  primNamedGroupMenu;

ta

Link to comment
Share on other sites

I think you need to build your own PRM_ChoiceList then to use PRM_CHOICELIST_REPLACE ... something like ...

#define         POINT_GROUP             0x01
#define         PRIM_GROUP              0x02
#define         BOTH_GROUPS             0x03    
#define         EDGE_GROUP              0x04
#define         BREAKPOINT_GROUP        0x08

static void
buildNamedPrimGroup(void *data, PRM_Name *menuEntries, int thelistsize,
                     const PRM_SpareData *spare, PRM_Parm *parm)
{
    SOP_Node    *sop;
    int          value;

    sop   = CAST_SOPNODE((OP_Node *)data);
    if (sop)
    {
        sop->buildInputGroups(0, menuEntries, thelistsize, PRIM_GROUP, 0, false, parm);
    }
    else
    {
        menuEntries[0].setToken(0);
        menuEntries[0].setLabel(0);
    }
}

static PRM_ChoiceList thePrimChoiceList(PRM_CHOICELIST_REPLACE,buildNamedPrimGroup);

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...