BrianK Posted June 14, 2005 Share Posted June 14, 2005 I want to make a "reset simulation" button. In my template list, I'm guessing I need some sort of a template like this: PRM_Template(PRM_CALLBACK, 1, &names[3], 0, 0, 0, ???); but I'm a bit lost at the "???" - what goes there? I'm not sure I have the syntax correct. I believe it should be something like "&resetSim" when there is a resetSim func that looks something like: int SOP_whatever::resetSim(void* foobar, int index, float time, const PRM_Template* foo) { cout << "\n\nRESET\n" << endl; } but that doesn't want to compile. q1: is that close to correct? q2: does the reset need the void* or PRM_Template* params, or can I just pass a NULL if I know I won't use them? What does the void* point to anyway? What is "index"? Quote Link to comment Share on other sites More sharing options...
George Posted June 14, 2005 Share Posted June 14, 2005 Hi Brian, I believe you can do something like: PRM_Template(PRM_CALLBACK, 1, &names[3], 0, 0, 0, SOP_whatever::resetSim) Your resetSim() function should be declared in the header as such: static int resetSim(void *data, int index, float t, const PRM_Template *); Once inside resetSim, you should be able to cast data to (SOP_whatever *) and use it as you'd like. Hope that helps. George. Quote Link to comment Share on other sites More sharing options...
Guest xionmark Posted June 18, 2005 Share Posted June 18, 2005 Hi Brian, Here's an example: // Declare a name for the "write the file" button static PRM_Name names[] = { ... <SNIP> PRM_Name("write_file", "Write Real Flow File"), </SNIP> ... } // Declare a callback widget for the "write the file" button, include the reference to the callback function PRM_Template(PRM_CALLBACK, 1, &names[5], 0, 0, 0, SOP_RF_Export::writeTheFile), // Here's the callback function for the "write the file" button int SOP_RF_Export::writeTheFile(void *data, int index, float time, const PRM_Template *tplate ) { SOP_RF_Export *me = (SOP_RF_Export *) data; me->calledFromCallback = true; me->myCallBackFlags = 0; OP_Context myContext(time); myContext.setData(data, OP_GEOMETRY_DATA); me->myCallBackError = me->cookMe(myContext); return 1; } --Mark Quote Link to comment Share on other sites More sharing options...
BrianK Posted June 18, 2005 Author Share Posted June 18, 2005 Thanks to both of you. Quote Link to comment Share on other sites More sharing options...
pbowmar Posted September 18, 2007 Share Posted September 18, 2007 Hi Brian,Here's an example: // Declare a name for the "write the file" button static PRM_Name names[] = { ... <SNIP> PRM_Name("write_file", "Write Real Flow File"), </SNIP> ... } // Declare a callback widget for the "write the file" button, include the reference to the callback function PRM_Template(PRM_CALLBACK, 1, &names[5], 0, 0, 0, SOP_RF_Export::writeTheFile), // Here's the callback function for the "write the file" button int SOP_RF_Export::writeTheFile(void *data, int index, float time, const PRM_Template *tplate ) { SOP_RF_Export *me = (SOP_RF_Export *) data; me->calledFromCallback = true; me->myCallBackFlags = 0; OP_Context myContext(time); myContext.setData(data, OP_GEOMETRY_DATA); me->myCallBackError = me->cookMe(myContext); return 1; } --Mark In H9 I seem to have to do this: PRM_Template(PRM_CALLBACK, 1, &names[5], 0, 0, 0, &SOP_RF_Export::writeTheFile) Note the ampersand in front of the function. I still can't get it to work but this seems to get closer Cheers PeteR B 1 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.