Search code examples
mayamel

Mel Check if namespace or object exists


I get a syntax error every time I use the following mel script

string $namespace = "old_house";
If ('namespace -exists $namespace'){print "yes";}

Can anyone tell me what I'm doing wrong?


Solution

  • Just replace the ' with a tilde (`) in side the if condition. Statement or expression wrapped within a tilde tells the interpretter that that chunk is a mel command that needs to be executed, and the result is piped out. Also if should start with a small i.