morzh Posted January 18, 2012 Share Posted January 18, 2012 Excuse me for my silly & dummy questions, but i have two. 1. How can I build drop down menu for the attributes menu. I've done the following: static PRM_ChoiceList pointAttribMenu( (PRM_ChoiceListType) (PRM_CHOICELIST_WILD|PRM_CHOICELIST_APPEND), SOP_mySop::buildPointAttrMenu ); PRM_Template(PRM_STRING, 1, &pointAttribParm, 0, &pointAttribMenu) void SOP_mySop::buildPointAttrMenu(void *data, PRM_Name *theMenu, int theMaxSize, const PRM_SpareData *, PRM_Parm *){} So the question is how i can get the list of attributes (and tokenize it for theMenu.setToken( " " ) ). Should i use GEO_AttributeHandleList ? And how ? 2. I want to calculate the distance between 2 points (of GEO_Point type). Can I do that non manually ? I cannot find appropriate method in GEO_Point class. I haven't found required method in UT_VectorX class too. Quote Link to comment Share on other sites More sharing options...
0rr Posted January 19, 2012 Share Posted January 19, 2012 I did not understand the first one but the second one could be done with distance3d(p0.getPos(), p1.getPos()) Quote Link to comment Share on other sites More sharing options...
morzh Posted January 23, 2012 Author Share Posted January 23, 2012 (edited) 0rr, thank you for the answer. i should find distance3d by myself. About the first question. I want to build choiceList for attributes menu (like attribPromote has). So i tried to use the same approach as SOP_CopRaster has (it is from the HDK examples, SOP_CopRaster::buildColorMenu member function). So far i could make a menu, but i can't understand how i could fill the list of the geometry attributes . Edited January 23, 2012 by morzh Quote Link to comment Share on other sites More sharing options...
Infernalspawn Posted February 7, 2012 Share Posted February 7, 2012 Hey, about your second question, i guess the best thing if you at first try to build your menu, static, so you understand how a menu is generated e.g. static PRM_Name frameRateMenuNames[] = { PRM_Name("kHours","Hours"), PRM_Name("kMinutes","Minutes"), PRM_Name("kSeconds","Seconds"), PRM_Name(0) }; if you got that, you can continue having a callback script that generates the menu for you. e.g. whenever your node cooks, you store a list of attributes (AttributeDict) as member of your node, than you should be able to do something like this SOP_mySop::buildPointAttrMenu(void *data, PRM_Name *theMenu, int theMaxSize, const PRM_SpareData *, PRM_Parm *) { SOP_mySop *sop = (SOP_mySop *)data; UT_StringArray attribs = sop->getMyStoredAttribList(); for (i = 0; i < attribs.entries() && i < theMaxSize; i++) { theMenu[i].setToken( attribs(i).buffer() ); theMenu[i].setLabel( attribs(i).buffer() ); } theMenu[i].setToken(0); theMenu[i].setLabel(0); } Cheers Seb 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.