// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== /// Initialization of Evaluation Manager // // On maya open, we read option var and set EvaluationManader mode accordingly // { source "initHUDScriptsEvaluationManager.mel"; int $gpuOverride = `optionVar -q gpuOverride`; int $evalMode = `optionVar -q evaluationMode`; // NOTE: in mayapy.exe we don't load optionVar values from preferences, // so the value of $evalMode will be zero. if($evalMode == 1) { catch (`evaluationManager -mode "off"`); catch (`evaluationManager -manipulation off`); } else if($evalMode == 2) { catch (`evaluationManager -mode "serial"`); catch (`evaluationManager -manipulation on`); } else if($evalMode == 3) { catch (`evaluationManager -mode "parallel"`); catch (`evaluationManager -manipulation on`); } if(($gpuOverride && !isEvaluatorActive( "deformer" )) || (!$gpuOverride && isEvaluatorActive( "deformer" ))) { toggleOpenCLEvaluator(); } // If any of the preferences were modified then do not override them. int $optionsExist = `optionVar -exists "cachedPlaybackEnable"`; if (! `pluginInfo -q -loaded "cacheEvaluator"` ) { loadPlugin "cacheEvaluator"; } // Caching playback preferences are managed through Python methods so call // into them to complete initialization of the animation preference optionVars. // This has to happen before changing modes, otherwise the preference would overwrite the default. python( "from maya.plugin.evaluator.cache_preferences import cache_preferences_initialize" ); python( "cache_preferences_initialize()" ); // For now we force "Evaluation caching" if the user has not previously saved a preferred mode if( $optionsExist == 0 ) { string $pythonScript = "from maya.plugin.evaluator.CacheEvaluatorManager import CacheEvaluatorManager, CACHE_STANDARD_MODE_EVAL \n" + "CacheEvaluatorManager().mode = CACHE_STANDARD_MODE_EVAL" ; python $pythonScript; } }