Blender  V2.93
render_internal.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2008 Blender Foundation.
17  * All rights reserved.
18  */
19 
24 #include <math.h>
25 #include <stddef.h>
26 #include <string.h>
27 
28 #include "MEM_guardedalloc.h"
29 
30 #include "BLI_listbase.h"
31 #include "BLI_math.h"
32 #include "BLI_rect.h"
33 #include "BLI_threads.h"
34 #include "BLI_timecode.h"
35 #include "BLI_utildefines.h"
36 
37 #include "PIL_time.h"
38 
39 #include "BLT_translation.h"
40 
41 #include "DNA_object_types.h"
42 #include "DNA_scene_types.h"
43 #include "DNA_userdef_types.h"
44 #include "DNA_view3d_types.h"
45 
46 #include "BKE_colortools.h"
47 #include "BKE_context.h"
48 #include "BKE_global.h"
49 #include "BKE_image.h"
50 #include "BKE_lib_id.h"
51 #include "BKE_main.h"
52 #include "BKE_node.h"
53 #include "BKE_object.h"
54 #include "BKE_report.h"
55 #include "BKE_scene.h"
56 #include "BKE_screen.h"
57 
58 #include "DEG_depsgraph.h"
59 
60 #include "WM_api.h"
61 #include "WM_types.h"
62 
63 #include "ED_render.h"
64 #include "ED_screen.h"
65 #include "ED_util.h"
66 
67 #include "BIF_glutil.h"
68 
69 #include "RE_engine.h"
70 #include "RE_pipeline.h"
71 
72 #include "IMB_colormanagement.h"
73 #include "IMB_imbuf_types.h"
74 
75 #include "RNA_access.h"
76 #include "RNA_define.h"
77 
78 #include "SEQ_relations.h"
79 
80 #include "render_intern.h"
81 
82 /* Render Callbacks */
83 static int render_break(void *rjv);
84 
85 typedef struct RenderJob {
90  /* TODO(sergey): Should not be needed once engine will have own
91  * depsgraph and copy-on-write will be implemented.
92  */
101  short *stop;
102  short *do_update;
103  float *progress;
113 
114 /* called inside thread! */
116  const ImBuf *ibuf,
117  volatile rcti *renrect,
118  rcti *r_ibuf_rect,
119  int *r_offset_x,
120  int *r_offset_y)
121 {
122  int tile_y, tile_height, tile_x, tile_width;
123 
124  /* if renrect argument, we only refresh scanlines */
125  if (renrect) {
126  /* if (tile_height == recty), rendering of layer is ready,
127  * we should not draw, other things happen... */
128  if (rr->renlay == NULL || renrect->ymax >= rr->recty) {
129  return false;
130  }
131 
132  /* tile_x here is first subrect x coord, tile_width defines subrect width */
133  tile_x = renrect->xmin;
134  tile_width = renrect->xmax - tile_x;
135  if (tile_width < 2) {
136  return false;
137  }
138 
139  tile_y = renrect->ymin;
140  tile_height = renrect->ymax - tile_y;
141  if (tile_height < 2) {
142  return false;
143  }
144  renrect->ymin = renrect->ymax;
145  }
146  else {
147  tile_x = tile_y = 0;
148  tile_width = rr->rectx;
149  tile_height = rr->recty;
150  }
151 
152  /* tile_x tile_y is in tile coords. transform to ibuf */
153  int offset_x = rr->tilerect.xmin;
154  if (offset_x >= ibuf->x) {
155  return false;
156  }
157  int offset_y = rr->tilerect.ymin;
158  if (offset_y >= ibuf->y) {
159  return false;
160  }
161 
162  if (offset_x + tile_width > ibuf->x) {
163  tile_width = ibuf->x - offset_x;
164  }
165  if (offset_y + tile_height > ibuf->y) {
166  tile_height = ibuf->y - offset_y;
167  }
168 
169  if (tile_width < 1 || tile_height < 1) {
170  return false;
171  }
172 
173  r_ibuf_rect->xmax = tile_x + tile_width;
174  r_ibuf_rect->ymax = tile_y + tile_height;
175  r_ibuf_rect->xmin = tile_x;
176  r_ibuf_rect->ymin = tile_y;
177  *r_offset_x = offset_x;
178  *r_offset_y = offset_y;
179  return true;
180 }
181 
183  RenderResult *rr,
184  ImBuf *ibuf,
185  ImageUser *iuser,
186  const rcti *tile_rect,
187  int offset_x,
188  int offset_y,
189  const char *viewname)
190 {
191  Scene *scene = rj->scene;
192  const float *rectf = NULL;
193  int linear_stride, linear_offset_x, linear_offset_y;
194  ColorManagedViewSettings *view_settings;
195  ColorManagedDisplaySettings *display_settings;
196 
197  if (ibuf->userflags & IB_DISPLAY_BUFFER_INVALID) {
198  /* The whole image buffer is to be color managed again anyway. */
199  return;
200  }
201 
202  /* The thing here is, the logic below (which was default behavior
203  * of how rectf is acquiring since forever) gives float buffer for
204  * composite output only. This buffer can not be used for other
205  * passes obviously.
206  *
207  * We might try finding corresponding for pass buffer in render result
208  * (which is actually missing when rendering with Cycles, who only
209  * writes all the passes when the tile is finished) or use float
210  * buffer from image buffer as reference, which is easier to use and
211  * contains all the data we need anyway.
212  * - sergey -
213  */
214  /* TODO(sergey): Need to check has_combined here? */
215  if (iuser->pass == 0) {
216  RenderView *rv;
217  const int view_id = BKE_scene_multiview_view_id_get(&scene->r, viewname);
218  rv = RE_RenderViewGetById(rr, view_id);
219 
220  /* find current float rect for display, first case is after composite... still weak */
221  if (rv->rectf) {
222  rectf = rv->rectf;
223  }
224  else {
225  if (rv->rect32) {
226  /* special case, currently only happens with sequencer rendering,
227  * which updates the whole frame, so we can only mark display buffer
228  * as invalid here (sergey)
229  */
231  return;
232  }
233  if (rr->renlay == NULL) {
234  return;
235  }
236  rectf = RE_RenderLayerGetPass(rr->renlay, RE_PASSNAME_COMBINED, viewname);
237  }
238  if (rectf == NULL) {
239  return;
240  }
241 
242  rectf += 4 * (rr->rectx * tile_rect->ymin + tile_rect->xmin);
243  linear_stride = rr->rectx;
244  linear_offset_x = offset_x;
245  linear_offset_y = offset_y;
246  }
247  else {
248  rectf = ibuf->rect_float;
249  linear_stride = ibuf->x;
250  linear_offset_x = 0;
251  linear_offset_y = 0;
252  }
253 
254  view_settings = &scene->view_settings;
255  display_settings = &scene->display_settings;
256 
258  rectf,
259  NULL,
260  linear_stride,
261  linear_offset_x,
262  linear_offset_y,
263  view_settings,
264  display_settings,
265  offset_x,
266  offset_y,
267  offset_x + BLI_rcti_size_x(tile_rect),
268  offset_y + BLI_rcti_size_y(tile_rect));
269 }
270 
271 /* ****************************** render invoking ***************** */
272 
273 /* set callbacks, exported to sequence render too.
274  * Only call in foreground (UI) renders. */
275 
277  wmOperator *op, Main *mainp, ViewLayer *active_layer, Scene **scene, ViewLayer **single_layer)
278 {
279  /* single layer re-render */
280  if (RNA_struct_property_is_set(op->ptr, "scene")) {
281  Scene *scn;
282  char scene_name[MAX_ID_NAME - 2];
283 
284  RNA_string_get(op->ptr, "scene", scene_name);
285  scn = (Scene *)BLI_findstring(&mainp->scenes, scene_name, offsetof(ID, name) + 2);
286 
287  if (scn) {
288  /* camera switch wont have updated */
289  scn->r.cfra = (*scene)->r.cfra;
291 
292  *scene = scn;
293  }
294  }
295 
296  if (RNA_struct_property_is_set(op->ptr, "layer")) {
297  ViewLayer *rl;
298  char rl_name[RE_MAXNAME];
299 
300  RNA_string_get(op->ptr, "layer", rl_name);
301  rl = (ViewLayer *)BLI_findstring(&(*scene)->view_layers, rl_name, offsetof(ViewLayer, name));
302 
303  if (rl) {
304  *single_layer = rl;
305  }
306  }
307  else if (((*scene)->r.scemode & R_SINGLE_LAYER) && active_layer) {
308  *single_layer = active_layer;
309  }
310 }
311 
312 /* executes blocking render */
314 {
317  ViewLayer *active_layer = CTX_data_view_layer(C);
318  ViewLayer *single_layer = NULL;
319  Render *re;
320  Image *ima;
321  View3D *v3d = CTX_wm_view3d(C);
322  Main *mainp = CTX_data_main(C);
323  const bool is_animation = RNA_boolean_get(op->ptr, "animation");
324  const bool is_write_still = RNA_boolean_get(op->ptr, "write_still");
325  struct Object *camera_override = v3d ? V3D_CAMERA_LOCAL(v3d) : NULL;
326 
327  /* Cannot do render if there is not this function. */
328  if (re_type->render == NULL) {
329  return OPERATOR_CANCELLED;
330  }
331 
332  /* custom scene and single layer re-render */
333  screen_render_single_layer_set(op, mainp, active_layer, &scene, &single_layer);
334 
335  if (!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) {
336  BKE_report(
337  op->reports, RPT_ERROR, "Cannot write a single file with an animation format selected");
338  return OPERATOR_CANCELLED;
339  }
340 
341  re = RE_NewSceneRender(scene);
342 
343  G.is_break = false;
344 
345  RE_draw_lock_cb(re, NULL, NULL);
347 
348  ima = BKE_image_ensure_viewer(mainp, IMA_TYPE_R_RESULT, "Render Result");
349  BKE_image_signal(mainp, ima, NULL, IMA_SIGNAL_FREE);
350  BKE_image_backup_render(scene, ima, true);
351 
352  /* cleanup sequencer caches before starting user triggered render.
353  * otherwise, invalidated cache entries can make their way into
354  * the output rendering. We can't put that into RE_RenderFrame,
355  * since sequence rendering can call that recursively... (peter) */
357 
358  RE_SetReports(re, op->reports);
359 
360  if (is_animation) {
361  RE_RenderAnim(re,
362  mainp,
363  scene,
364  single_layer,
365  camera_override,
366  scene->r.sfra,
367  scene->r.efra,
368  scene->r.frame_step);
369  }
370  else {
371  RE_RenderFrame(re, mainp, scene, single_layer, camera_override, scene->r.cfra, is_write_still);
372  }
373 
374  RE_SetReports(re, NULL);
375 
376  /* No redraw needed, we leave state as we entered it. */
378 
380 
381  return OPERATOR_FINISHED;
382 }
383 
384 static void render_freejob(void *rjv)
385 {
386  RenderJob *rj = rjv;
387 
389  MEM_freeN(rj);
390 }
391 
392 /* str is IMA_MAX_RENDER_TEXT in size */
393 static void make_renderinfo_string(const RenderStats *rs,
394  const Scene *scene,
395  const bool v3d_override,
396  const char *error,
397  char *str)
398 {
399  char info_time_str[32]; /* used to be extern to header_info.c */
400  uintptr_t mem_in_use, peak_memory;
401  float megs_used_memory, megs_peak_memory;
402  char *spos = str;
403 
405  peak_memory = MEM_get_peak_memory();
406 
407  megs_used_memory = (mem_in_use) / (1024.0 * 1024.0);
408  megs_peak_memory = (peak_memory) / (1024.0 * 1024.0);
409 
410  /* local view */
411  if (rs->localview) {
412  spos += sprintf(spos, "%s | ", TIP_("3D Local View"));
413  }
414  else if (v3d_override) {
415  spos += sprintf(spos, "%s | ", TIP_("3D View"));
416  }
417 
418  /* frame number */
419  spos += sprintf(spos, TIP_("Frame:%d "), (scene->r.cfra));
420 
421  /* previous and elapsed time */
422  BLI_timecode_string_from_time_simple(info_time_str, sizeof(info_time_str), rs->lastframetime);
423 
424  if (rs->infostr && rs->infostr[0]) {
425  if (rs->lastframetime != 0.0) {
426  spos += sprintf(spos, TIP_("| Last:%s "), info_time_str);
427  }
428  else {
429  spos += sprintf(spos, "| ");
430  }
431 
433  info_time_str, sizeof(info_time_str), PIL_check_seconds_timer() - rs->starttime);
434  }
435  else {
436  spos += sprintf(spos, "| ");
437  }
438 
439  spos += sprintf(spos, TIP_("Time:%s "), info_time_str);
440 
441  /* statistics */
442  if (rs->statstr) {
443  if (rs->statstr[0]) {
444  spos += sprintf(spos, "| %s ", rs->statstr);
445  }
446  }
447  else {
448  if (rs->mem_peak == 0.0f) {
449  spos += sprintf(spos, TIP_("| Mem:%.2fM (Peak %.2fM) "), megs_used_memory, megs_peak_memory);
450  }
451  else {
452  spos += sprintf(spos, TIP_("| Mem:%.2fM, Peak: %.2fM "), rs->mem_used, rs->mem_peak);
453  }
454  }
455 
456  /* extra info */
457  if (rs->infostr && rs->infostr[0]) {
458  spos += sprintf(spos, "| %s ", rs->infostr);
459  }
460  else if (error && error[0]) {
461  spos += sprintf(spos, "| %s ", error);
462  }
463 
464  /* very weak... but 512 characters is quite safe */
465  if (spos >= str + IMA_MAX_RENDER_TEXT) {
466  if (G.debug & G_DEBUG) {
467  printf("WARNING! renderwin text beyond limit\n");
468  }
469  }
470 }
471 
472 static void image_renderinfo_cb(void *rjv, RenderStats *rs)
473 {
474  RenderJob *rj = rjv;
475  RenderResult *rr;
476 
477  rr = RE_AcquireResultRead(rj->re);
478 
479  if (rr) {
480  /* malloc OK here, stats_draw is not in tile threads */
481  if (rr->text == NULL) {
482  rr->text = MEM_callocN(IMA_MAX_RENDER_TEXT, "rendertext");
483  }
484 
485  make_renderinfo_string(rs, rj->scene, rj->v3d_override, rr->error, rr->text);
486  }
487 
488  RE_ReleaseResult(rj->re);
489 
490  /* make jobs timer to send notifier */
491  *(rj->do_update) = true;
492 }
493 
494 static void render_progress_update(void *rjv, float progress)
495 {
496  RenderJob *rj = rjv;
497 
498  if (rj->progress && *rj->progress != progress) {
499  *rj->progress = progress;
500 
501  /* make jobs timer to send notifier */
502  *(rj->do_update) = true;
503  }
504 }
505 
506 /* Not totally reliable, but works fine in most of cases and
507  * in worst case would just make it so extra color management
508  * for the whole render result is applied (which was already
509  * happening already).
510  */
512 {
513  wmWindowManager *wm;
514  ScrArea *first_area = NULL, *matched_area = NULL;
515 
516  /* image window, compo node users */
517  for (wm = rj->main->wm.first; wm && matched_area == NULL; wm = wm->id.next) { /* only 1 wm */
518  wmWindow *win;
519  for (win = wm->windows.first; win && matched_area == NULL; win = win->next) {
520  const bScreen *screen = WM_window_get_active_screen(win);
521 
522  LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
523  if (area->spacetype == SPACE_IMAGE) {
524  SpaceImage *sima = area->spacedata.first;
525  /* area->spacedata might be empty when toggling full-screen mode. */
526  if (sima != NULL && sima->image == rj->image) {
527  if (first_area == NULL) {
528  first_area = area;
529  }
530  if (area == rj->area) {
531  matched_area = area;
532  break;
533  }
534  }
535  }
536  }
537  }
538  }
539 
540  if (matched_area == NULL) {
541  matched_area = first_area;
542  }
543 
544  if (matched_area) {
545  SpaceImage *sima = matched_area->spacedata.first;
546  RenderResult *main_rr = RE_AcquireResultRead(rj->re);
547 
548  /* TODO(sergey): is there faster way to get the layer index? */
549  if (rr->renlay) {
550  int layer = BLI_findstringindex(
551  &main_rr->layers, (char *)rr->renlay->name, offsetof(RenderLayer, name));
552  sima->iuser.layer = layer;
553  rj->last_layer = layer;
554  }
555 
556  iuser->pass = sima->iuser.pass;
557  iuser->layer = sima->iuser.layer;
558 
559  RE_ReleaseResult(rj->re);
560  }
561 }
562 
563 static void image_rect_update(void *rjv, RenderResult *rr, volatile rcti *renrect)
564 {
565  RenderJob *rj = rjv;
566  Image *ima = rj->image;
567  ImBuf *ibuf;
568  void *lock;
569  const char *viewname = RE_GetActiveRenderView(rj->re);
570 
571  /* only update if we are displaying the slot being rendered */
572  if (ima->render_slot != ima->last_render_slot) {
573  rj->image_outdated = true;
574  return;
575  }
576  if (rj->image_outdated) {
577  /* Free all render buffer caches when switching slots, with lock to ensure main
578  * thread is not drawing the buffer at the same time. */
579  rj->image_outdated = false;
580  ibuf = BKE_image_acquire_ibuf(ima, &rj->iuser, &lock);
582  BKE_image_release_ibuf(ima, ibuf, lock);
583  *(rj->do_update) = true;
584  return;
585  }
586 
587  if (rr == NULL) {
588  return;
589  }
590 
591  /* update part of render */
593  rcti tile_rect;
594  int offset_x;
595  int offset_y;
596  ibuf = BKE_image_acquire_ibuf(ima, &rj->iuser, &lock);
597  if (ibuf) {
598  if (!image_buffer_calc_tile_rect(rr, ibuf, renrect, &tile_rect, &offset_x, &offset_y)) {
599  BKE_image_release_ibuf(ima, ibuf, lock);
600  return;
601  }
602 
603  /* Don't waste time on CPU side color management if
604  * image will be displayed using GLSL.
605  *
606  * Need to update rect if Save Buffers enabled because in
607  * this case GLSL doesn't have original float buffer to
608  * operate with.
609  */
610  if (!rj->supports_glsl_draw || ibuf->channels == 1 ||
612  image_buffer_rect_update(rj, rr, ibuf, &rj->iuser, &tile_rect, offset_x, offset_y, viewname);
613  }
615  ima, ibuf, offset_x, offset_y, BLI_rcti_size_x(&tile_rect), BLI_rcti_size_y(&tile_rect));
616 
617  /* make jobs timer to send notifier */
618  *(rj->do_update) = true;
619  }
620  BKE_image_release_ibuf(ima, ibuf, lock);
621 }
622 
623 static void current_scene_update(void *rjv, Scene *scene)
624 {
625  RenderJob *rj = rjv;
626  rj->current_scene = scene;
627  rj->iuser.scene = scene;
628 }
629 
630 static void render_startjob(void *rjv, short *stop, short *do_update, float *progress)
631 {
632  RenderJob *rj = rjv;
633 
634  rj->stop = stop;
635  rj->do_update = do_update;
636  rj->progress = progress;
637 
638  RE_SetReports(rj->re, rj->reports);
639 
640  if (rj->anim) {
641  RE_RenderAnim(rj->re,
642  rj->main,
643  rj->scene,
644  rj->single_layer,
645  rj->camera_override,
646  rj->scene->r.sfra,
647  rj->scene->r.efra,
648  rj->scene->r.frame_step);
649  }
650  else {
651  RE_RenderFrame(rj->re,
652  rj->main,
653  rj->scene,
654  rj->single_layer,
655  rj->camera_override,
656  rj->scene->r.cfra,
657  rj->write_still);
658  }
659 
660  RE_SetReports(rj->re, NULL);
661 }
662 
664 {
665  wmWindowManager *wm;
666 
667  /* image window, compo node users */
668  for (wm = rj->main->wm.first; wm; wm = wm->id.next) { /* only 1 wm */
669  wmWindow *win;
670  for (win = wm->windows.first; win; win = win->next) {
671  const bScreen *screen = WM_window_get_active_screen(win);
672 
673  LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
674  if (area == rj->area) {
675  if (area->spacetype == SPACE_IMAGE) {
676  SpaceImage *sima = area->spacedata.first;
677 
678  if (RE_HasSingleLayer(rj->re)) {
679  /* For single layer renders keep the active layer
680  * visible, or show the compositing result. */
682  if (RE_HasCombinedLayer(rr)) {
683  sima->iuser.layer = 0;
684  }
685  RE_ReleaseResult(rj->re);
686  }
687  else {
688  /* For multiple layer render, set back the layer
689  * that was set at the start of rendering. */
690  sima->iuser.layer = rj->orig_layer;
691  }
692  }
693  return;
694  }
695  }
696  }
697  }
698 }
699 
700 static void render_endjob(void *rjv)
701 {
702  RenderJob *rj = rjv;
703 
704  /* this render may be used again by the sequencer without the active
705  * 'Render' where the callbacks would be re-assigned. assign dummy callbacks
706  * to avoid referencing freed renderjobs bug T24508. */
707  RE_InitRenderCB(rj->re);
708 
709  if (rj->main != G_MAIN) {
710  BKE_main_free(rj->main);
711  }
712 
713  /* else the frame will not update for the original value */
714  if (rj->anim && !(rj->scene->r.scemode & R_NO_FRAME_UPDATE)) {
715  /* possible this fails of loading new file while rendering */
716  if (G_MAIN->wm.first) {
718  }
719  }
720 
721  /* XXX above function sets all tags in nodes */
723 
724  /* potentially set by caller */
725  rj->scene->r.scemode &= ~R_NO_FRAME_UPDATE;
726 
727  if (rj->single_layer) {
728  nodeUpdateID(rj->scene->nodetree, &rj->scene->id);
730  }
731 
732  if (rj->area) {
734  }
735 
736  /* XXX render stability hack */
737  G.is_rendering = false;
739 
740  /* Partial render result will always update display buffer
741  * for first render layer only. This is nice because you'll
742  * see render progress during rendering, but it ends up in
743  * wrong display buffer shown after rendering.
744  *
745  * The code below will mark display buffer as invalid after
746  * rendering in case multiple layers were rendered, which
747  * ensures display buffer matches render layer after
748  * rendering.
749  *
750  * Perhaps proper way would be to toggle active render
751  * layer in image editor and job, so we always display
752  * layer being currently rendered. But this is not so much
753  * trivial at this moment, especially because of external
754  * engine API, so lets use simple and robust way for now
755  * - sergey -
756  */
757  if (rj->scene->view_layers.first != rj->scene->view_layers.last || rj->image_outdated) {
758  void *lock;
759  Image *ima = rj->image;
760  ImBuf *ibuf = BKE_image_acquire_ibuf(ima, &rj->iuser, &lock);
761 
762  if (ibuf) {
764  }
765 
766  BKE_image_release_ibuf(ima, ibuf, lock);
767  }
768 
769  /* Finally unlock the user interface (if it was locked). */
770  if (rj->interface_locked) {
771  /* Interface was locked, so window manager couldn't have been changed
772  * and using one from Global will unlock exactly the same manager as
773  * was locked before running the job.
774  */
775  WM_set_locked_interface(G_MAIN->wm.first, false);
777  }
778 }
779 
780 /* called by render, check job 'stop' value or the global */
781 static int render_breakjob(void *rjv)
782 {
783  RenderJob *rj = rjv;
784 
785  if (G.is_break) {
786  return 1;
787  }
788  if (rj->stop && *(rj->stop)) {
789  return 1;
790  }
791  return 0;
792 }
793 
798 static int render_break(void *UNUSED(rjv))
799 {
800  if (G.is_break) {
801  return 1;
802  }
803  return 0;
804 }
805 
806 /* runs in thread, no cursor setting here works. careful with notifiers too (malloc conflicts) */
807 /* maybe need a way to get job send notifier? */
808 static void render_drawlock(void *rjv, bool lock)
809 {
810  RenderJob *rj = rjv;
811 
812  /* If interface is locked, renderer callback shall do nothing. */
813  if (!rj->interface_locked) {
815  }
816 }
817 
818 /* catch esc */
819 static int screen_render_modal(bContext *C, wmOperator *op, const wmEvent *event)
820 {
821  Scene *scene = (Scene *)op->customdata;
822 
823  /* no running blender, remove handler and pass through */
826  }
827 
828  /* running render */
829  switch (event->type) {
830  case EVT_ESCKEY:
831  return OPERATOR_RUNNING_MODAL;
832  }
833  return OPERATOR_PASS_THROUGH;
834 }
835 
837 {
839  Scene *scene = (Scene *)op->customdata;
840 
841  /* kill on cancel, because job is using op->reports */
843 }
844 
846 {
847  if ((base->flag & BASE_VISIBLE_DEPSGRAPH) == 0) {
848  return;
849  }
850 
851  Object *object = base->object;
852 
853  if (object->id.tag & LIB_TAG_DOIT) {
854  return;
855  }
856 
857  object->id.tag &= ~LIB_TAG_DOIT;
858  if (RE_allow_render_generic_object(object)) {
860  }
861 }
862 
863 static void clean_viewport_memory(Main *bmain, Scene *scene)
864 {
865  Scene *sce_iter;
866  Base *base;
867 
868  /* Tag all the available objects. */
870 
871  /* Go over all the visible objects. */
872  for (wmWindowManager *wm = bmain->wm.first; wm; wm = wm->id.next) {
873  LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
874  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
875 
876  for (base = view_layer->object_bases.first; base; base = base->next) {
878  }
879  }
880  }
881 
882  for (SETLOOPER_SET_ONLY(scene, sce_iter, base)) {
884  }
885 }
886 
887 /* using context, starts job */
888 static int screen_render_invoke(bContext *C, wmOperator *op, const wmEvent *event)
889 {
890  /* new render clears all callbacks */
891  Main *bmain = CTX_data_main(C);
893  ViewLayer *active_layer = CTX_data_view_layer(C);
894  ViewLayer *single_layer = NULL;
896  Render *re;
897  wmJob *wm_job;
898  RenderJob *rj;
899  Image *ima;
900  const bool is_animation = RNA_boolean_get(op->ptr, "animation");
901  const bool is_write_still = RNA_boolean_get(op->ptr, "write_still");
902  const bool use_viewport = RNA_boolean_get(op->ptr, "use_viewport");
903  View3D *v3d = use_viewport ? CTX_wm_view3d(C) : NULL;
904  struct Object *camera_override = v3d ? V3D_CAMERA_LOCAL(v3d) : NULL;
905  const char *name;
906  ScrArea *area;
907 
908  /* Cannot do render if there is not this function. */
909  if (re_type->render == NULL) {
910  return OPERATOR_CANCELLED;
911  }
912 
913  /* custom scene and single layer re-render */
914  screen_render_single_layer_set(op, bmain, active_layer, &scene, &single_layer);
915 
916  /* only one render job at a time */
918  return OPERATOR_CANCELLED;
919  }
920 
921  if (!RE_is_rendering_allowed(scene, single_layer, camera_override, op->reports)) {
922  return OPERATOR_CANCELLED;
923  }
924 
925  if (!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) {
926  BKE_report(
927  op->reports, RPT_ERROR, "Cannot write a single file with an animation format selected");
928  return OPERATOR_CANCELLED;
929  }
930 
931  /* Reports are done inside check function, and it will return false if there are other strips to
932  * render. */
934  return OPERATOR_CANCELLED;
935  }
936 
937  /* stop all running jobs, except screen one. currently previews frustrate Render */
939 
940  /* cancel animation playback */
943  }
944 
945  /* handle UI stuff */
946  WM_cursor_wait(true);
947 
948  /* flush sculpt and editmode changes */
949  ED_editors_flush_edits_ex(bmain, true, false);
950 
951  /* cleanup sequencer caches before starting user triggered render.
952  * otherwise, invalidated cache entries can make their way into
953  * the output rendering. We can't put that into RE_RenderFrame,
954  * since sequence rendering can call that recursively... (peter) */
956 
957  /* store spare
958  * get view3d layer, local layer, make this nice api call to render
959  * store spare */
960 
961  /* ensure at least 1 area shows result */
962  area = render_view_open(C, event->x, event->y, op->reports);
963 
964  /* job custom data */
965  rj = MEM_callocN(sizeof(RenderJob), "render job");
966  rj->main = bmain;
967  rj->scene = scene;
968  rj->current_scene = rj->scene;
969  rj->single_layer = single_layer;
970  /* TODO(sergey): Render engine should be using own depsgraph.
971  *
972  * NOTE: Currently is only used by ED_update_for_newframe() at the end of the render, so no
973  * need to ensure evaluation here. */
975  rj->camera_override = camera_override;
976  rj->anim = is_animation;
977  rj->write_still = is_write_still && !is_animation;
978  rj->iuser.scene = scene;
979  rj->iuser.ok = 1;
980  rj->reports = op->reports;
981  rj->orig_layer = 0;
982  rj->last_layer = 0;
983  rj->area = area;
985 
988 
989  if (area) {
990  SpaceImage *sima = area->spacedata.first;
991  rj->orig_layer = sima->iuser.layer;
992  }
993 
994  if (v3d) {
995  if (camera_override && camera_override != scene->camera) {
996  rj->v3d_override = true;
997  }
998  }
999 
1000  /* Lock the user interface depending on render settings. */
1001  if (scene->r.use_lock_interface) {
1003 
1004  /* Set flag interface need to be unlocked.
1005  *
1006  * This is so because we don't have copy of render settings
1007  * accessible from render job and copy is needed in case
1008  * of non-locked rendering, so we wouldn't try to unlock
1009  * anything if option was initially unset but then was
1010  * enabled during rendering.
1011  */
1012  rj->interface_locked = true;
1013 
1014  /* Clean memory used by viewport? */
1016  }
1017 
1018  /* setup job */
1019  if (RE_seq_render_active(scene, &scene->r)) {
1020  name = "Sequence Render";
1021  }
1022  else {
1023  name = "Render";
1024  }
1025 
1026  wm_job = WM_jobs_get(CTX_wm_manager(C),
1027  CTX_wm_window(C),
1028  scene,
1029  name,
1033  WM_jobs_timer(wm_job, 0.2, NC_SCENE | ND_RENDER_RESULT, 0);
1035 
1036  if (RNA_struct_property_is_set(op->ptr, "layer")) {
1037  WM_jobs_delay_start(wm_job, 0.2);
1038  }
1039 
1040  /* get a render result image, and make sure it is empty */
1041  ima = BKE_image_ensure_viewer(bmain, IMA_TYPE_R_RESULT, "Render Result");
1043  BKE_image_backup_render(rj->scene, ima, true);
1044  rj->image = ima;
1045 
1046  /* setup new render */
1047  re = RE_NewSceneRender(scene);
1055 
1056  rj->re = re;
1057  G.is_break = false;
1058 
1059  /* store actual owner of job, so modal operator could check for it,
1060  * the reason of this is that active scene could change when rendering
1061  * several layers from compositor T31800. */
1062  op->customdata = scene;
1063 
1064  WM_jobs_start(CTX_wm_manager(C), wm_job);
1065 
1066  WM_cursor_wait(false);
1068 
1069  /* we set G.is_rendering here already instead of only in the job, this ensure
1070  * main loop or other scene updates are disabled in time, since they may
1071  * have started before the job thread */
1072  G.is_rendering = true;
1073 
1074  /* add modal handler for ESC */
1076 
1077  return OPERATOR_RUNNING_MODAL;
1078 }
1079 
1080 /* contextual render, using current scene, view3d? */
1082 {
1083  PropertyRNA *prop;
1084 
1085  /* identifiers */
1086  ot->name = "Render";
1087  ot->description = "Render active scene";
1088  ot->idname = "RENDER_OT_render";
1089 
1090  /* api callbacks */
1095 
1096  /* This isn't needed, causes failure in background mode. */
1097 #if 0
1099 #endif
1100 
1101  prop = RNA_def_boolean(ot->srna,
1102  "animation",
1103  0,
1104  "Animation",
1105  "Render files from the animation range of this scene");
1108  ot->srna,
1109  "write_still",
1110  0,
1111  "Write Image",
1112  "Save rendered the image to the output path (used only when animation is disabled)");
1113  prop = RNA_def_boolean(ot->srna,
1114  "use_viewport",
1115  0,
1116  "Use 3D Viewport",
1117  "When inside a 3D viewport, use layers and camera of the viewport");
1119  prop = RNA_def_string(ot->srna,
1120  "layer",
1121  NULL,
1122  RE_MAXNAME,
1123  "Render Layer",
1124  "Single render layer to re-render (used only when animation is disabled)");
1126  prop = RNA_def_string(ot->srna,
1127  "scene",
1128  NULL,
1129  MAX_ID_NAME - 2,
1130  "Scene",
1131  "Scene to render, current scene if not specified");
1133 }
1134 
1136 {
1139 
1140  if (rj) {
1141  return rj->scene;
1142  }
1143 
1144  return NULL;
1145 }
1146 
1148 {
1151  if (rj) {
1152  return rj->current_scene;
1153  }
1154  return NULL;
1155 }
1156 
1157 /* Motion blur curve preset */
1158 
1160 {
1162  CurveMapping *mblur_shutter_curve = &scene->r.mblur_shutter_curve;
1163  CurveMap *cm = mblur_shutter_curve->cm;
1164  int preset = RNA_enum_get(op->ptr, "shape");
1165 
1166  mblur_shutter_curve->flag &= ~CUMA_EXTEND_EXTRAPOLATE;
1167  mblur_shutter_curve->preset = preset;
1169  cm, &mblur_shutter_curve->clipr, mblur_shutter_curve->preset, CURVEMAP_SLOPE_POS_NEG);
1170  BKE_curvemapping_changed(mblur_shutter_curve, false);
1171 
1172  return OPERATOR_FINISHED;
1173 }
1174 
1176 {
1177  PropertyRNA *prop;
1178  static const EnumPropertyItem prop_shape_items[] = {
1179  {CURVE_PRESET_SHARP, "SHARP", 0, "Sharp", ""},
1180  {CURVE_PRESET_SMOOTH, "SMOOTH", 0, "Smooth", ""},
1181  {CURVE_PRESET_MAX, "MAX", 0, "Max", ""},
1182  {CURVE_PRESET_LINE, "LINE", 0, "Line", ""},
1183  {CURVE_PRESET_ROUND, "ROUND", 0, "Round", ""},
1184  {CURVE_PRESET_ROOT, "ROOT", 0, "Root", ""},
1185  {0, NULL, 0, NULL, NULL},
1186  };
1187 
1188  ot->name = "Shutter Curve Preset";
1189  ot->description = "Set shutter curve";
1190  ot->idname = "RENDER_OT_shutter_curve_preset";
1191 
1193 
1194  prop = RNA_def_enum(ot->srna, "shape", prop_shape_items, CURVE_PRESET_SMOOTH, "Mode", "");
1195  RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
1196 }
int ED_draw_imbuf_method(struct ImBuf *ibuf)
Definition: glutil.c:566
void BKE_color_managed_display_settings_copy(struct ColorManagedDisplaySettings *new_settings, const struct ColorManagedDisplaySettings *settings)
void BKE_color_managed_view_settings_free(struct ColorManagedViewSettings *settings)
Definition: colortools.c:1820
void BKE_curvemap_reset(struct CurveMap *cuma, const struct rctf *clipr, int preset, int slope)
void BKE_curvemapping_changed(struct CurveMapping *cumap, const bool rem_doubles)
Definition: colortools.c:877
void BKE_color_managed_view_settings_copy(struct ColorManagedViewSettings *new_settings, const struct ColorManagedViewSettings *settings)
@ CURVEMAP_SLOPE_POS_NEG
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1034
struct wmWindowManager * CTX_wm_manager(const bContext *C)
Definition: context.c:689
struct ViewLayer * CTX_data_view_layer(const bContext *C)
Definition: context.c:1044
struct View3D * CTX_wm_view3d(const bContext *C)
Definition: context.c:760
struct bScreen * CTX_wm_screen(const bContext *C)
Definition: context.c:709
struct Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
Definition: context.c:1401
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1018
struct wmWindow * CTX_wm_window(const bContext *C)
Definition: context.c:699
#define G_MAIN
Definition: BKE_global.h:232
@ G_DEBUG
Definition: BKE_global.h:133
void BKE_image_release_ibuf(struct Image *ima, struct ImBuf *ibuf, void *lock)
Definition: image.c:5113
struct ImBuf * BKE_image_acquire_ibuf(struct Image *ima, struct ImageUser *iuser, void **r_lock)
Definition: image.c:5100
void BKE_image_update_gputexture_delayed(struct Image *ima, struct ImBuf *ibuf, int x, int y, int w, int h)
Definition: image_gpu.c:838
void BKE_image_backup_render(struct Scene *scene, struct Image *ima, bool free_current_slot)
Definition: image.c:3971
struct Image * BKE_image_ensure_viewer(struct Main *bmain, int type, const char *name)
Definition: image.c:3162
#define IMA_SIGNAL_FREE
Definition: BKE_image.h:163
bool BKE_imtype_is_movie(const char imtype)
Definition: image.c:1443
void BKE_image_signal(struct Main *bmain, struct Image *ima, struct ImageUser *iuser, int signal)
Definition: image.c:3499
void BKE_main_id_tag_listbase(struct ListBase *lb, const int tag, const bool value)
Definition: lib_id.c:891
void BKE_main_free(struct Main *mainvar)
Definition: main.c:53
bool nodeUpdateID(struct bNodeTree *ntree, struct ID *id)
Definition: node.cc:4346
void ntreeCompositClearTags(struct bNodeTree *ntree)
General operations, lookup, etc. for blender objects.
void BKE_object_free_derived_caches(struct Object *ob)
Definition: object.c:1719
void BKE_report(ReportList *reports, ReportType type, const char *message)
Definition: report.c:104
#define SETLOOPER_SET_ONLY(_sce_basis, _sce_iter, _base)
Definition: BKE_scene.h:62
bool BKE_scene_camera_switch_update(struct Scene *scene)
Definition: scene.c:2349
int BKE_scene_multiview_view_id_get(const struct RenderData *rd, const char *viewname)
void BKE_spacedata_draw_locks(bool set)
Definition: screen.c:547
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:172
void * BLI_findstring(const struct ListBase *listbase, const char *id, const int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_findstringindex(const struct ListBase *listbase, const char *id, const int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
Definition: BLI_rect.h:157
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Definition: BLI_rect.h:153
size_t BLI_timecode_string_from_time_simple(char *str, const size_t maxncpy, const double time_seconds) ATTR_NONNULL()
Definition: timecode.c:206
#define UNUSED(x)
#define BLT_I18NCONTEXT_ID_CURVE
#define TIP_(msgid)
void DEG_on_visible_update(struct Main *bmain, const bool do_time)
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:51
@ LIB_TAG_DOIT
Definition: DNA_ID.h:554
#define MAX_ID_NAME
Definition: DNA_ID.h:269
@ CUMA_EXTEND_EXTRAPOLATE
@ CURVE_PRESET_ROOT
@ CURVE_PRESET_SMOOTH
@ CURVE_PRESET_ROUND
@ CURVE_PRESET_LINE
@ CURVE_PRESET_SHARP
@ CURVE_PRESET_MAX
@ IMA_TYPE_R_RESULT
#define IMA_MAX_RENDER_TEXT
@ BASE_VISIBLE_DEPSGRAPH
Object is a sort of wrapper for general info.
#define RE_PASSNAME_COMBINED
#define R_SINGLE_LAYER
#define R_DOSEQ
#define V3D_CAMERA_LOCAL(v3d)
#define R_NO_FRAME_UPDATE
@ SPACE_IMAGE
@ IMAGE_DRAW_METHOD_GLSL
@ OPERATOR_CANCELLED
@ OPERATOR_FINISHED
@ OPERATOR_RUNNING_MODAL
@ OPERATOR_PASS_THROUGH
bool ED_operator_screenactive(struct bContext *C)
Definition: screen_ops.c:133
int ED_screen_animation_play(struct bContext *C, int sync, int mode)
Definition: screen_ops.c:4641
void ED_update_for_newframe(struct Main *bmain, struct Depsgraph *depsgraph)
Definition: screen_edit.c:1617
bScreen * ED_screen_animation_playing(const struct wmWindowManager *wm)
bool ED_editors_flush_edits_ex(struct Main *bmain, bool for_render, bool check_needs_flush)
Definition: ed_util.c:278
bool IMB_colormanagement_support_glsl_draw(const struct ColorManagedViewSettings *view_settings)
void IMB_partial_display_buffer_update(struct ImBuf *ibuf, const float *linear_buffer, const unsigned char *byte_buffer, int stride, int offset_x, int offset_y, const struct ColorManagedViewSettings *view_settings, const struct ColorManagedDisplaySettings *display_settings, int xmin, int ymin, int xmax, int ymax)
Contains defines and structs used throughout the imbuf module.
@ IB_DISPLAY_BUFFER_INVALID
Read Guarded memory(de)allocation.
Platform independent time functions.
#define RE_MAXNAME
Definition: RE_pipeline.h:51
@ PROP_SKIP_SAVE
Definition: RNA_types.h:204
#define C
Definition: RandGen.cpp:39
@ WM_JOB_TYPE_RENDER
Definition: WM_api.h:736
@ WM_JOB_EXCL_RENDER
Definition: WM_api.h:725
@ WM_JOB_PROGRESS
Definition: WM_api.h:726
@ WM_JOB_PRIORITY
Definition: WM_api.h:724
#define NC_NODE
Definition: WM_types.h:295
#define ND_RENDER_RESULT
Definition: WM_types.h:346
#define NC_SCENE
Definition: WM_types.h:279
#define NA_EDITED
Definition: WM_types.h:462
short last_render_slot
short render_slot
Scene scene
RenderEngineType * RE_engines_find(const char *idname)
Definition: engine.c:108
#define str(s)
void SEQ_cache_cleanup(Scene *scene)
Definition: image_cache.c:1251
void * BKE_image_free_buffers
size_t(* MEM_get_peak_memory)(void)
Definition: mallocn.c:62
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
size_t(* MEM_get_memory_in_use)(void)
Definition: mallocn.c:59
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:45
static size_t mem_in_use
static void error(const char *str)
Definition: meshlaplacian.c:65
static void area(int d1, int d2, int e1, int e2, float weights[2])
bool RE_HasSingleLayer(Render *re)
Definition: pipeline.c:285
void RE_stats_draw_cb(Render *re, void *handle, void(*f)(void *handle, RenderStats *rs))
Definition: pipeline.c:942
RenderResult * RE_AcquireResultRead(Render *re)
Definition: pipeline.c:343
void RE_progress_cb(Render *re, void *handle, void(*f)(void *handle, float))
Definition: pipeline.c:947
int RE_seq_render_active(Scene *scene, RenderData *rd)
Definition: pipeline.c:1313
float * RE_RenderLayerGetPass(volatile RenderLayer *rl, const char *name, const char *viewname)
Definition: pipeline.c:270
void RE_current_scene_update_cb(Render *re, void *handle, void(*f)(void *handle, Scene *scene))
Definition: pipeline.c:937
void RE_RenderFrame(Render *re, Main *bmain, Scene *scene, ViewLayer *single_layer, Object *camera_override, int frame, const bool write_still)
Definition: pipeline.c:1877
void RE_InitRenderCB(Render *re)
Definition: pipeline.c:607
Render * RE_NewSceneRender(const Scene *scene)
Definition: pipeline.c:598
void RE_ReleaseResult(Render *re)
Definition: pipeline.c:379
void RE_RenderAnim(Render *re, Main *bmain, Scene *scene, ViewLayer *single_layer, Object *camera_override, int sfra, int efra, int tfra)
Definition: pipeline.c:2314
const char * RE_GetActiveRenderView(Render *re)
Definition: pipeline.c:1746
bool RE_allow_render_generic_object(Object *ob)
Definition: pipeline.c:2848
void RE_gl_context_create(Render *re)
Definition: pipeline.c:967
void RE_test_break_cb(Render *re, void *handle, int(*f)(void *handle))
Definition: pipeline.c:959
void RE_display_update_cb(Render *re, void *handle, void(*f)(void *handle, RenderResult *rr, volatile rcti *rect))
Definition: pipeline.c:930
bool RE_is_rendering_allowed(Scene *scene, ViewLayer *single_layer, Object *camera_override, ReportList *reports)
Definition: pipeline.c:1645
void RE_draw_lock_cb(Render *re, void *handle, void(*f)(void *handle, bool lock))
Definition: pipeline.c:953
void RE_SetReports(Render *re, ReportList *reports)
Definition: pipeline.c:1831
struct ScrArea * render_view_open(struct bContext *C, int mx, int my, struct ReportList *reports)
Definition: render_view.c:134
static void render_endjob(void *rjv)
static void render_image_restore_layer(RenderJob *rj)
static void current_scene_update(void *rjv, Scene *scene)
static int render_shutter_curve_preset_exec(bContext *C, wmOperator *op)
Scene * ED_render_job_get_scene(const bContext *C)
static int render_break(void *rjv)
static int screen_render_modal(bContext *C, wmOperator *op, const wmEvent *event)
static void image_renderinfo_cb(void *rjv, RenderStats *rs)
void RENDER_OT_render(wmOperatorType *ot)
static void image_buffer_rect_update(RenderJob *rj, RenderResult *rr, ImBuf *ibuf, ImageUser *iuser, const rcti *tile_rect, int offset_x, int offset_y, const char *viewname)
static int screen_render_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static int render_breakjob(void *rjv)
static void screen_render_single_layer_set(wmOperator *op, Main *mainp, ViewLayer *active_layer, Scene **scene, ViewLayer **single_layer)
static void render_drawlock(void *rjv, bool lock)
static void make_renderinfo_string(const RenderStats *rs, const Scene *scene, const bool v3d_override, const char *error, char *str)
void RENDER_OT_shutter_curve_preset(wmOperatorType *ot)
static void image_rect_update(void *rjv, RenderResult *rr, volatile rcti *renrect)
static int screen_render_exec(bContext *C, wmOperator *op)
static void clean_viewport_memory(Main *bmain, Scene *scene)
static bool image_buffer_calc_tile_rect(const RenderResult *rr, const ImBuf *ibuf, volatile rcti *renrect, rcti *r_ibuf_rect, int *r_offset_x, int *r_offset_y)
static void render_image_update_pass_and_layer(RenderJob *rj, RenderResult *rr, ImageUser *iuser)
static void render_progress_update(void *rjv, float progress)
static void clean_viewport_memory_base(Base *base)
static void screen_render_cancel(bContext *C, wmOperator *op)
static void render_startjob(void *rjv, short *stop, short *do_update, float *progress)
static void render_freejob(void *rjv)
struct RenderJob RenderJob
Scene * ED_render_job_get_current_scene(const bContext *C)
bool RE_HasCombinedLayer(RenderResult *rr)
RenderView * RE_RenderViewGetById(RenderResult *rr, const int view_id)
void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
Definition: rna_access.c:6514
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:6685
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:6261
int RNA_enum_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:6402
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3481
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3675
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
Definition: rna_define.c:2870
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1512
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3771
_W64 unsigned int uintptr_t
Definition: stdint.h:122
bool SEQ_relations_check_scene_recursion(Scene *scene, ReportList *reports)
struct Base * next
short flag
struct Object * object
CurveMap cm[4]
Definition: DNA_ID.h:273
int tag
Definition: DNA_ID.h:292
void * next
Definition: DNA_ID.h:274
int channels
int userflags
float * rect_float
struct Scene * scene
void * last
Definition: DNA_listBase.h:47
void * first
Definition: DNA_listBase.h:47
Definition: BKE_main.h:116
ListBase scenes
Definition: BKE_main.h:146
ListBase wm
Definition: BKE_main.h:175
ListBase objects
Definition: BKE_main.h:148
ustring name
Definition: node.h:174
ImageUser * iuser
struct CurveMapping mblur_shutter_curve
char engine[32]
struct ImageFormatData im_format
char use_lock_interface
void(* render)(struct RenderEngine *engine, struct Depsgraph *depsgraph)
Definition: RE_engine.h:88
ImageUser iuser
short * do_update
bool image_outdated
ViewLayer * single_layer
Depsgraph * depsgraph
Scene * scene
ColorManagedViewSettings view_settings
ReportList * reports
struct Object * camera_override
Scene * current_scene
short * stop
ScrArea * area
bool supports_glsl_draw
bool interface_locked
bool v3d_override
Render * re
ColorManagedDisplaySettings display_settings
bool write_still
Image * image
float * progress
char name[RE_MAXNAME]
Definition: RE_pipeline.h:100
ListBase layers
Definition: RE_pipeline.h:135
volatile RenderLayer * renlay
Definition: RE_pipeline.h:142
char * error
Definition: RE_pipeline.h:155
const char * statstr
Definition: RE_pipeline.h:164
float mem_peak
Definition: RE_pipeline.h:166
double starttime
Definition: RE_pipeline.h:163
float mem_used
Definition: RE_pipeline.h:166
double lastframetime
Definition: RE_pipeline.h:163
const char * infostr
Definition: RE_pipeline.h:164
bool localview
Definition: RE_pipeline.h:162
float * rectf
Definition: RE_pipeline.h:69
int * rect32
Definition: RE_pipeline.h:73
struct bNodeTree * nodetree
ColorManagedViewSettings view_settings
struct RenderData r
ListBase view_layers
struct Object * camera
ColorManagedDisplaySettings display_settings
struct ImageUser iuser
struct Image * image
ListBase object_bases
ListBase areabase
int ymin
Definition: DNA_vec_types.h:80
int ymax
Definition: DNA_vec_types.h:80
int xmin
Definition: DNA_vec_types.h:79
int xmax
Definition: DNA_vec_types.h:79
int y
Definition: WM_types.h:581
int x
Definition: WM_types.h:581
short type
Definition: WM_types.h:577
Definition: wm_jobs.c:73
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:752
const char * name
Definition: WM_types.h:721
int(* modal)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:768
const char * idname
Definition: WM_types.h:723
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:776
void(* cancel)(struct bContext *, struct wmOperator *)
Definition: WM_types.h:760
struct StructRNA * srna
Definition: WM_types.h:802
const char * description
Definition: WM_types.h:726
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:736
struct ReportList * reports
struct PointerRNA * ptr
struct wmWindow * next
double PIL_check_seconds_timer(void)
Definition: time.c:80
#define G(x, y, z)
void WM_cursor_wait(bool val)
Definition: wm_cursors.c:226
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void WM_main_add_notifier(unsigned int type, void *reference)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void WM_set_locked_interface(wmWindowManager *wm, bool lock)
@ EVT_ESCKEY
wmOperatorType * ot
Definition: wm_files.c:3156
void WM_jobs_kill_all_except(wmWindowManager *wm, void *owner)
Definition: wm_jobs.c:563
void WM_jobs_start(wmWindowManager *wm, wmJob *wm_job)
Definition: wm_jobs.c:450
wmJob * WM_jobs_get(wmWindowManager *wm, wmWindow *win, void *owner, const char *name, int flag, int job_type)
Definition: wm_jobs.c:196
void * WM_jobs_customdata_from_type(wmWindowManager *wm, int job_type)
Definition: wm_jobs.c:314
bool WM_jobs_test(wmWindowManager *wm, void *owner, int job_type)
Definition: wm_jobs.c:223
void WM_jobs_delay_start(wmJob *wm_job, double delay_time)
Definition: wm_jobs.c:367
void WM_jobs_callbacks(wmJob *wm_job, wm_jobs_start_callback startjob, void(*initjob)(void *), void(*update)(void *), void(*endjob)(void *))
Definition: wm_jobs.c:372
void WM_jobs_kill_type(struct wmWindowManager *wm, void *owner, int job_type)
Definition: wm_jobs.c:572
void WM_jobs_customdata_set(wmJob *wm_job, void *customdata, void(*free)(void *))
Definition: wm_jobs.c:344
void WM_jobs_timer(wmJob *wm_job, double timestep, unsigned int note, unsigned int endnote)
Definition: wm_jobs.c:360
bScreen * WM_window_get_active_screen(const wmWindow *win)
Definition: wm_window.c:2372
ViewLayer * WM_window_get_active_view_layer(const wmWindow *win)
Definition: wm_window.c:2286