Suppose I have a setup like this. I'd like to write some code in either Python or Hscript that can return the name of the root primitive (I'd like to check and see if the name of the root primitive is equal to a certain name to perform some logic in my nodes).
I can get the name of the root primitive with:
`lopinputprims('.', 0)`
The string I need to compare it with is located at:
`chs("../current_department")`
(which would need to be prefixed with a / in order to be properly compared).
I need to use whether or not these strings match to drive a switch node. I've tried the following but I haven't been able to get anything that correctly switches the node depending on whether or not it works:
strcmp(`lopinputprims('.', 0)`,/`chs("../current_department")`)
- (would need prefixing, but doesn't work either way)
strcmp(lopinputprims('.', 0),chs("../current_department"))
if(strcmp(`lopinputprims('.', 0)`,/`chs("../current_department")`)==0, 1, 0)
What am I missing to make this string comparison work? Is there a way to do this in Python that would be cleaner (e.g., using husd)? It'd also be nice to get the number of root primitives so that I can ensure that there's a single root primitive at the top before it's exported.
Thanks!
Anson
