本文整理匯總了C++中BKE_image_signal函數的典型用法代碼示例。如果您正苦於以下問題:C++ BKE_image_signal函數的具體用法?C++ BKE_image_signal怎麽用?C++ BKE_image_signal使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了BKE_image_signal函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}