harrybiddle Posted January 10, 2014 Share Posted January 10, 2014 Hi guys, I'm hoping you can help me out. I have a C++ SOP that lives inside an OTL. The C++ SOP has a parameter "myparm" that references one of the same name on the OTL; i.e. OTL has a parameter "myparm" and a child node that is the C++ SOP Child C++ SOP parameter "myparm" has value ch("../myparm") What I'm trying to do is, inside the C++ code of the SOP, work out if the OTL "myparm" has an expression or not. Something like follow "myparm" to the OTL parameter Work out if that parameter has an expression (I found that OP_Parameters::getStringMeaning could be used for this purpose, but please let me know if there's a better way) Any ideas gratefully appreciated! Thanks, Harry Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted January 10, 2014 Share Posted January 10, 2014 (edited) OP_Parameters::getStringMeaning returns enum CH_StringMeaning with four positions to compare CH_STRING_LITERAL CH_OLD_EXPRESSION CH_PYTHON_EXPRESSION CH_EXPRESSION_IN_DEFAULT_LANGUAGE so I don't think that you can figure out anything better To be fair I'm not following what's the problem here since you already answered how it should be solved?! Have you tried it? Or do you want us to try it and come back to tell you that it works Edited January 10, 2014 by mantragora Quote Link to comment Share on other sites More sharing options...
harrybiddle Posted January 10, 2014 Author Share Posted January 10, 2014 (edited) Ok cool; that's all fine then!So the only thing I need is how to "deference" expressions. If my parameter has an expression "ch("../myparm")" then how do I follow that path to get access to the parameter it's referencing? I want to do something like this: parameter_reference = evalParameterAsString("myparm", now); // gives me "ch(../myparm)" parent_parameter = dereferenceExpression(parameter_reference); parent_parameter_has_expression = getStringMeaning(parent_parameter, now); Edited January 10, 2014 by harrybiddle Quote Link to comment Share on other sites More sharing options...
edward Posted January 12, 2014 Share Posted January 12, 2014 This will follow all channel references until it does not find a simple ch("/to/parm") expression. The variables node/parm/vec_i will be updated to the new parameter. OP_Node* node = this; PRM_Parm* parm = &node->getParm("myparm"); PRM_Parm *old_parm = parm; int vec_i = 0; OP_Parameters::followChannelReferences(now, node, parm, vec_i); if (parm != old_parm && vec_i != 0) // then we changed to a new parameter { CH_Channel* chp = parm->getChannel(vec_i); } Quote Link to comment Share on other sites More sharing options...
harrybiddle Posted January 13, 2014 Author Share Posted January 13, 2014 This works ideally: thanks to you both. 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.