def cameraOrthographicChanged(orthoPlug, *args): "called to sync .aiTranslator when .orthographic changes" if not core.arnoldIsCurrentRenderer(): return fnCam = om.MFnCamera(orthoPlug.node()) transPlug = fnCam.findPlug('aiTranslator') if not transPlug.isNull(): isOrtho = orthoPlug.asBool() currTrans = transPlug.asString() #print "cameraOrthographicChanged", fnCam.name(), currTrans, isOrtho newTrans = None if isOrtho and currTrans != 'orthographic': newTrans = 'orthographic' elif not isOrtho and currTrans == 'orthographic': newTrans = 'perspective' #print "newTrans", newTrans if newTrans: transPlug.setString(newTrans)
def cameraTranslatorChanged(transPlug, *args): "called to sync .orthographic when .aiTranslator changes" if not core.arnoldIsCurrentRenderer(): return fnCam = om.MFnCamera(transPlug.node()) currTrans = transPlug.asString() orthoPlug = fnCam.findPlug('orthographic') isOrtho = orthoPlug.asBool() #print "cameraTranslatorChanged", fnCam.name(), currTrans, isOrtho # when a file is opening, we need to choose one attribute to lead, because # the order that attributes are set is unpredictable. This fixes a case # where translators may have gotten out of sync if om.MFileIO.isOpeningFile(): if isOrtho and currTrans != 'orthographic': orthoPlug.setBool(True) else: if not isOrtho and currTrans == 'orthographic': orthoPlug.setBool(True) elif isOrtho and currTrans != 'orthographic': orthoPlug.setBool(False)