HDK - Increment similar parameter names

   1977   4   2
User Avatar
Member
183 posts
Joined: Dec. 2011
Offline
So I am writing a node which has quite a few parameters, several of which share similar custom token names. Rather than having to define a unique PRM_Name for each one, I was wondering if there was a way I could create one and increment it's suffix number for each instance of the parameter?

I noticed that the PRM_Name class has a instance() and instanceToken() methods as well as a setToken() method, but I can't seem to figure out how to properly use them. Any tips on how to do this?
User Avatar
Member
183 posts
Joined: Dec. 2011
Offline
So after some fiddling I have come to the conclusion that this might not be possible since PRM_Name() is required to be static and only accepts static char strings. Guess I will have to just type it all out.
User Avatar
Staff
2591 posts
Joined: July 2005
Offline
90ender
So after some fiddling I have come to the conclusion that this might not be possible since PRM_Name() is required to be static and only accepts static char strings. Guess I will have to just type it all out.

you could always have a function to construct the parm names in the DSO/DLL callback. i.e.

void
newSopOperator(OP_OperatorTable *table)
{
PRM_Template *tplate = buildTemplateProgramatically();
table->addOperator(new OP_Operator(…, tplate));
}
User Avatar
Staff
4164 posts
Joined: Sept. 2007
Online
The OpenVDB project uses a ParmFactory to make it easier to create UIs for the Houdini OpenVDB SOPs. For example, in SOP_OpenVDB_Prune [github.com], like this one:


parms.add(hutil:armFactory(PRM_STRING, “group”, “Group”)
.setHelpText(“Specify a subset of the input grids to be processed.”)
.setChoiceList(&hutil:rimGroupMenuInput1));
{
const char* items = {
“value”, “Value”,
“inactive”, “Inactive”,
“levelset”, “Level Set”,
NULL
};

I'm not an engineer, but I think that's along the lines of what mark recommended? I think it's all implemented in houdini_utils/ParmFactory.h, if you want to see how they did it.
I'm o.d.d.
User Avatar
Member
183 posts
Joined: Dec. 2011
Offline
Hmm. I think I may have a vague idea of how your suggestion works. I'll have to take a look at those example files you suggested. Thanks for the tip guys!
  • Quick Links