Arthur~Chiu Posted May 19, 2014 Share Posted May 19, 2014 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.