Hi all, I am still pretty weak in ‘integrating’ variables into functions here and there, and I do need some advices to ensure that I am at the very least in the right track.
I am trying to write a function where it checks whether a particular pass exisits and if it is not. If it exists, it will continue to the next function, else it will prompt a warning and do a sys.exit()
As such, I was wondering if it is indeed a good idea to use sys.exit(), cause it feels as though the execution is bailing out in the middle of the script. Are there other methods that I can try it out? And also, will it be possible to do the exit decision within the main function instead of withing the chk_pass function (just fear that having the exit to be in the main function may affects the other functions within)?
Following is the code I have used, can someone advice me?
def chk_pass():
if cmds.objExists == "renderResPass":
print "Object Exists. Continue on to next process"
else:
cmds.warning("Create a Beauty Pass and relink the shaders before moving on.")
sys.exit()
def main():
cur_pass()
# All other functions will be added here
..
..
print "Rendering is complete"