Jump to content

Determine If Parameter Has Expression?


Recommended Posts

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

  1. follow "myparm" to the OTL parameter
  2. 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

Link to comment
Share on other sites

Guest mantragora

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 :D

Edited by mantragora
Link to comment
Share on other sites

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 by harrybiddle
Link to comment
Share on other sites

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);
}
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...