daniel.fodor Posted September 20, 2019 Share Posted September 20, 2019 Hi! Sorry if this is a basic question, I am very new to HDK and Houdini itself, I am starting to get the taste of it but I have some questions: I want to create a custom SOP with a "built-in" switcher, here is my code: //I tried to copy from the euclid/SOP_Euclid example, I have this func in my header(this should ask houdini if the checkbox is ticked): bool SWITCH(fpreal t) { return (bool)evalInt(0, 0, t); } ... //Here I set up the Toggle param static PRM_Name names[] = { PRM_Name("switch","Switch"), }; static PRM_Default elevationDefault(500.0); PRM_Template MySOP::myTemplateList[] = { PRM_Template(PRM_STRING, 1, &PRMgroupName, 0, &SOP_Node::pointGroupMenu, 0, 0, SOP_Node::getGroupSelectButton(GA_GROUP_POINT)), PRM_Template(PRM_TOGGLE, 1, &names[1]), PRM_Template(), }; ... OP_ERROR MySOP::cookMySop(OP_Context& context) { OP_AutoLockInputs inputs(this); if (inputs.lock(context) >= UT_ERROR_ABORT) { return error(); } fpreal t = context.getTime(); bool switcher = SWITCH(t); //Do something with my object... //Then here i want to make the switcher, my first idea was to make a PRM_TOGGLE param, and using it as a bool(like in the Euclid e.g), //so for example if it's ticked, I want to move my object, if it isn't, I want to make it bigger (I know its a bad e.g: but I hope you get it) if(switcher) { //move my object } else { //make it bigger } //continue It compiles, but crashes Houdini with a seg. fault and I don't know what is the problem Also, let me know if there is a better way of making a switcher Daniel Quote Link to comment Share on other sites More sharing options...
symek Posted September 20, 2019 Share Posted September 20, 2019 just a quick look: 1 hour ago, daniel.fodor said: static PRM_Name names[] = { PRM_Name("switch","Switch"), }; ///... PRM_Template(PRM_TOGGLE, 1, &names[1]), // <-- shouldn't be '0' here? Quote Link to comment Share on other sites More sharing options...
daniel.fodor Posted September 20, 2019 Author Share Posted September 20, 2019 Thank you Symek, that fixed the crash! Although the checkbox doesn't do anything(I tried to translate some points if it's checked) Any ideas on that? 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.