Previous Thread  Next Thread

chat icon Setting the bake destination image

trethaller

Posted: Wed Aug 08, 2012 8:34 pm
Joined: 24 Jun 2012
Posts: 1
Hi there.
I'm trying to set the bake destination image pragmatically to enable batch bake rendering. There was some threads about this, but the working solution is very ugly and not robust:
Code:

bpy.data.screens['UV Editing'].areas[1].spaces[0].image = bpy.data.images[key]


So I decided to give it a new try. It turns out that the last image that was unwrapped in the UV/Image editor will always be the target.

Looking at the source, I found that the IMA_USED_FOR_RENDER flag is used to determine which image is used for rendering.

In imagetexture.c:
Code:

int imagewraposa(...)
{
    ...
    if (ima) {

        /* hack for icon render */
        if (ima->ibufs.first==NULL && (R.r.scemode & R_NO_IMAGE_LOAD))
            return retval;
       
        ibuf= BKE_image_get_ibuf(ima, &tex->iuser);

        ima->flag|= IMA_USED_FOR_RENDER;
    }
    ...
}


And IMA_USED_FOR_RENDER is then tested in int RE_bake_shade_all_selected(...).

Do you have any idea how to change this (even incidentally) from Python ? I guess anything would be better than using the screens panels

Or maybe it should be exposed ?
Reply with quote


 
Jump to:  
Powered by phpBB © 2001, 2005 phpBB Group