Jump to content

how to set Multi-Parms attribute list menu


Recommended Posts

i want to set  Multi-Parms attribute list menu,

single  attribute list menu i have been set right

below is code 

 

define funsion:

 

static void
buildAttrMenu(void *data, PRM_Name *theMenu, int theMaxSize, const PRM_SpareData *, PRM_Parm *)
{
SOP_Node *sop = CAST_SOPNODE((OP_Node *)data);
if( sop )
{
OP_Context context(0);
const GU_Detail *gdp =sop->getCookedGeo(context);
 
GA_AttributeFilter   attrib_filter(GA_AttributeFilter::selectAll());
GA_AttributeFilter   except_filter(GA_ATTRIB_FILTER_OR,GA_AttributeFilter::selectByName("filename"),GA_AttributeFilter::selectByName("P"));
except_filter = except_filter.selectOr(except_filter,GA_AttributeFilter::selectByName("maxbounds"),0);
except_filter = except_filter.selectOr(except_filter,GA_AttributeFilter::selectByName("pmatrix"),0);
except_filter = except_filter.selectOr(except_filter,GA_AttributeFilter::selectByName("minbounds"),0);
attrib_filter = attrib_filter.selectNot(except_filter,0);
 
unsigned int i =0 ;
for (GA_AttributeDict::iterator it =gdp->getAttributeDict(GA_ATTRIB_POINT).begin(GA_SCOPE_PUBLIC); !it.atEnd() && i<theMaxSize;++it)
      {
 
const GA_Attribute *attrib = it.attrib();
if (attrib_filter.match(attrib))
{
theMenu.setToken( attrib->getName() );
theMenu.setLabel( attrib->getName() );
i++;
}
}
 
theMenu.setToken(0);
theMenu.setLabel(0);
 
}
else
{
theMenu[0].setToken(0);
theMenu[0].setLabel(0);
}
}

 

 

define parms:

 

 

static PRM_Name        names[] = {
PRM_Name("attrib","Attribute Name"),
    PRM_Name()
};

 

 

static PRM_ChoiceList theFloatAttribMenu((PRM_ChoiceListType)( PRM_CHOICELIST_TOGGLE|PRM_CHOICELIST_WILD|PRM_CHOICELIST_REPLACE),(PRM_ChoiceGenFunc)buildAttrMenu);
 
static PRM_Template     theAttribTemplates[] = {
  
PRM_Template(PRM_STRING,1,&names[0],&attributeDefault,&theFloatAttribMenu),
 
 
    PRM_Template()
};
 
 
it work well
 
but when i change the parm to Multi-Parms,
code is :
 
static PRM_Name        names[] = {
PRM_Name("attrib#","Attribute Name"),
    PRM_Name()
};
 
it will popup error when create node in houdini,why and how to set Multi-Parms versions
 
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...