View Full Version : refresh UI during a running script
I'm using a python script to create render layers, put objects selected in them, and at the end I have to change the shaders of objects in the different render layers. By hand it's working well, but within the script it's not working at all. Render layers are created but the shaders are not changed. If I cut the script in two parts, the first to create render layers and the second one to change the shaders it's ok if I launch the first and then the second one when the first one is finished, but not within one script.
I think it's because the render layers window is not refreshed during the execution of the script, but can I force the refresh during the running script?
Or is there a way to change by script the shader of a specific object in a specific render layer?
Thanks a lot,
use the refresh command :)
unfortunately refresh isn't working...
this is my code
sel = mc.ls(sl=1)
for l in range(1,9):
mc.createRenderLayer (sel, name=nameRL, noRecurse=1)
for i in range(1,9):
nameRL = 'RL_%d' %i
mel.eval('layerEditorLayerButtonSelect 0 ' + nameRL)
for j in range (1,100): print j
#during the loop after the refresh command I can see that the render layers window is not refreshed at all :(
Do you see what's wrong?
I've never tried refresh in a python script. I have had some some success using eval(), as it calls the script differently.
03-19-2009, 05:40 PM
I don't believe there is any way to easily force the Render Layers panel to refresh. You would need to have a look at how the Render Layers panel is setup and hope to find a method that you can invoke on it that will update its elements.
The refresh command only controls the viewports. Calling the refresh after having changed the shader for an object in a given render layer should still update in the viewport if the change was made in the active render layer.
03-19-2009, 05:40 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.