2
$\begingroup$

I basically want to press this X button using python, or possible just switch to another image.

enter image description here

The reason why I want to do this is because I'm using the image editor to move and scale the UV vertices of an object, and it doesn't work if the "Rendered Result" image is selected in the image editor, any other image can be selected, just not this one.

bpy.context.area.type = 'IMAGE_EDITOR'
bpy.ops.uv.select_all(action='TOGGLE')
bpy.ops.transform.resize(value=(0,0,0))
bpy.ops.transform.translate(value=(-tx,-ty,0))
$\endgroup$
4
$\begingroup$

Check if it is a render image then switch to another one (in here no image is chosen )

for area in bpy.context.screen.areas :
    if area.type == 'IMAGE_EDITOR' :
        if area.spaces.active.image.type == 'RENDER_RESULT' :
            area.spaces.active.image = None
$\endgroup$
  • $\begingroup$ @rymdnisse you are welcome $\endgroup$ – Chebhou May 23 '15 at 21:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.