本文整理汇总了C++中BKE_image_signal函数的典型用法代码示例。如果您正苦于以下问题:C++ BKE_image_signal函数的具体用法?C++ BKE_image_signal怎么用?C++ BKE_image_signal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BKE_image_signal函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: image_rect_update
static void image_rect_update(void *rjv, RenderResult *rr, volatile rcti *renrect)
{
RenderJob *rj = rjv;
Image *ima = rj->image;
ImBuf *ibuf;
void *lock;
/* only update if we are displaying the slot being rendered */
if (ima->render_slot != ima->last_render_slot) {
rj->image_outdated = true;
return;
}
else if (rj->image_outdated) {
/* update entire render */
rj->image_outdated = false;
BKE_image_signal(ima, NULL, IMA_SIGNAL_COLORMANAGE);
*(rj->do_update) = TRUE;
return;
}
/* update part of render */
ibuf = BKE_image_acquire_ibuf(ima, &rj->iuser, &lock);
if (ibuf) {
image_buffer_rect_update(rj->scene, rr, ibuf, renrect);
/* make jobs timer to send notifier */
*(rj->do_update) = TRUE;
}
BKE_image_release_ibuf(ima, ibuf, lock);
}
开发者ID:diosney,项目名称:blender,代码行数:30,代码来源:render_internal.c
示例2: ED_space_image_set
/* called to assign images to UV faces */
void ED_space_image_set(SpaceImage *sima, Scene *scene, Object *obedit, Image *ima)
{
/* context may be NULL, so use global */
ED_uvedit_assign_image(G.main, scene, obedit, ima, sima->image);
/* change the space ima after because uvedit_face_visible_test uses the space ima
* to check if the face is displayed in UV-localview */
sima->image = ima;
if (ima == NULL || ima->type == IMA_TYPE_R_RESULT || ima->type == IMA_TYPE_COMPOSITE) {
if (sima->mode == SI_MODE_PAINT) {
sima->mode = SI_MODE_VIEW;
}
}
if (sima->image)
BKE_image_signal(sima->image, &sima->iuser, IMA_SIGNAL_USER_NEW_IMAGE);
id_us_ensure_real((ID *)sima->image);
if (obedit)
WM_main_add_notifier(NC_GEOM | ND_DATA, obedit->data);
WM_main_add_notifier(NC_SPACE | ND_SPACE_IMAGE, NULL);
}
开发者ID:Moguri,项目名称:blender,代码行数:26,代码来源:image_edit.c
示例3: rna_Image_reload_update
static void rna_Image_reload_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Image *ima = ptr->id.data;
BKE_image_signal(ima, NULL, IMA_SIGNAL_RELOAD);
WM_main_add_notifier(NC_IMAGE | NA_EDITED, &ima->id);
DAG_id_tag_update(&ima->id, 0);
}
开发者ID:silkentrance,项目名称:blender,代码行数:7,代码来源:rna_image.c
示例4: rna_Image_colormanage_update
static void rna_Image_colormanage_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Image *ima = ptr->id.data;
BKE_image_signal(ima, NULL, IMA_SIGNAL_COLORMANAGE);
DAG_id_tag_update(&ima->id, 0);
WM_main_add_notifier(NC_IMAGE | ND_DISPLAY, &ima->id);
WM_main_add_notifier(NC_IMAGE | NA_EDITED, &ima->id);
}
开发者ID:silkentrance,项目名称:blender,代码行数:8,代码来源:rna_image.c
示例5: rna_Image_source_set
static void rna_Image_source_set(PointerRNA *ptr, int value)
{
Image *ima = ptr->id.data;
if (value != ima->source) {
ima->source = value;
BKE_image_signal(ima, NULL, IMA_SIGNAL_SRC_CHANGE);
DAG_id_tag_update(&ima->id, 0);
}
}
开发者ID:silkentrance,项目名称:blender,代码行数:10,代码来源:rna_image.c
示例6: screen_render_exec
/* executes blocking render */
static int screen_render_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
SceneRenderLayer *srl = NULL;
Render *re;
Image *ima;
View3D *v3d = CTX_wm_view3d(C);
Main *mainp = CTX_data_main(C);
unsigned int lay_override;
const bool is_animation = RNA_boolean_get(op->ptr, "animation");
const bool is_write_still = RNA_boolean_get(op->ptr, "write_still");
struct Object *camera_override = v3d ? V3D_CAMERA_LOCAL(v3d) : NULL;
/* custom scene and single layer re-render */
screen_render_scene_layer_set(op, mainp, &scene, &srl);
if (!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) {
BKE_report(op->reports, RPT_ERROR, "Cannot write a single file with an animation format selected");
return OPERATOR_CANCELLED;
}
re = RE_NewRender(scene->id.name);
lay_override = (v3d && v3d->lay != scene->lay) ? v3d->lay : 0;
G.is_break = false;
RE_test_break_cb(re, NULL, render_break);
ima = BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result");
BKE_image_signal(ima, NULL, IMA_SIGNAL_FREE);
BKE_image_backup_render(scene, ima);
/* cleanup sequencer caches before starting user triggered render.
* otherwise, invalidated cache entries can make their way into
* the output rendering. We can't put that into RE_BlenderFrame,
* since sequence rendering can call that recursively... (peter) */
BKE_sequencer_cache_cleanup();
RE_SetReports(re, op->reports);
BLI_begin_threaded_malloc();
if (is_animation)
RE_BlenderAnim(re, mainp, scene, camera_override, lay_override, scene->r.sfra, scene->r.efra, scene->r.frame_step);
else
RE_BlenderFrame(re, mainp, scene, srl, camera_override, lay_override, scene->r.cfra, is_write_still);
BLI_end_threaded_malloc();
RE_SetReports(re, NULL);
// no redraw needed, we leave state as we entered it
ED_update_for_newframe(mainp, scene, 1);
WM_event_add_notifier(C, NC_SCENE | ND_RENDER_RESULT, scene);
return OPERATOR_FINISHED;
}
开发者ID:GeniaPenksik,项目名称:blender,代码行数:56,代码来源:render_internal.c
示例7: node_composit_exec_composite
/* applies to render pipeline */
static void node_composit_exec_composite(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
{
/* image assigned to output */
/* stack order input sockets: col, alpha, z */
if(node->flag & NODE_DO_OUTPUT) { /* only one works on out */
Scene *scene= (Scene *)node->id;
RenderData *rd= data;
if(scene && (rd->scemode & R_DOCOMP)) {
Render *re= RE_GetRender(scene->id.name);
RenderResult *rr= RE_AcquireResultWrite(re);
if(rr) {
CompBuf *outbuf, *zbuf=NULL;
if(rr->rectf)
MEM_freeN(rr->rectf);
outbuf= alloc_compbuf(rr->rectx, rr->recty, CB_RGBA, 1);
if(in[1]->data==NULL)
composit1_pixel_processor(node, outbuf, in[0]->data, in[0]->vec, do_copy_rgba, CB_RGBA);
else
composit2_pixel_processor(node, outbuf, in[0]->data, in[0]->vec, in[1]->data, in[1]->vec, do_copy_a_rgba, CB_RGBA, CB_VAL);
if(in[2]->data) {
if(rr->rectz)
MEM_freeN(rr->rectz);
zbuf= alloc_compbuf(rr->rectx, rr->recty, CB_VAL, 1);
composit1_pixel_processor(node, zbuf, in[2]->data, in[2]->vec, do_copy_value, CB_VAL);
rr->rectz= zbuf->rect;
zbuf->malloc= 0;
free_compbuf(zbuf);
}
generate_preview(data, node, outbuf);
/* we give outbuf to rr... */
rr->rectf= outbuf->rect;
outbuf->malloc= 0;
free_compbuf(outbuf);
RE_ReleaseResult(re);
/* signal for imageviewer to refresh (it converts to byte rects...) */
BKE_image_signal(BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result"), NULL, IMA_SIGNAL_FREE);
return;
}
else
RE_ReleaseResult(re);
}
}
if(in[0]->data)
generate_preview(data, node, in[0]->data);
}
开发者ID:jinjoh,项目名称:NOOR,代码行数:54,代码来源:CMP_composite.c
示例8: RE_GetRender
void CompositorOperation::deinitExecution()
{
if (!this->m_active)
return;
if (!isBreaked()) {
Render *re = RE_GetRender(this->m_sceneName);
RenderResult *rr = RE_AcquireResultWrite(re);
if (rr) {
if (rr->rectf != NULL) {
MEM_freeN(rr->rectf);
}
rr->rectf = this->m_outputBuffer;
if (rr->rectz != NULL) {
MEM_freeN(rr->rectz);
}
rr->rectz = this->m_depthBuffer;
}
else {
if (this->m_outputBuffer) {
MEM_freeN(this->m_outputBuffer);
}
if (this->m_depthBuffer) {
MEM_freeN(this->m_depthBuffer);
}
}
if (re) {
RE_ReleaseResult(re);
re = NULL;
}
BLI_lock_thread(LOCK_DRAW_IMAGE);
BKE_image_signal(BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result"), NULL, IMA_SIGNAL_FREE);
BLI_unlock_thread(LOCK_DRAW_IMAGE);
}
else {
if (this->m_outputBuffer) {
MEM_freeN(this->m_outputBuffer);
}
if (this->m_depthBuffer) {
MEM_freeN(this->m_depthBuffer);
}
}
this->m_outputBuffer = NULL;
this->m_depthBuffer = NULL;
this->m_imageInput = NULL;
this->m_alphaInput = NULL;
this->m_depthInput = NULL;
}
开发者ID:BlueLabelStudio,项目名称:blender,代码行数:52,代码来源:COM_CompositorOperation.cpp
示例9: rna_Image_source_set
static void rna_Image_source_set(PointerRNA *ptr, int value)
{
Image *ima = ptr->id.data;
if (value != ima->source) {
ima->source = value;
BLI_assert(BKE_id_is_in_global_main(&ima->id));
BKE_image_signal(G_MAIN, ima, NULL, IMA_SIGNAL_SRC_CHANGE);
DEG_id_tag_update(&ima->id, 0);
DEG_id_tag_update(&ima->id, ID_RECALC_EDITORS);
DEG_relations_tag_update(G_MAIN);
}
}
开发者ID:dfelinto,项目名称:blender,代码行数:13,代码来源:rna_image.c
示例10: rna_Image_views_format_update
static void rna_Image_views_format_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Image *ima = ptr->id.data;
ImBuf *ibuf;
void *lock;
ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
if (ibuf) {
ImageUser iuser = {NULL};
iuser.scene = scene;
BKE_image_signal(bmain, ima, &iuser, IMA_SIGNAL_FREE);
}
BKE_image_release_ibuf(ima, ibuf, lock);
}
开发者ID:dfelinto,项目名称:blender,代码行数:16,代码来源:rna_image.c
示例11: unpackImage
int unpackImage(ReportList *reports, Image *ima, int how)
{
int ret_value = RET_ERROR;
if (ima != NULL) {
while (ima->packedfiles.last) {
char localname[FILE_MAX], absname[FILE_MAX];
char *newname;
ImagePackedFile *imapf = ima->packedfiles.last;
unpack_generate_paths(imapf->filepath, (ID *)ima, absname, localname, sizeof(absname), sizeof(localname));
newname = unpackFile(reports, absname, localname, imapf->packedfile, how);
if (newname != NULL) {
ImageView *iv;
ret_value = ret_value == RET_ERROR ? RET_ERROR : RET_OK;
freePackedFile(imapf->packedfile);
imapf->packedfile = NULL;
/* update the new corresponding view filepath */
iv = BLI_findstring(&ima->views, imapf->filepath, offsetof(ImageView, filepath));
if (iv) {
BLI_strncpy(iv->filepath, newname, sizeof(imapf->filepath));
}
/* keep the new name in the image for non-pack specific reasons */
if (how != PF_REMOVE) {
BLI_strncpy(ima->name, newname, sizeof(imapf->filepath));
}
MEM_freeN(newname);
}
else {
ret_value = RET_ERROR;
}
BLI_remlink(&ima->packedfiles, imapf);
MEM_freeN(imapf);
}
}
if (ret_value == RET_OK) {
BKE_image_signal(ima, NULL, IMA_SIGNAL_RELOAD);
}
return(ret_value);
}
开发者ID:Bforartists,项目名称:Bforartists,代码行数:47,代码来源:packedFile.c
示例12: image_rect_update
static void image_rect_update(void *rjv, RenderResult *rr, volatile rcti *renrect)
{
RenderJob *rj = rjv;
Image *ima = rj->image;
ImBuf *ibuf;
void *lock;
const char *viewname = RE_GetActiveRenderView(rj->re);
/* only update if we are displaying the slot being rendered */
if (ima->render_slot != ima->last_render_slot) {
rj->image_outdated = true;
return;
}
else if (rj->image_outdated) {
/* update entire render */
rj->image_outdated = false;
BKE_image_signal(ima, NULL, IMA_SIGNAL_COLORMANAGE);
*(rj->do_update) = true;
return;
}
if (rr == NULL)
return;
/* update part of render */
render_image_update_pass_and_layer(rj, rr, &rj->iuser);
ibuf = BKE_image_acquire_ibuf(ima, &rj->iuser, &lock);
if (ibuf) {
/* Don't waste time on CPU side color management if
* image will be displayed using GLSL.
*
* Need to update rect if Save Buffers enabled because in
* this case GLSL doesn't have original float buffer to
* operate with.
*/
if (rr->do_exr_tile ||
ibuf->channels == 1 ||
U.image_draw_method != IMAGE_DRAW_METHOD_GLSL)
{
image_buffer_rect_update(rj, rr, ibuf, &rj->iuser, renrect, viewname);
}
/* make jobs timer to send notifier */
*(rj->do_update) = true;
}
BKE_image_release_ibuf(ima, ibuf, lock);
}
开发者ID:GeniaPenksik,项目名称:blender,代码行数:47,代码来源:render_internal.c
示例13: screen_render_exec
/* executes blocking render */
static int screen_render_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Render *re= RE_NewRender(scene->id.name);
Image *ima;
View3D *v3d= CTX_wm_view3d(C);
Main *mainp= CTX_data_main(C);
unsigned int lay= (v3d)? v3d->lay: scene->lay;
const short is_animation= RNA_boolean_get(op->ptr, "animation");
const short is_write_still= RNA_boolean_get(op->ptr, "write_still");
struct Object *camera_override= v3d ? V3D_CAMERA_LOCAL(v3d) : NULL;
if(!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.imtype)) {
BKE_report(op->reports, RPT_ERROR, "Can't write a single file with an animation format selected.");
return OPERATOR_CANCELLED;
}
G.afbreek= 0;
RE_test_break_cb(re, NULL, (int (*)(void *)) blender_test_break);
ima= BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result");
BKE_image_signal(ima, NULL, IMA_SIGNAL_FREE);
BKE_image_backup_render(scene, ima);
/* cleanup sequencer caches before starting user triggered render.
otherwise, invalidated cache entries can make their way into
the output rendering. We can't put that into RE_BlenderFrame,
since sequence rendering can call that recursively... (peter) */
seq_stripelem_cache_cleanup();
RE_SetReports(re, op->reports);
if(is_animation)
RE_BlenderAnim(re, mainp, scene, camera_override, lay, scene->r.sfra, scene->r.efra, scene->r.frame_step);
else
RE_BlenderFrame(re, mainp, scene, NULL, camera_override, lay, scene->r.cfra, is_write_still);
RE_SetReports(re, NULL);
// no redraw needed, we leave state as we entered it
ED_update_for_newframe(mainp, scene, CTX_wm_screen(C), 1);
WM_event_add_notifier(C, NC_SCENE|ND_RENDER_RESULT, scene);
return OPERATOR_FINISHED;
}
开发者ID:OldBrunet,项目名称:BGERTPS,代码行数:47,代码来源:render_internal.c
示例14: rna_Image_fields_update
static void rna_Image_fields_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Image *ima = ptr->id.data;
ImBuf *ibuf;
void *lock;
ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
if (ibuf) {
short nr = 0;
if (!(ima->flag & IMA_FIELDS) && (ibuf->flags & IB_fields)) nr = 1;
if ((ima->flag & IMA_FIELDS) && !(ibuf->flags & IB_fields)) nr = 1;
if (nr)
BKE_image_signal(ima, NULL, IMA_SIGNAL_FREE);
}
BKE_image_release_ibuf(ima, ibuf, lock);
}
开发者ID:silkentrance,项目名称:blender,代码行数:20,代码来源:rna_image.c
示例15: unpackImage
int unpackImage(ReportList *reports, Image *ima, int how)
{
char localname[FILE_MAX], absname[FILE_MAX];
char *newname;
int ret_value = RET_ERROR;
if (ima != NULL && ima->name[0]) {
unpack_generate_paths(ima->name, (ID *)ima, absname, localname, sizeof(absname), sizeof(localname));
newname = unpackFile(reports, absname, localname, ima->packedfile, how);
if (newname != NULL) {
ret_value = RET_OK;
freePackedFile(ima->packedfile);
ima->packedfile = NULL;
BLI_strncpy(ima->name, newname, sizeof(ima->name));
MEM_freeN(newname);
BKE_image_signal(ima, NULL, IMA_SIGNAL_RELOAD);
}
}
return(ret_value);
}
开发者ID:akonneker,项目名称:blensor,代码行数:21,代码来源:packedFile.c
示例16: image_rect_update
static void image_rect_update(void *rjv, RenderResult *rr, volatile rcti *renrect)
{
RenderJob *rj = rjv;
Image *ima = rj->image;
ImBuf *ibuf;
void *lock;
/* only update if we are displaying the slot being rendered */
if (ima->render_slot != ima->last_render_slot) {
rj->image_outdated = true;
return;
}
else if (rj->image_outdated) {
/* update entire render */
rj->image_outdated = false;
BKE_image_signal(ima, NULL, IMA_SIGNAL_COLORMANAGE);
*(rj->do_update) = TRUE;
return;
}
/* update part of render */
render_image_update_pass_and_layer(rj, rr, &rj->iuser);
ibuf = BKE_image_acquire_ibuf(ima, &rj->iuser, &lock);
if (ibuf) {
/* Don't waste time on CPU side color management if
* image will be displayed using GLSL.
*/
if (ibuf->channels == 1 ||
U.image_draw_method != IMAGE_DRAW_METHOD_GLSL)
{
image_buffer_rect_update(rj->scene, rr, ibuf, &rj->iuser, renrect);
}
/* make jobs timer to send notifier */
*(rj->do_update) = TRUE;
}
BKE_image_release_ibuf(ima, ibuf, lock);
}
开发者ID:silkentrance,项目名称:blender,代码行数:38,代码来源:render_internal.c
示例17: screen_opengl_render_init
//.........这里部分代码省略.........
if (is_sequencer) {
is_view_context = false;
}
else {
/* ensure we have a 3d view */
if (!ED_view3d_context_activate(C)) {
RNA_boolean_set(op->ptr, "view_context", false);
is_view_context = false;
}
if (!is_view_context && scene->camera == NULL) {
BKE_report(op->reports, RPT_ERROR, "Scene has no camera");
return false;
}
}
if (!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) {
BKE_report(op->reports, RPT_ERROR, "Cannot write a single file with an animation format selected");
return false;
}
/* stop all running jobs, except screen one. currently previews frustrate Render */
WM_jobs_kill_all_except(wm, CTX_wm_screen(C));
/* create offscreen buffer */
sizex = (scene->r.size * scene->r.xsch) / 100;
sizey = (scene->r.size * scene->r.ysch) / 100;
/* corrects render size with actual size, not every card supports non-power-of-two dimensions */
ofs = GPU_offscreen_create(sizex, sizey, err_out);
if (!ofs) {
BKE_reportf(op->reports, RPT_ERROR, "Failed to create OpenGL off-screen buffer, %s", err_out);
return false;
}
/* allocate opengl render */
oglrender = MEM_callocN(sizeof(OGLRender), "OGLRender");
op->customdata = oglrender;
oglrender->ofs = ofs;
oglrender->sizex = sizex;
oglrender->sizey = sizey;
oglrender->bmain = CTX_data_main(C);
oglrender->scene = scene;
oglrender->cfrao = scene->r.cfra;
oglrender->write_still = is_write_still && !is_animation;
oglrender->is_sequencer = is_sequencer;
if (is_sequencer) {
oglrender->sseq = CTX_wm_space_seq(C);
}
oglrender->prevsa = prevsa;
oglrender->prevar = prevar;
if (is_view_context) {
ED_view3d_context_user_region(C, &oglrender->v3d, &oglrender->ar); /* so quad view renders camera */
oglrender->rv3d = oglrender->ar->regiondata;
/* MUST be cleared on exit */
oglrender->scene->customdata_mask_modal = ED_view3d_datamask(oglrender->scene, oglrender->v3d);
/* apply immediately in case we're rendering from a script,
* running notifiers again will overwrite */
oglrender->scene->customdata_mask |= oglrender->scene->customdata_mask_modal;
if (oglrender->v3d->fx_settings.fx_flag & (GPU_FX_FLAG_DOF | GPU_FX_FLAG_SSAO)) {
oglrender->fx = GPU_fx_compositor_create();
}
}
/* create render */
oglrender->re = RE_NewRender(scene->id.name);
/* create image and image user */
oglrender->ima = BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result");
BKE_image_signal(oglrender->ima, NULL, IMA_SIGNAL_FREE);
BKE_image_backup_render(oglrender->scene, oglrender->ima);
oglrender->iuser.scene = scene;
oglrender->iuser.ok = 1;
/* create render result */
RE_InitState(oglrender->re, NULL, &scene->r, NULL, sizex, sizey, NULL);
/* create render views */
screen_opengl_views_setup(oglrender);
/* wm vars */
oglrender->wm = wm;
oglrender->win = win;
oglrender->totvideos = 0;
oglrender->mh = NULL;
oglrender->movie_ctx_arr = NULL;
return true;
}
开发者ID:mcgrathd,项目名称:blender,代码行数:101,代码来源:render_opengl.c
示例18: rna_Image_reload
static void rna_Image_reload(Image *image)
{
BKE_image_signal(image, NULL, IMA_SIGNAL_RELOAD);
}
开发者ID:Walid-Shouman,项目名称:Blender,代码行数:4,代码来源:rna_image_api.c
示例19: rna_Image_reload
static void rna_Image_reload(Image *image, Main *bmain)
{
BKE_image_signal(bmain, image, NULL, IMA_SIGNAL_RELOAD);
}
开发者ID:Ichthyostega,项目名称:blender,代码行数:4,代码来源:rna_image_api.c
示例20: screen_render_invoke
//.........这里部分代码省略.........
WM_cursor_wait(1);
/* flush multires changes (for sculpt) */
multires_force_render_update(active_object);
/* flush changes from dynamic topology sculpt */
sculptsession_bm_to_me_for_render(active_object);
/* cleanup sequencer caches before starting user triggered render.
* otherwise, invalidated cache entries can make their way into
* the output rendering. We can't put that into RE_BlenderFrame,
* since sequence rendering can call that recursively... (peter) */
BKE_sequencer_cache_cleanup();
/* get editmode results */
ED_object_editmode_load(CTX_data_edit_object(C));
// store spare
// get view3d layer, local layer, make this nice api call to render
// store spare
/* ensure at least 1 area shows result */
render_view_open(C, event->x, event->y);
jobflag = WM_JOB_EXCL_RENDER | WM_JOB_PRIORITY | WM_JOB_PROGRESS;
/* custom scene and single layer re-render */
screen_render_scene_layer_set(op, mainp, &scene, &srl);
if (RNA_struct_property_is_set(op->ptr, "layer"))
jobflag |= WM_JOB_SUSPEND;
/* job custom data */
rj = MEM_callocN(sizeof(RenderJob), "render job");
rj->main = mainp;
rj->scene = scene;
rj->win = CTX_wm_window(C);
rj->srl = srl;
rj->camera_override = camera_override;
rj->lay = scene->lay;
rj->anim = is_animation;
rj->write_still = is_write_still && !is_animation;
rj->iuser.scene = scene;
rj->iuser.ok = 1;
rj->reports = op->reports;
if (v3d) {
rj->lay = v3d->lay;
if (v3d->localvd)
rj->lay |= v3d->localvd->lay;
}
/* setup job */
if (RE_seq_render_active(scene, &scene->r)) name = "Sequence Render";
else name = "Render";
wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, name, jobflag, WM_JOB_TYPE_RENDER);
WM_jobs_customdata_set(wm_job, rj, render_freejob);
WM_jobs_timer(wm_job, 0.2, NC_SCENE | ND_RENDER_RESULT, 0);
WM_jobs_callbacks(wm_job, render_startjob, NULL, NULL, render_endjob);
/* get a render result image, and make sure it is empty */
ima = BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result");
BKE_image_signal(ima, NULL, IMA_SIGNAL_FREE);
BKE_image_backup_render(rj->scene, ima);
rj->image = ima;
/* setup new render */
re = RE_NewRender(scene->id.name);
RE_test_break_cb(re, rj, render_breakjob);
RE_draw_lock_cb(re, rj, render_drawlock);
RE_display_draw_cb(re, rj, image_rect_update);
RE_stats_draw_cb(re, rj, image_renderinfo_cb);
RE_progress_cb(re, rj, render_progress_update);
rj->re = re;
G.is_break = FALSE;
/* store actual owner of job, so modal operator could check for it,
* the reason of this is that active scene could change when rendering
* several layers from compositor [#31800]
*/
op->customdata = scene;
WM_jobs_start(CTX_wm_manager(C), wm_job);
WM_cursor_wait(0);
WM_event_add_notifier(C, NC_SCENE | ND_RENDER_RESULT, scene);
/* we set G.is_rendering here already instead of only in the job, this ensure
* main loop or other scene updates are disabled in time, since they may
* have started before the job thread */
G.is_rendering = TRUE;
/* add modal handler for ESC */
WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
}
开发者ID:JasonWilkins,项目名称:blender-wayland,代码行数:101,代码来源:render_internal.c
注:本文中的BKE_image_signal函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论