Keilun, again : Thank you very much
That's great you take time to help me.
I achieve to do as you suggest me (pymel) for all model panel :
from pymel.core import *
for elem in getPanel(typ="modelPanel") :
mel.eval( 'setRendererInModelPanel "ogsRenderer" '+ elem.name() )
And it's working fine.
Now I have a new problem. The first time I run the script on a new scene, I get an error here :
# MelError: Error during execution of MEL script: file: C:/Program Files/Autodesk/Maya2013/scripts/others/createObjectTypeFilters.mel line 146: Object Type Filter name array size does not match value array size
# objectTypeFilterOffCallback 0 #
But after this error, if I run the script again, I have not any error.
The error is when I set in HardwareRenderingGlobals / Batch Render Options / Object Type Filters some values.
Uncheck Nurbs Curve is : "objectTypeFilterOffCallback 0"
To reproduce the problem first do new scene then execute this :
setRendererInModelPanel "ogsRenderer" modelPanel1;
setRendererInModelPanel "ogsRenderer" modelPanel2;
setRendererInModelPanel "ogsRenderer" modelPanel3;
setRendererInModelPanel "ogsRenderer" modelPanel4;
At this time you get the error. Again and again, each time you run the previous code.
But if you show in the ui the hardwareRenderingGlobals options windows, then the previous code works fine. It works also if you close the windows !
I guess, perhaps, that is because I need to update something after setting hardware renderer as the renderer.
I see a workaround : Force to show the render option windows by script. Is it possible ?