Blender  V2.93
scene.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) 2001-2002 by NaN Holding BV.
17  * All rights reserved.
18  */
19 
24 /* Allow using deprecated functionality for .blend file I/O. */
25 #define DNA_DEPRECATED_ALLOW
26 
27 #include <stddef.h>
28 #include <stdio.h>
29 #include <string.h>
30 
31 #include "MEM_guardedalloc.h"
32 
33 #include "DNA_anim_types.h"
34 #include "DNA_collection_types.h"
35 #include "DNA_curveprofile_types.h"
36 #include "DNA_defaults.h"
37 #include "DNA_gpencil_types.h"
38 #include "DNA_linestyle_types.h"
39 #include "DNA_mask_types.h"
40 #include "DNA_material_types.h"
41 #include "DNA_mesh_types.h"
42 #include "DNA_node_types.h"
43 #include "DNA_object_types.h"
44 #include "DNA_rigidbody_types.h"
45 #include "DNA_scene_types.h"
46 #include "DNA_screen_types.h"
47 #include "DNA_sequence_types.h"
48 #include "DNA_sound_types.h"
49 #include "DNA_space_types.h"
50 #include "DNA_text_types.h"
51 #include "DNA_vfont_types.h"
52 #include "DNA_view3d_types.h"
54 #include "DNA_workspace_types.h"
55 #include "DNA_world_types.h"
56 
57 #include "BKE_callbacks.h"
58 #include "BLI_blenlib.h"
59 #include "BLI_math.h"
60 #include "BLI_string.h"
61 #include "BLI_string_utils.h"
62 #include "BLI_task.h"
63 #include "BLI_threads.h"
64 #include "BLI_utildefines.h"
65 
66 #include "BLT_translation.h"
67 
68 #include "BKE_action.h"
69 #include "BKE_anim_data.h"
70 #include "BKE_animsys.h"
71 #include "BKE_armature.h"
72 #include "BKE_cachefile.h"
73 #include "BKE_collection.h"
74 #include "BKE_colortools.h"
75 #include "BKE_curveprofile.h"
76 #include "BKE_duplilist.h"
77 #include "BKE_editmesh.h"
78 #include "BKE_effect.h"
79 #include "BKE_fcurve.h"
80 #include "BKE_freestyle.h"
81 #include "BKE_gpencil.h"
82 #include "BKE_icons.h"
83 #include "BKE_idprop.h"
84 #include "BKE_idtype.h"
85 #include "BKE_image.h"
86 #include "BKE_layer.h"
87 #include "BKE_lib_id.h"
88 #include "BKE_lib_query.h"
89 #include "BKE_lib_remap.h"
90 #include "BKE_linestyle.h"
91 #include "BKE_main.h"
92 #include "BKE_mask.h"
93 #include "BKE_node.h"
94 #include "BKE_object.h"
95 #include "BKE_paint.h"
96 #include "BKE_pointcache.h"
97 #include "BKE_rigidbody.h"
98 #include "BKE_scene.h"
99 #include "BKE_screen.h"
100 #include "BKE_sound.h"
101 #include "BKE_unit.h"
102 #include "BKE_workspace.h"
103 #include "BKE_world.h"
104 
105 #include "DEG_depsgraph.h"
106 #include "DEG_depsgraph_build.h"
107 #include "DEG_depsgraph_debug.h"
108 #include "DEG_depsgraph_query.h"
109 
110 #include "RE_engine.h"
111 
112 #include "SEQ_edit.h"
113 #include "SEQ_iterator.h"
114 #include "SEQ_modifier.h"
115 #include "SEQ_proxy.h"
116 #include "SEQ_relations.h"
117 #include "SEQ_sequencer.h"
118 #include "SEQ_sound.h"
119 
120 #include "BLO_read_write.h"
121 
123 
124 #include "PIL_time.h"
125 
126 #include "IMB_colormanagement.h"
127 #include "IMB_imbuf.h"
128 
129 #include "bmesh.h"
130 
131 static void scene_init_data(ID *id)
132 {
133  Scene *scene = (Scene *)id;
134  const char *colorspace_name;
135  SceneRenderView *srv;
136  CurveMapping *mblur_shutter_curve;
137 
139 
141 
142  BLI_strncpy(scene->r.bake.filepath, U.renderdir, sizeof(scene->r.bake.filepath));
143 
144  mblur_shutter_curve = &scene->r.mblur_shutter_curve;
145  BKE_curvemapping_set_defaults(mblur_shutter_curve, 1, 0.0f, 0.0f, 1.0f, 1.0f);
146  BKE_curvemapping_init(mblur_shutter_curve);
147  BKE_curvemap_reset(mblur_shutter_curve->cm,
148  &mblur_shutter_curve->clipr,
151 
153 
154  scene->toolsettings->autokey_mode = (uchar)U.autokey_mode;
155 
156  /* grease pencil multiframe falloff curve */
157  scene->toolsettings->gp_sculpt.cur_falloff = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
158  CurveMapping *gp_falloff_curve = scene->toolsettings->gp_sculpt.cur_falloff;
159  BKE_curvemapping_init(gp_falloff_curve);
161  gp_falloff_curve->cm, &gp_falloff_curve->clipr, CURVE_PRESET_GAUSS, CURVEMAP_SLOPE_POSITIVE);
162 
163  scene->toolsettings->gp_sculpt.cur_primitive = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
164  CurveMapping *gp_primitive_curve = scene->toolsettings->gp_sculpt.cur_primitive;
165  BKE_curvemapping_init(gp_primitive_curve);
166  BKE_curvemap_reset(gp_primitive_curve->cm,
167  &gp_primitive_curve->clipr,
170 
172  scene->unit.scale_length = 1.0f;
178 
179  /* Anti-Aliasing threshold. */
181 
182  {
183  ParticleEditSettings *pset;
184  pset = &scene->toolsettings->particle;
185  for (size_t i = 1; i < ARRAY_SIZE(pset->brush); i++) {
186  pset->brush[i] = pset->brush[0];
187  }
188  pset->brush[PE_BRUSH_CUT].strength = 1.0f;
189  }
190 
192 
193  BLI_strncpy(scene->r.pic, U.renderdir, sizeof(scene->r.pic));
194 
195  /* Note; in header_info.c the scene copy happens...,
196  * if you add more to renderdata it has to be checked there. */
197 
198  /* multiview - stereo */
200  srv = scene->r.views.first;
201  BLI_strncpy(srv->suffix, STEREO_LEFT_SUFFIX, sizeof(srv->suffix));
202 
204  srv = scene->r.views.last;
205  BLI_strncpy(srv->suffix, STEREO_RIGHT_SUFFIX, sizeof(srv->suffix));
206 
208 
209  /* color management */
211 
214  &scene->view_settings, &scene->display_settings, "Filmic");
216  colorspace_name,
218 
219  /* Those next two sets (render and baking settings) are not currently in use,
220  * but are exposed to RNA API and hence must have valid data. */
224 
228 
229  /* Curve Profile */
232 
233  for (size_t i = 0; i < ARRAY_SIZE(scene->orientation_slots); i++) {
235  }
236 
237  /* Master Collection */
239 
241 }
242 
243 static void scene_copy_markers(Scene *scene_dst, const Scene *scene_src, const int flag)
244 {
245  BLI_duplicatelist(&scene_dst->markers, &scene_src->markers);
246  LISTBASE_FOREACH (TimeMarker *, marker, &scene_dst->markers) {
247  if (marker->prop != NULL) {
248  marker->prop = IDP_CopyProperty_ex(marker->prop, flag);
249  }
250  }
251 }
252 
253 static void scene_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int flag)
254 {
255  Scene *scene_dst = (Scene *)id_dst;
256  const Scene *scene_src = (const Scene *)id_src;
257  /* We never handle usercount here for own data. */
258  const int flag_subdata = flag | LIB_ID_CREATE_NO_USER_REFCOUNT;
259  /* We always need allocation of our private ID data. */
260  const int flag_private_id_data = flag & ~LIB_ID_CREATE_NO_ALLOCATE;
261 
262  scene_dst->ed = NULL;
263  scene_dst->depsgraph_hash = NULL;
264  scene_dst->fps_info = NULL;
265 
266  /* Master Collection */
267  if (scene_src->master_collection) {
268  BKE_id_copy_ex(bmain,
269  (ID *)scene_src->master_collection,
270  (ID **)&scene_dst->master_collection,
271  flag_private_id_data);
272  }
273 
274  /* View Layers */
275  BLI_duplicatelist(&scene_dst->view_layers, &scene_src->view_layers);
276  for (ViewLayer *view_layer_src = scene_src->view_layers.first,
277  *view_layer_dst = scene_dst->view_layers.first;
278  view_layer_src;
279  view_layer_src = view_layer_src->next, view_layer_dst = view_layer_dst->next) {
280  BKE_view_layer_copy_data(scene_dst, scene_src, view_layer_dst, view_layer_src, flag_subdata);
281  }
282 
283  scene_copy_markers(scene_dst, scene_src, flag);
284 
285  BLI_duplicatelist(&(scene_dst->transform_spaces), &(scene_src->transform_spaces));
286  BLI_duplicatelist(&(scene_dst->r.views), &(scene_src->r.views));
287  BKE_keyingsets_copy(&(scene_dst->keyingsets), &(scene_src->keyingsets));
288 
289  if (scene_src->nodetree) {
291  bmain, (ID *)scene_src->nodetree, (ID **)&scene_dst->nodetree, flag_private_id_data);
293  scene_dst->nodetree,
294  (void *)(&scene_src->id),
295  &scene_dst->id,
297  }
298 
299  if (scene_src->rigidbody_world) {
301  flag_subdata);
302  }
303 
304  /* copy color management settings */
306  &scene_src->display_settings);
309  &scene_src->sequencer_colorspace_settings);
310 
312  &scene_src->r.im_format.display_settings);
314  &scene_src->r.im_format.view_settings);
315 
317  &scene_src->r.bake.im_format.display_settings);
319  &scene_src->r.bake.im_format.view_settings);
320 
322 
323  /* tool settings */
324  scene_dst->toolsettings = BKE_toolsettings_copy(scene_dst->toolsettings, flag_subdata);
325 
326  /* make a private copy of the avicodecdata */
327  if (scene_src->r.avicodecdata) {
328  scene_dst->r.avicodecdata = MEM_dupallocN(scene_src->r.avicodecdata);
329  scene_dst->r.avicodecdata->lpFormat = MEM_dupallocN(scene_dst->r.avicodecdata->lpFormat);
330  scene_dst->r.avicodecdata->lpParms = MEM_dupallocN(scene_dst->r.avicodecdata->lpParms);
331  }
332 
333  if (scene_src->r.ffcodecdata.properties) {
334  /* intentionally check sce_dst not sce_src. */ /* XXX ??? comment outdated... */
336  flag_subdata);
337  }
338 
339  if (scene_src->display.shading.prop) {
340  scene_dst->display.shading.prop = IDP_CopyProperty(scene_src->display.shading.prop);
341  }
342 
344 
345  /* Copy sequencer, this is local data! */
346  if (scene_src->ed) {
347  scene_dst->ed = MEM_callocN(sizeof(*scene_dst->ed), __func__);
348  scene_dst->ed->seqbasep = &scene_dst->ed->seqbase;
350  scene_dst,
351  &scene_dst->ed->seqbase,
352  &scene_src->ed->seqbase,
353  SEQ_DUPE_ALL,
354  flag_subdata);
355  }
356 
357  if ((flag & LIB_ID_COPY_NO_PREVIEW) == 0) {
358  BKE_previewimg_id_copy(&scene_dst->id, &scene_src->id);
359  }
360  else {
361  scene_dst->preview = NULL;
362  }
363 
364  BKE_scene_copy_data_eevee(scene_dst, scene_src);
365 }
366 
367 static void scene_free_markers(Scene *scene, bool do_id_user)
368 {
370  if (marker->prop != NULL) {
371  IDP_FreePropertyContent_ex(marker->prop, do_id_user);
372  MEM_freeN(marker->prop);
373  }
374  MEM_freeN(marker);
375  }
376 }
377 
378 static void scene_free_data(ID *id)
379 {
380 
381  Scene *scene = (Scene *)id;
382  const bool do_id_user = false;
383 
384  SEQ_editing_free(scene, do_id_user);
385 
387 
388  /* is no lib link block, but scene extension */
389  if (scene->nodetree) {
392  scene->nodetree = NULL;
393  }
394 
395  if (scene->rigidbody_world) {
396  /* Prevent rigidbody freeing code to follow other IDs pointers, this should never be allowed
397  * nor necessary from here, and with new undo code, those pointers may be fully invalid or
398  * worse, pointing to data actually belonging to new BMain! */
402  }
403 
404  if (scene->r.avicodecdata) {
408  }
409  if (scene->r.ffcodecdata.properties) {
412  }
413 
414  scene_free_markers(scene, do_id_user);
417 
420 
422 
424 
426 
428 
431 
432  for (ViewLayer *view_layer = scene->view_layers.first, *view_layer_next; view_layer;
433  view_layer = view_layer_next) {
434  view_layer_next = view_layer->next;
435 
436  BLI_remlink(&scene->view_layers, view_layer);
437  BKE_view_layer_free_ex(view_layer, do_id_user);
438  }
439 
440  /* Master Collection */
441  /* TODO: what to do with do_id_user? it's also true when just
442  * closing the file which seems wrong? should decrement users
443  * for objects directly in the master collection? then other
444  * collections in the scene need to do it too? */
445  if (scene->master_collection) {
450  }
451 
455  }
456 
457  if (scene->display.shading.prop) {
460  }
461 
462  /* These are freed on doversion. */
464 }
465 
467  ID **id_pointer,
468  void *user_data,
469  int cb_flag)
470 {
472  BKE_lib_query_foreachid_process(data, id_pointer, cb_flag);
473 }
474 
480  /* Undo when preserving tool-settings from old scene, we also want to try to preserve that ID
481  * pointer from its old scene's value. */
483  /* Undo when preserving tool-settings from old scene, we want to keep the new value of that ID
484  * pointer. */
487 
489  ID **id_p,
491  BlendLibReader *reader,
492  ID **id_old_p,
493  const uint cb_flag)
494 {
495  switch (action) {
497  ID *id_old = *id_old_p;
498  /* Old data has not been remapped to new values of the pointers, if we want to keep the old
499  * pointer here we need its new address. */
500  ID *id_old_new = id_old != NULL ? BLO_read_get_new_id_address(reader, id_old->lib, id_old) :
501  NULL;
502  if (id_old_new != NULL) {
503  BLI_assert(ELEM(id_old, id_old_new, id_old_new->orig_id));
504  *id_old_p = id_old_new;
505  if (cb_flag & IDWALK_CB_USER) {
506  id_us_plus_no_lib(id_old_new);
507  id_us_min(id_old);
508  }
509  break;
510  }
511  /* We failed to find a new valid pointer for the previous ID, just keep the current one as
512  * if we had been under SCENE_FOREACH_UNDO_NO_RESTORE case. */
513  SWAP(ID *, *id_p, *id_old_p);
514  break;
515  }
517  /* Counteract the swap of the whole ToolSettings container struct. */
518  SWAP(ID *, *id_p, *id_old_p);
519  break;
520  }
521 }
522 
523 #define BKE_LIB_FOREACHID_UNDO_PRESERVE_PROCESS( \
524  __data, __id, __do_undo_restore, __action, __reader, __id_old, __cb_flag) \
525  { \
526  if (__do_undo_restore) { \
527  scene_foreach_toolsettings_id_pointer_process( \
528  (ID **)&(__id), __action, __reader, (ID **)&(__id_old), __cb_flag); \
529  } \
530  else { \
531  BKE_LIB_FOREACHID_PROCESS(__data, __id, __cb_flag); \
532  } \
533  } \
534  (void)0
535 
537  Paint *paint,
538  const bool do_undo_restore,
539  BlendLibReader *reader,
540  Paint *paint_old)
541 {
543  paint->brush,
544  do_undo_restore,
546  reader,
547  paint_old->brush,
549  for (int i = 0; i < paint_old->tool_slots_len; i++) {
550  /* This is a bit tricky.
551  * - In case we do not do `undo_restore`, `paint` and `paint_old` pointers are the same, so
552  * this is equivalent to simply looping over slots from `paint`.
553  * - In case we do `undo_restore`, we only want to consider the slots from the old one, since
554  * those are the one we keep in the end.
555  * + In case the new data has less valid slots, we feed in a dummy NULL pointer.
556  * + In case the new data has more valid slots, the extra ones are ignored.
557  */
558  Brush *brush_tmp = NULL;
559  Brush **brush_p = i < paint->tool_slots_len ? &paint->tool_slots[i].brush : &brush_tmp;
561  *brush_p,
562  do_undo_restore,
564  reader,
565  paint_old->brush,
567  }
569  paint->palette,
570  do_undo_restore,
572  reader,
573  paint_old->palette,
575 }
576 
578  ToolSettings *toolsett,
579  const bool do_undo_restore,
580  BlendLibReader *reader,
581  ToolSettings *toolsett_old)
582 {
584  toolsett->particle.scene,
585  do_undo_restore,
587  reader,
588  toolsett_old->particle.scene,
589  IDWALK_CB_NOP);
591  toolsett->particle.object,
592  do_undo_restore,
594  reader,
595  toolsett_old->particle.object,
596  IDWALK_CB_NOP);
598  toolsett->particle.shape_object,
599  do_undo_restore,
601  reader,
602  toolsett_old->particle.shape_object,
603  IDWALK_CB_NOP);
604 
606  data, &toolsett->imapaint.paint, do_undo_restore, reader, &toolsett_old->imapaint.paint);
608  toolsett->imapaint.stencil,
609  do_undo_restore,
611  reader,
612  toolsett_old->imapaint.stencil,
615  toolsett->imapaint.clone,
616  do_undo_restore,
618  reader,
619  toolsett_old->imapaint.clone,
622  toolsett->imapaint.canvas,
623  do_undo_restore,
625  reader,
626  toolsett_old->imapaint.canvas,
628 
629  if (toolsett->vpaint) {
631  data, &toolsett->vpaint->paint, do_undo_restore, reader, &toolsett_old->vpaint->paint);
632  }
633  if (toolsett->wpaint) {
635  data, &toolsett->wpaint->paint, do_undo_restore, reader, &toolsett_old->wpaint->paint);
636  }
637  if (toolsett->sculpt) {
639  data, &toolsett->sculpt->paint, do_undo_restore, reader, &toolsett_old->sculpt->paint);
641  toolsett->sculpt->gravity_object,
642  do_undo_restore,
644  reader,
645  toolsett_old->sculpt->gravity_object,
646  IDWALK_CB_NOP);
647  }
648  if (toolsett->uvsculpt) {
650  data, &toolsett->uvsculpt->paint, do_undo_restore, reader, &toolsett_old->uvsculpt->paint);
651  }
652  if (toolsett->gp_paint) {
654  data, &toolsett->gp_paint->paint, do_undo_restore, reader, &toolsett_old->gp_paint->paint);
655  }
656  if (toolsett->gp_vertexpaint) {
658  &toolsett->gp_vertexpaint->paint,
659  do_undo_restore,
660  reader,
661  &toolsett_old->gp_vertexpaint->paint);
662  }
663  if (toolsett->gp_sculptpaint) {
665  &toolsett->gp_sculptpaint->paint,
666  do_undo_restore,
667  reader,
668  &toolsett_old->gp_sculptpaint->paint);
669  }
670  if (toolsett->gp_weightpaint) {
672  &toolsett->gp_weightpaint->paint,
673  do_undo_restore,
674  reader,
675  &toolsett_old->gp_weightpaint->paint);
676  }
677 
679  toolsett->gp_sculpt.guide.reference_object,
680  do_undo_restore,
682  reader,
683  toolsett_old->gp_sculpt.guide.reference_object,
684  IDWALK_CB_NOP);
685 }
686 
688 {
689  LISTBASE_FOREACH (LayerCollection *, lc, lb) {
690  /* XXX This is very weak. The whole idea of keeping pointers to private IDs is very bad
691  * anyway... */
692  const int cb_flag = (lc->collection != NULL &&
693  (lc->collection->id.flag & LIB_EMBEDDED_DATA) != 0) ?
696  BKE_LIB_FOREACHID_PROCESS(data, lc->collection, cb_flag);
697  scene_foreach_layer_collection(data, &lc->layer_collections);
698  }
699 }
700 
702 {
703  Scene *scene = (Scene *)id;
704 
711  if (scene->nodetree) {
712  /* nodetree **are owned by IDs**, treat them as mere sub-data and not real ID! */
714  }
715  if (scene->ed) {
716  Sequence *seq;
717  SEQ_ALL_BEGIN (scene->ed, seq) {
727  }
728 
729  if (seq->type == SEQ_TYPE_TEXT && seq->effectdata) {
730  TextVars *text_data = seq->effectdata;
732  }
733  }
734  SEQ_ALL_END;
735  }
736 
738 
739  /* This pointer can be NULL during old files reading, better be safe than sorry. */
740  if (scene->master_collection != NULL) {
742  }
743 
744  LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
745  BKE_LIB_FOREACHID_PROCESS(data, view_layer->mat_override, IDWALK_CB_USER);
746 
747  LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) {
750  }
751 
752  scene_foreach_layer_collection(data, &view_layer->layer_collections);
753 
754  LISTBASE_FOREACH (FreestyleModuleConfig *, fmc, &view_layer->freestyle_config.modules) {
755  if (fmc->script) {
757  }
758  }
759 
760  LISTBASE_FOREACH (FreestyleLineSet *, fls, &view_layer->freestyle_config.linesets) {
761  if (fls->group) {
763  }
764 
765  if (fls->linestyle) {
767  }
768  }
769  }
770 
771  LISTBASE_FOREACH (TimeMarker *, marker, &scene->markers) {
772  BKE_LIB_FOREACHID_PROCESS(data, marker->camera, IDWALK_CB_NOP);
775  }
776 
777  ToolSettings *toolsett = scene->toolsettings;
778  if (toolsett) {
779  scene_foreach_toolsettings(data, toolsett, false, NULL, toolsett);
780  }
781 
782  if (scene->rigidbody_world) {
785  }
786 }
787 
788 static void scene_foreach_cache(ID *id,
789  IDTypeForeachCacheFunctionCallback function_callback,
790  void *user_data)
791 {
792  Scene *scene = (Scene *)id;
793  IDCacheKey key = {
794  .id_session_uuid = id->session_uuid,
795  .offset_in_ID = offsetof(Scene, eevee.light_cache_data),
796  .cache_v = scene->eevee.light_cache_data,
797  };
798 
799  function_callback(id,
800  &key,
801  (void **)&scene->eevee.light_cache_data,
803  user_data);
804 }
805 
806 static void scene_blend_write(BlendWriter *writer, ID *id, const void *id_address)
807 {
808  Scene *sce = (Scene *)id;
809 
810  if (BLO_write_is_undo(writer)) {
811  /* Clean up, important in undo case to reduce false detection of changed data-blocks. */
812  /* XXX This UI data should not be stored in Scene at all... */
813  memset(&sce->cursor, 0, sizeof(sce->cursor));
814  }
815 
816  /* write LibData */
817  BLO_write_id_struct(writer, Scene, id_address, &sce->id);
818  BKE_id_blend_write(writer, &sce->id);
819 
820  if (sce->adt) {
821  BKE_animdata_blend_write(writer, sce->adt);
822  }
823  BKE_keyingsets_blend_write(writer, &sce->keyingsets);
824 
825  /* direct data */
826  ToolSettings *tos = sce->toolsettings;
827  BLO_write_struct(writer, ToolSettings, tos);
828  if (tos->vpaint) {
829  BLO_write_struct(writer, VPaint, tos->vpaint);
830  BKE_paint_blend_write(writer, &tos->vpaint->paint);
831  }
832  if (tos->wpaint) {
833  BLO_write_struct(writer, VPaint, tos->wpaint);
834  BKE_paint_blend_write(writer, &tos->wpaint->paint);
835  }
836  if (tos->sculpt) {
837  BLO_write_struct(writer, Sculpt, tos->sculpt);
838  BKE_paint_blend_write(writer, &tos->sculpt->paint);
839  }
840  if (tos->uvsculpt) {
841  BLO_write_struct(writer, UvSculpt, tos->uvsculpt);
842  BKE_paint_blend_write(writer, &tos->uvsculpt->paint);
843  }
844  if (tos->gp_paint) {
845  BLO_write_struct(writer, GpPaint, tos->gp_paint);
846  BKE_paint_blend_write(writer, &tos->gp_paint->paint);
847  }
848  if (tos->gp_vertexpaint) {
851  }
852  if (tos->gp_sculptpaint) {
855  }
856  if (tos->gp_weightpaint) {
859  }
860  /* write grease-pencil custom ipo curve to file */
861  if (tos->gp_interpolate.custom_ipo) {
863  }
864  /* write grease-pencil multiframe falloff curve to file */
865  if (tos->gp_sculpt.cur_falloff) {
867  }
868  /* write grease-pencil primitive curve to file */
869  if (tos->gp_sculpt.cur_primitive) {
871  }
872  /* Write the curve profile to the file. */
873  if (tos->custom_bevel_profile_preset) {
875  }
876  if (tos->sequencer_tool_settings) {
878  }
879 
880  BKE_paint_blend_write(writer, &tos->imapaint.paint);
881 
882  Editing *ed = sce->ed;
883  if (ed) {
884  Sequence *seq;
885 
886  BLO_write_struct(writer, Editing, ed);
887 
888  /* reset write flags too */
889 
890  SEQ_ALL_BEGIN (ed, seq) {
891  if (seq->strip) {
892  seq->strip->done = false;
893  }
894  BLO_write_struct(writer, Sequence, seq);
895  }
896  SEQ_ALL_END;
897 
898  SEQ_ALL_BEGIN (ed, seq) {
899  if (seq->strip && seq->strip->done == 0) {
900  /* write strip with 'done' at 0 because readfile */
901 
902  if (seq->effectdata) {
903  switch (seq->type) {
904  case SEQ_TYPE_COLOR:
906  break;
907  case SEQ_TYPE_SPEED:
909  break;
910  case SEQ_TYPE_WIPE:
911  BLO_write_struct(writer, WipeVars, seq->effectdata);
912  break;
913  case SEQ_TYPE_GLOW:
914  BLO_write_struct(writer, GlowVars, seq->effectdata);
915  break;
916  case SEQ_TYPE_TRANSFORM:
918  break;
921  break;
922  case SEQ_TYPE_TEXT:
923  BLO_write_struct(writer, TextVars, seq->effectdata);
924  break;
925  case SEQ_TYPE_COLORMIX:
927  break;
928  }
929  }
930 
932 
933  Strip *strip = seq->strip;
934  BLO_write_struct(writer, Strip, strip);
935  if (strip->crop) {
936  BLO_write_struct(writer, StripCrop, strip->crop);
937  }
938  if (strip->transform) {
939  BLO_write_struct(writer, StripTransform, strip->transform);
940  }
941  if (strip->proxy) {
942  BLO_write_struct(writer, StripProxy, strip->proxy);
943  }
944  if (seq->type == SEQ_TYPE_IMAGE) {
945  BLO_write_struct_array(writer,
946  StripElem,
947  MEM_allocN_len(strip->stripdata) / sizeof(struct StripElem),
948  strip->stripdata);
949  }
951  BLO_write_struct(writer, StripElem, strip->stripdata);
952  }
953 
954  strip->done = true;
955  }
956 
957  if (seq->prop) {
958  IDP_BlendWrite(writer, seq->prop);
959  }
960 
961  SEQ_modifier_blend_write(writer, &seq->modifiers);
962  }
963  SEQ_ALL_END;
964 
965  /* new; meta stack too, even when its nasty restore code */
966  LISTBASE_FOREACH (MetaStack *, ms, &ed->metastack) {
967  BLO_write_struct(writer, MetaStack, ms);
968  }
969  }
970 
971  if (sce->r.avicodecdata) {
973  if (sce->r.avicodecdata->lpFormat) {
974  BLO_write_raw(writer, (size_t)sce->r.avicodecdata->cbFormat, sce->r.avicodecdata->lpFormat);
975  }
976  if (sce->r.avicodecdata->lpParms) {
977  BLO_write_raw(writer, (size_t)sce->r.avicodecdata->cbParms, sce->r.avicodecdata->lpParms);
978  }
979  }
980  if (sce->r.ffcodecdata.properties) {
981  IDP_BlendWrite(writer, sce->r.ffcodecdata.properties);
982  }
983 
984  /* writing dynamic list of TimeMarkers to the blend file */
985  LISTBASE_FOREACH (TimeMarker *, marker, &sce->markers) {
986  BLO_write_struct(writer, TimeMarker, marker);
987 
988  if (marker->prop != NULL) {
989  IDP_BlendWrite(writer, marker->prop);
990  }
991  }
992 
993  /* writing dynamic list of TransformOrientations to the blend file */
996  }
997 
998  /* writing MultiView to the blend file */
999  LISTBASE_FOREACH (SceneRenderView *, srv, &sce->r.views) {
1000  BLO_write_struct(writer, SceneRenderView, srv);
1001  }
1002 
1003  if (sce->nodetree) {
1004  BLO_write_struct(writer, bNodeTree, sce->nodetree);
1005  ntreeBlendWrite(writer, sce->nodetree);
1006  }
1007 
1009 
1010  /* writing RigidBodyWorld data to the blend file */
1011  if (sce->rigidbody_world) {
1012  /* Set deprecated pointers to prevent crashes of older Blenders */
1013  sce->rigidbody_world->pointcache = sce->rigidbody_world->shared->pointcache;
1014  sce->rigidbody_world->ptcaches = sce->rigidbody_world->shared->ptcaches;
1016 
1020  }
1021 
1022  BKE_previewimg_blend_write(writer, sce->preview);
1024 
1025  LISTBASE_FOREACH (ViewLayer *, view_layer, &sce->view_layers) {
1026  BKE_view_layer_blend_write(writer, view_layer);
1027  }
1028 
1029  if (sce->master_collection) {
1032  }
1033 
1034  /* Eevee Lightcache */
1035  if (sce->eevee.light_cache_data && !BLO_write_is_undo(writer)) {
1038  }
1039 
1041 
1042  /* Freed on doversion. */
1043  BLI_assert(sce->layer_properties == NULL);
1044 }
1045 
1046 static void direct_link_paint_helper(BlendDataReader *reader, const Scene *scene, Paint **paint)
1047 {
1048  /* TODO. is this needed */
1049  BLO_read_data_address(reader, paint);
1050 
1051  if (*paint) {
1052  BKE_paint_blend_read_data(reader, scene, *paint);
1053  }
1054 }
1055 
1056 static void link_recurs_seq(BlendDataReader *reader, ListBase *lb)
1057 {
1058  BLO_read_list(reader, lb);
1059 
1060  LISTBASE_FOREACH_MUTABLE (Sequence *, seq, lb) {
1061  /* Sanity check. */
1062  if ((seq->machine < 1) || (seq->machine > MAXSEQ)) {
1063  BLI_freelinkN(lb, seq);
1064  }
1065  else if (seq->seqbase.first) {
1066  link_recurs_seq(reader, &seq->seqbase);
1067  }
1068  }
1069 }
1070 
1071 static void scene_blend_read_data(BlendDataReader *reader, ID *id)
1072 {
1073  Scene *sce = (Scene *)id;
1074 
1075  sce->depsgraph_hash = NULL;
1076  sce->fps_info = NULL;
1077 
1078  memset(&sce->customdata_mask, 0, sizeof(sce->customdata_mask));
1079  memset(&sce->customdata_mask_modal, 0, sizeof(sce->customdata_mask_modal));
1080 
1082 
1083  /* set users to one by default, not in lib-link, this will increase it for compo nodes */
1084  id_us_ensure_real(&sce->id);
1085 
1086  BLO_read_list(reader, &(sce->base));
1087 
1088  BLO_read_data_address(reader, &sce->adt);
1089  BKE_animdata_blend_read_data(reader, sce->adt);
1090 
1091  BLO_read_list(reader, &sce->keyingsets);
1093 
1094  BLO_read_data_address(reader, &sce->basact);
1095 
1096  BLO_read_data_address(reader, &sce->toolsettings);
1097  if (sce->toolsettings) {
1098 
1099  /* Reset last_location and last_hit, so they are not remembered across sessions. In some files
1100  * these are also NaN, which could lead to crashes in painting. */
1102  zero_v3(ups->last_location);
1103  ups->last_hit = 0;
1104 
1105  direct_link_paint_helper(reader, sce, (Paint **)&sce->toolsettings->sculpt);
1106  direct_link_paint_helper(reader, sce, (Paint **)&sce->toolsettings->vpaint);
1107  direct_link_paint_helper(reader, sce, (Paint **)&sce->toolsettings->wpaint);
1108  direct_link_paint_helper(reader, sce, (Paint **)&sce->toolsettings->uvsculpt);
1109  direct_link_paint_helper(reader, sce, (Paint **)&sce->toolsettings->gp_paint);
1110  direct_link_paint_helper(reader, sce, (Paint **)&sce->toolsettings->gp_vertexpaint);
1111  direct_link_paint_helper(reader, sce, (Paint **)&sce->toolsettings->gp_sculptpaint);
1112  direct_link_paint_helper(reader, sce, (Paint **)&sce->toolsettings->gp_weightpaint);
1113 
1115 
1117  sce->toolsettings->particle.scene = NULL;
1118  sce->toolsettings->particle.object = NULL;
1120 
1121  /* relink grease pencil interpolation curves */
1125  }
1126  /* relink grease pencil multiframe falloff curve */
1128  if (sce->toolsettings->gp_sculpt.cur_falloff) {
1130  }
1131  /* relink grease pencil primitive curve */
1133  if (sce->toolsettings->gp_sculpt.cur_primitive) {
1135  }
1136 
1137  /* Relink toolsettings curve profile */
1141  }
1142 
1144  }
1145 
1146  if (sce->ed) {
1147  ListBase *old_seqbasep = &sce->ed->seqbase;
1148 
1149  BLO_read_data_address(reader, &sce->ed);
1150  Editing *ed = sce->ed;
1151 
1152  BLO_read_data_address(reader, &ed->act_seq);
1153  ed->cache = NULL;
1154  ed->prefetch_job = NULL;
1155 
1156  /* recursive link sequences, lb will be correctly initialized */
1157  link_recurs_seq(reader, &ed->seqbase);
1158 
1159  Sequence *seq;
1160  SEQ_ALL_BEGIN (ed, seq) {
1161  /* Do as early as possible, so that other parts of reading can rely on valid session UUID. */
1163 
1164  BLO_read_data_address(reader, &seq->seq1);
1165  BLO_read_data_address(reader, &seq->seq2);
1166  BLO_read_data_address(reader, &seq->seq3);
1167 
1168  /* a patch: after introduction of effects with 3 input strips */
1169  if (seq->seq3 == NULL) {
1170  seq->seq3 = seq->seq2;
1171  }
1172 
1173  BLO_read_data_address(reader, &seq->effectdata);
1174  BLO_read_data_address(reader, &seq->stereo3d_format);
1175 
1176  if (seq->type & SEQ_TYPE_EFFECT) {
1177  seq->flag |= SEQ_EFFECT_NOT_LOADED;
1178  }
1179 
1180  if (seq->type == SEQ_TYPE_SPEED) {
1181  SpeedControlVars *s = seq->effectdata;
1182  s->frameMap = NULL;
1183  }
1184 
1185  if (seq->type == SEQ_TYPE_TEXT) {
1186  TextVars *t = seq->effectdata;
1187  t->text_blf_id = SEQ_FONT_NOT_LOADED;
1188  }
1189 
1190  BLO_read_data_address(reader, &seq->prop);
1191  IDP_BlendDataRead(reader, &seq->prop);
1192 
1193  BLO_read_data_address(reader, &seq->strip);
1194  if (seq->strip && seq->strip->done == 0) {
1195  seq->strip->done = true;
1196 
1197  if (ELEM(seq->type,
1201  SEQ_TYPE_SOUND_HD)) {
1202  BLO_read_data_address(reader, &seq->strip->stripdata);
1203  }
1204  else {
1205  seq->strip->stripdata = NULL;
1206  }
1207  BLO_read_data_address(reader, &seq->strip->crop);
1208  BLO_read_data_address(reader, &seq->strip->transform);
1209  BLO_read_data_address(reader, &seq->strip->proxy);
1210  if (seq->strip->proxy) {
1211  seq->strip->proxy->anim = NULL;
1212  }
1213  else if (seq->flag & SEQ_USE_PROXY) {
1214  SEQ_proxy_set(seq, true);
1215  }
1216 
1217  /* need to load color balance to it could be converted to modifier */
1218  BLO_read_data_address(reader, &seq->strip->color_balance);
1219  }
1220 
1221  SEQ_modifier_blend_read_data(reader, &seq->modifiers);
1222  }
1223  SEQ_ALL_END;
1224 
1225  /* link metastack, slight abuse of structs here,
1226  * have to restore pointer to internal part in struct */
1227  {
1228  Sequence temp;
1229  void *poin;
1230  intptr_t offset;
1231 
1232  offset = ((intptr_t) & (temp.seqbase)) - ((intptr_t)&temp);
1233 
1234  /* root pointer */
1235  if (ed->seqbasep == old_seqbasep) {
1236  ed->seqbasep = &ed->seqbase;
1237  }
1238  else {
1239  poin = POINTER_OFFSET(ed->seqbasep, -offset);
1240 
1241  poin = BLO_read_get_new_data_address(reader, poin);
1242 
1243  if (poin) {
1244  ed->seqbasep = (ListBase *)POINTER_OFFSET(poin, offset);
1245  }
1246  else {
1247  ed->seqbasep = &ed->seqbase;
1248  }
1249  }
1250  /* stack */
1251  BLO_read_list(reader, &(ed->metastack));
1252 
1253  LISTBASE_FOREACH (MetaStack *, ms, &ed->metastack) {
1254  BLO_read_data_address(reader, &ms->parseq);
1255 
1256  if (ms->oldbasep == old_seqbasep) {
1257  ms->oldbasep = &ed->seqbase;
1258  }
1259  else {
1260  poin = POINTER_OFFSET(ms->oldbasep, -offset);
1261  poin = BLO_read_get_new_data_address(reader, poin);
1262  if (poin) {
1263  ms->oldbasep = (ListBase *)POINTER_OFFSET(poin, offset);
1264  }
1265  else {
1266  ms->oldbasep = &ed->seqbase;
1267  }
1268  }
1269  }
1270  }
1271  }
1272 
1273 #ifdef DURIAN_CAMERA_SWITCH
1274  /* Runtime */
1275  sce->r.mode &= ~R_NO_CAMERA_SWITCH;
1276 #endif
1277 
1278  BLO_read_data_address(reader, &sce->r.avicodecdata);
1279  if (sce->r.avicodecdata) {
1280  BLO_read_data_address(reader, &sce->r.avicodecdata->lpFormat);
1281  BLO_read_data_address(reader, &sce->r.avicodecdata->lpParms);
1282  }
1283  if (sce->r.ffcodecdata.properties) {
1285  IDP_BlendDataRead(reader, &sce->r.ffcodecdata.properties);
1286  }
1287 
1288  BLO_read_list(reader, &(sce->markers));
1289  LISTBASE_FOREACH (TimeMarker *, marker, &sce->markers) {
1290  BLO_read_data_address(reader, &marker->prop);
1291  IDP_BlendDataRead(reader, &marker->prop);
1292  }
1293 
1294  BLO_read_list(reader, &(sce->transform_spaces));
1295  BLO_read_list(reader, &(sce->r.layers));
1296  BLO_read_list(reader, &(sce->r.views));
1297 
1298  LISTBASE_FOREACH (SceneRenderLayer *, srl, &sce->r.layers) {
1299  BLO_read_data_address(reader, &srl->prop);
1300  IDP_BlendDataRead(reader, &srl->prop);
1301  BLO_read_list(reader, &(srl->freestyleConfig.modules));
1302  BLO_read_list(reader, &(srl->freestyleConfig.linesets));
1303  }
1304 
1306 
1307  BLO_read_data_address(reader, &sce->rigidbody_world);
1308  RigidBodyWorld *rbw = sce->rigidbody_world;
1309  if (rbw) {
1310  BLO_read_data_address(reader, &rbw->shared);
1311 
1312  if (rbw->shared == NULL) {
1313  /* Link deprecated caches if they exist, so we can use them for versioning.
1314  * We should only do this when rbw->shared == NULL, because those pointers
1315  * are always set (for compatibility with older Blenders). We mustn't link
1316  * the same pointcache twice. */
1317  BKE_ptcache_blend_read_data(reader, &rbw->ptcaches, &rbw->pointcache, false);
1318 
1319  /* make sure simulation starts from the beginning after loading file */
1320  if (rbw->pointcache) {
1321  rbw->ltime = (float)rbw->pointcache->startframe;
1322  }
1323  }
1324  else {
1325  /* must nullify the reference to physics sim object, since it no-longer exist
1326  * (and will need to be recalculated)
1327  */
1328  rbw->shared->physics_world = NULL;
1329 
1330  /* link caches */
1331  BKE_ptcache_blend_read_data(reader, &rbw->shared->ptcaches, &rbw->shared->pointcache, false);
1332 
1333  /* make sure simulation starts from the beginning after loading file */
1334  if (rbw->shared->pointcache) {
1335  rbw->ltime = (float)rbw->shared->pointcache->startframe;
1336  }
1337  }
1338  rbw->objects = NULL;
1339  rbw->numbodies = 0;
1340 
1341  /* set effector weights */
1342  BLO_read_data_address(reader, &rbw->effector_weights);
1343  if (!rbw->effector_weights) {
1345  }
1346  }
1347 
1348  BLO_read_data_address(reader, &sce->preview);
1349  BKE_previewimg_blend_read(reader, sce->preview);
1350 
1352 
1353 #ifdef USE_COLLECTION_COMPAT_28
1354  /* this runs before the very first doversion */
1355  if (sce->collection) {
1356  BLO_read_data_address(reader, &sce->collection);
1357  BKE_collection_compat_blend_read_data(reader, sce->collection);
1358  }
1359 #endif
1360 
1361  /* insert into global old-new map for reading without UI (link_global accesses it again) */
1362  BLO_read_glob_list(reader, &sce->view_layers);
1363  LISTBASE_FOREACH (ViewLayer *, view_layer, &sce->view_layers) {
1364  BKE_view_layer_blend_read_data(reader, view_layer);
1365  }
1366 
1367  if (BLO_read_data_is_undo(reader)) {
1368  /* If it's undo do nothing here, caches are handled by higher-level generic calling code. */
1369  }
1370  else {
1371  /* else try to read the cache from file. */
1373  if (sce->eevee.light_cache_data) {
1375  }
1376  }
1378 
1380 
1381  BLO_read_data_address(reader, &sce->layer_properties);
1382  IDP_BlendDataRead(reader, &sce->layer_properties);
1383 }
1384 
1385 /* patch for missing scene IDs, can't be in do-versions */
1387 {
1389  if (node->id == NULL &&
1390  ((node->type == CMP_NODE_R_LAYERS) ||
1391  (node->type == CMP_NODE_CRYPTOMATTE && node->custom1 == CMP_CRYPTOMATTE_SRC_RENDER))) {
1392  node->id = &scene->id;
1393  }
1394  }
1395 }
1396 
1397 static void scene_blend_read_lib(BlendLibReader *reader, ID *id)
1398 {
1399  Scene *sce = (Scene *)id;
1400 
1401  BKE_keyingsets_blend_read_lib(reader, &sce->id, &sce->keyingsets);
1402 
1403  BLO_read_id_address(reader, sce->id.lib, &sce->camera);
1404  BLO_read_id_address(reader, sce->id.lib, &sce->world);
1405  BLO_read_id_address(reader, sce->id.lib, &sce->set);
1406  BLO_read_id_address(reader, sce->id.lib, &sce->gpd);
1407 
1408  BKE_paint_blend_read_lib(reader, sce, &sce->toolsettings->imapaint.paint);
1409  if (sce->toolsettings->sculpt) {
1410  BKE_paint_blend_read_lib(reader, sce, &sce->toolsettings->sculpt->paint);
1411  }
1412  if (sce->toolsettings->vpaint) {
1413  BKE_paint_blend_read_lib(reader, sce, &sce->toolsettings->vpaint->paint);
1414  }
1415  if (sce->toolsettings->wpaint) {
1416  BKE_paint_blend_read_lib(reader, sce, &sce->toolsettings->wpaint->paint);
1417  }
1418  if (sce->toolsettings->uvsculpt) {
1419  BKE_paint_blend_read_lib(reader, sce, &sce->toolsettings->uvsculpt->paint);
1420  }
1421  if (sce->toolsettings->gp_paint) {
1422  BKE_paint_blend_read_lib(reader, sce, &sce->toolsettings->gp_paint->paint);
1423  }
1424  if (sce->toolsettings->gp_vertexpaint) {
1426  }
1427  if (sce->toolsettings->gp_sculptpaint) {
1429  }
1430  if (sce->toolsettings->gp_weightpaint) {
1432  }
1433 
1434  if (sce->toolsettings->sculpt) {
1436  }
1437 
1438  if (sce->toolsettings->imapaint.stencil) {
1439  BLO_read_id_address(reader, sce->id.lib, &sce->toolsettings->imapaint.stencil);
1440  }
1441 
1442  if (sce->toolsettings->imapaint.clone) {
1443  BLO_read_id_address(reader, sce->id.lib, &sce->toolsettings->imapaint.clone);
1444  }
1445 
1446  if (sce->toolsettings->imapaint.canvas) {
1447  BLO_read_id_address(reader, sce->id.lib, &sce->toolsettings->imapaint.canvas);
1448  }
1449 
1451 
1453 
1454  LISTBASE_FOREACH_MUTABLE (Base *, base_legacy, &sce->base) {
1455  BLO_read_id_address(reader, sce->id.lib, &base_legacy->object);
1456 
1457  if (base_legacy->object == NULL) {
1459  RPT_WARNING,
1460  TIP_("LIB: object lost from scene: '%s'"),
1461  sce->id.name + 2);
1462  BLI_remlink(&sce->base, base_legacy);
1463  if (base_legacy == sce->basact) {
1464  sce->basact = NULL;
1465  }
1466  MEM_freeN(base_legacy);
1467  }
1468  }
1469 
1470  Sequence *seq;
1471  SEQ_ALL_BEGIN (sce->ed, seq) {
1472  IDP_BlendReadLib(reader, seq->prop);
1473 
1474  if (seq->ipo) {
1476  reader, sce->id.lib, &seq->ipo); /* XXX deprecated - old animation system */
1477  }
1478  seq->scene_sound = NULL;
1479  if (seq->scene) {
1480  BLO_read_id_address(reader, sce->id.lib, &seq->scene);
1481  seq->scene_sound = NULL;
1482  }
1483  if (seq->clip) {
1484  BLO_read_id_address(reader, sce->id.lib, &seq->clip);
1485  }
1486  if (seq->mask) {
1487  BLO_read_id_address(reader, sce->id.lib, &seq->mask);
1488  }
1489  if (seq->scene_camera) {
1490  BLO_read_id_address(reader, sce->id.lib, &seq->scene_camera);
1491  }
1492  if (seq->sound) {
1493  seq->scene_sound = NULL;
1494  if (seq->type == SEQ_TYPE_SOUND_HD) {
1495  seq->type = SEQ_TYPE_SOUND_RAM;
1496  }
1497  else {
1498  BLO_read_id_address(reader, sce->id.lib, &seq->sound);
1499  }
1500  if (seq->sound) {
1501  id_us_plus_no_lib((ID *)seq->sound);
1502  seq->scene_sound = NULL;
1503  }
1504  }
1505  if (seq->type == SEQ_TYPE_TEXT) {
1506  TextVars *t = seq->effectdata;
1507  BLO_read_id_address(reader, sce->id.lib, &t->text_font);
1508  }
1509  BLI_listbase_clear(&seq->anims);
1510 
1511  SEQ_modifier_blend_read_lib(reader, sce, &seq->modifiers);
1512  }
1513  SEQ_ALL_END;
1514 
1515  LISTBASE_FOREACH (TimeMarker *, marker, &sce->markers) {
1516  IDP_BlendReadLib(reader, marker->prop);
1517 
1518  if (marker->camera) {
1519  BLO_read_id_address(reader, sce->id.lib, &marker->camera);
1520  }
1521  }
1522 
1523  /* rigidbody world relies on its linked collections */
1524  if (sce->rigidbody_world) {
1525  RigidBodyWorld *rbw = sce->rigidbody_world;
1526  if (rbw->group) {
1527  BLO_read_id_address(reader, sce->id.lib, &rbw->group);
1528  }
1529  if (rbw->constraints) {
1530  BLO_read_id_address(reader, sce->id.lib, &rbw->constraints);
1531  }
1532  if (rbw->effector_weights) {
1533  BLO_read_id_address(reader, sce->id.lib, &rbw->effector_weights->group);
1534  }
1535  }
1536 
1537  if (sce->nodetree) {
1538  composite_patch(sce->nodetree, sce);
1539  }
1540 
1541  LISTBASE_FOREACH (SceneRenderLayer *, srl, &sce->r.layers) {
1542  BLO_read_id_address(reader, sce->id.lib, &srl->mat_override);
1543  LISTBASE_FOREACH (FreestyleModuleConfig *, fmc, &srl->freestyleConfig.modules) {
1544  BLO_read_id_address(reader, sce->id.lib, &fmc->script);
1545  }
1546  LISTBASE_FOREACH (FreestyleLineSet *, fls, &srl->freestyleConfig.linesets) {
1547  BLO_read_id_address(reader, sce->id.lib, &fls->linestyle);
1548  BLO_read_id_address(reader, sce->id.lib, &fls->group);
1549  }
1550  }
1551  /* Motion Tracking */
1552  BLO_read_id_address(reader, sce->id.lib, &sce->clip);
1553 
1554 #ifdef USE_COLLECTION_COMPAT_28
1555  if (sce->collection) {
1556  BKE_collection_compat_blend_read_lib(reader, sce->id.lib, sce->collection);
1557  }
1558 #endif
1559 
1560  LISTBASE_FOREACH (ViewLayer *, view_layer, &sce->view_layers) {
1561  BKE_view_layer_blend_read_lib(reader, sce->id.lib, view_layer);
1562  }
1563 
1564  if (sce->r.bake.cage_object) {
1565  BLO_read_id_address(reader, sce->id.lib, &sce->r.bake.cage_object);
1566  }
1567 
1568 #ifdef USE_SETSCENE_CHECK
1569  if (sce->set != NULL) {
1571  }
1572 #endif
1573 }
1574 
1575 static void scene_blend_read_expand(BlendExpander *expander, ID *id)
1576 {
1577  Scene *sce = (Scene *)id;
1578 
1579  LISTBASE_FOREACH (Base *, base_legacy, &sce->base) {
1580  BLO_expand(expander, base_legacy->object);
1581  }
1582  BLO_expand(expander, sce->camera);
1583  BLO_expand(expander, sce->world);
1584 
1586 
1587  if (sce->set) {
1588  BLO_expand(expander, sce->set);
1589  }
1590 
1591  LISTBASE_FOREACH (SceneRenderLayer *, srl, &sce->r.layers) {
1592  BLO_expand(expander, srl->mat_override);
1593  LISTBASE_FOREACH (FreestyleModuleConfig *, module, &srl->freestyleConfig.modules) {
1594  if (module->script) {
1595  BLO_expand(expander, module->script);
1596  }
1597  }
1598  LISTBASE_FOREACH (FreestyleLineSet *, lineset, &srl->freestyleConfig.linesets) {
1599  if (lineset->group) {
1600  BLO_expand(expander, lineset->group);
1601  }
1602  BLO_expand(expander, lineset->linestyle);
1603  }
1604  }
1605 
1606  LISTBASE_FOREACH (ViewLayer *, view_layer, &sce->view_layers) {
1607  IDP_BlendReadExpand(expander, view_layer->id_properties);
1608 
1609  LISTBASE_FOREACH (FreestyleModuleConfig *, module, &view_layer->freestyle_config.modules) {
1610  if (module->script) {
1611  BLO_expand(expander, module->script);
1612  }
1613  }
1614 
1615  LISTBASE_FOREACH (FreestyleLineSet *, lineset, &view_layer->freestyle_config.linesets) {
1616  if (lineset->group) {
1617  BLO_expand(expander, lineset->group);
1618  }
1619  BLO_expand(expander, lineset->linestyle);
1620  }
1621  }
1622 
1623  if (sce->gpd) {
1624  BLO_expand(expander, sce->gpd);
1625  }
1626 
1627  if (sce->ed) {
1628  Sequence *seq;
1629 
1630  SEQ_ALL_BEGIN (sce->ed, seq) {
1631  IDP_BlendReadExpand(expander, seq->prop);
1632 
1633  if (seq->scene) {
1634  BLO_expand(expander, seq->scene);
1635  }
1636  if (seq->scene_camera) {
1637  BLO_expand(expander, seq->scene_camera);
1638  }
1639  if (seq->clip) {
1640  BLO_expand(expander, seq->clip);
1641  }
1642  if (seq->mask) {
1643  BLO_expand(expander, seq->mask);
1644  }
1645  if (seq->sound) {
1646  BLO_expand(expander, seq->sound);
1647  }
1648 
1649  if (seq->type == SEQ_TYPE_TEXT && seq->effectdata) {
1650  TextVars *data = seq->effectdata;
1651  BLO_expand(expander, data->text_font);
1652  }
1653  }
1654  SEQ_ALL_END;
1655  }
1656 
1657  if (sce->rigidbody_world) {
1658  BLO_expand(expander, sce->rigidbody_world->group);
1659  BLO_expand(expander, sce->rigidbody_world->constraints);
1660  }
1661 
1662  LISTBASE_FOREACH (TimeMarker *, marker, &sce->markers) {
1663  IDP_BlendReadExpand(expander, marker->prop);
1664 
1665  if (marker->camera) {
1666  BLO_expand(expander, marker->camera);
1667  }
1668  }
1669 
1670  BLO_expand(expander, sce->clip);
1671 
1672 #ifdef USE_COLLECTION_COMPAT_28
1673  if (sce->collection) {
1674  BKE_collection_compat_blend_read_expand(expander, sce->collection);
1675  }
1676 #endif
1677 
1678  if (sce->r.bake.cage_object) {
1679  BLO_expand(expander, sce->r.bake.cage_object);
1680  }
1681 }
1682 
1683 static void scene_undo_preserve(BlendLibReader *reader, ID *id_new, ID *id_old)
1684 {
1685  Scene *scene_new = (Scene *)id_new;
1686  Scene *scene_old = (Scene *)id_old;
1687 
1688  SWAP(View3DCursor, scene_old->cursor, scene_new->cursor);
1689  if (scene_new->toolsettings != NULL && scene_old->toolsettings != NULL) {
1690  /* First try to restore ID pointers that can be and should be preserved (like brushes or
1691  * palettes), and counteract the swap of the whole ToolSettings structs below for the others
1692  * (like object ones). */
1694  NULL, scene_new->toolsettings, true, reader, scene_old->toolsettings);
1695  SWAP(ToolSettings, *scene_old->toolsettings, *scene_new->toolsettings);
1696  }
1697 }
1698 
1699 static void scene_lib_override_apply_post(ID *id_dst, ID *UNUSED(id_src))
1700 {
1701  Scene *scene = (Scene *)id_dst;
1702 
1703  if (scene->rigidbody_world != NULL) {
1704  PTCacheID pid;
1706  LISTBASE_FOREACH (PointCache *, point_cache, pid.ptcaches) {
1707  point_cache->flag |= PTCACHE_FLAG_INFO_DIRTY;
1708  }
1709  }
1710 }
1711 
1713  .id_code = ID_SCE,
1714  .id_filter = FILTER_ID_SCE,
1715  .main_listbase_index = INDEX_ID_SCE,
1716  .struct_size = sizeof(Scene),
1717  .name = "Scene",
1718  .name_plural = "scenes",
1719  .translation_context = BLT_I18NCONTEXT_ID_SCENE,
1720  .flags = 0,
1721 
1723  .copy_data = scene_copy_data,
1724  .free_data = scene_free_data,
1725  /* For now default `BKE_lib_id_make_local_generic()` should work, may need more work though to
1726  * support all possible corner cases. */
1727  .make_local = NULL,
1728  .foreach_id = scene_foreach_id,
1729  .foreach_cache = scene_foreach_cache,
1730  .owner_get = NULL,
1731 
1732  .blend_write = scene_blend_write,
1733  .blend_read_data = scene_blend_read_data,
1734  .blend_read_lib = scene_blend_read_lib,
1735  .blend_read_expand = scene_blend_read_expand,
1736 
1737  .blend_read_undo_preserve = scene_undo_preserve,
1738 
1739  .lib_override_apply_post = scene_lib_override_apply_post,
1740 };
1741 
1742 const char *RE_engine_id_BLENDER_EEVEE = "BLENDER_EEVEE";
1743 const char *RE_engine_id_BLENDER_WORKBENCH = "BLENDER_WORKBENCH";
1744 const char *RE_engine_id_CYCLES = "CYCLES";
1745 
1747 {
1748  if (acd) {
1749  if (acd->lpFormat) {
1750  MEM_freeN(acd->lpFormat);
1751  acd->lpFormat = NULL;
1752  acd->cbFormat = 0;
1753  }
1754  if (acd->lpParms) {
1755  MEM_freeN(acd->lpParms);
1756  acd->lpParms = NULL;
1757  acd->cbParms = 0;
1758  }
1759  }
1760 }
1761 
1763 {
1764  AnimData *adt = BKE_animdata_from_id(&sce->id);
1765 
1766  if (adt && adt->action) {
1767  FCurve *fcu, *nextfcu;
1768 
1769  for (fcu = adt->action->curves.first; fcu; fcu = nextfcu) {
1770  nextfcu = fcu->next;
1771 
1772  if ((fcu->rna_path) && strstr(fcu->rna_path, "sequences_all")) {
1774  BKE_fcurve_free(fcu);
1775  }
1776  }
1777  }
1778 }
1779 
1780 /* flag -- copying options (see BKE_lib_id.h's LIB_ID_COPY_... flags for more). */
1782 {
1783  if (toolsettings == NULL) {
1784  return NULL;
1785  }
1786  ToolSettings *ts = MEM_dupallocN(toolsettings);
1787  if (ts->vpaint) {
1788  ts->vpaint = MEM_dupallocN(ts->vpaint);
1789  BKE_paint_copy(&ts->vpaint->paint, &ts->vpaint->paint, flag);
1790  }
1791  if (ts->wpaint) {
1792  ts->wpaint = MEM_dupallocN(ts->wpaint);
1793  BKE_paint_copy(&ts->wpaint->paint, &ts->wpaint->paint, flag);
1794  }
1795  if (ts->sculpt) {
1796  ts->sculpt = MEM_dupallocN(ts->sculpt);
1797  BKE_paint_copy(&ts->sculpt->paint, &ts->sculpt->paint, flag);
1798  }
1799  if (ts->uvsculpt) {
1800  ts->uvsculpt = MEM_dupallocN(ts->uvsculpt);
1802  }
1803  if (ts->gp_paint) {
1804  ts->gp_paint = MEM_dupallocN(ts->gp_paint);
1806  }
1807  if (ts->gp_vertexpaint) {
1810  }
1811  if (ts->gp_sculptpaint) {
1814  }
1815  if (ts->gp_weightpaint) {
1818  }
1819 
1821  ts->particle.paintcursor = NULL;
1822  ts->particle.scene = NULL;
1823  ts->particle.object = NULL;
1824 
1825  /* duplicate Grease Pencil interpolation curve */
1827  /* Duplicate Grease Pencil multiframe falloff. */
1830 
1832 
1834  return ts;
1835 }
1836 
1838 {
1839  if (toolsettings == NULL) {
1840  return;
1841  }
1842  if (toolsettings->vpaint) {
1843  BKE_paint_free(&toolsettings->vpaint->paint);
1844  MEM_freeN(toolsettings->vpaint);
1845  }
1846  if (toolsettings->wpaint) {
1847  BKE_paint_free(&toolsettings->wpaint->paint);
1848  MEM_freeN(toolsettings->wpaint);
1849  }
1850  if (toolsettings->sculpt) {
1851  BKE_paint_free(&toolsettings->sculpt->paint);
1852  MEM_freeN(toolsettings->sculpt);
1853  }
1854  if (toolsettings->uvsculpt) {
1855  BKE_paint_free(&toolsettings->uvsculpt->paint);
1856  MEM_freeN(toolsettings->uvsculpt);
1857  }
1858  if (toolsettings->gp_paint) {
1859  BKE_paint_free(&toolsettings->gp_paint->paint);
1860  MEM_freeN(toolsettings->gp_paint);
1861  }
1862  if (toolsettings->gp_vertexpaint) {
1863  BKE_paint_free(&toolsettings->gp_vertexpaint->paint);
1864  MEM_freeN(toolsettings->gp_vertexpaint);
1865  }
1866  if (toolsettings->gp_sculptpaint) {
1867  BKE_paint_free(&toolsettings->gp_sculptpaint->paint);
1868  MEM_freeN(toolsettings->gp_sculptpaint);
1869  }
1870  if (toolsettings->gp_weightpaint) {
1871  BKE_paint_free(&toolsettings->gp_weightpaint->paint);
1872  MEM_freeN(toolsettings->gp_weightpaint);
1873  }
1874  BKE_paint_free(&toolsettings->imapaint.paint);
1875 
1876  /* free Grease Pencil interpolation curve */
1877  if (toolsettings->gp_interpolate.custom_ipo) {
1879  }
1880  /* free Grease Pencil multiframe falloff curve */
1881  if (toolsettings->gp_sculpt.cur_falloff) {
1883  }
1884  if (toolsettings->gp_sculpt.cur_primitive) {
1886  }
1887 
1888  if (toolsettings->custom_bevel_profile_preset) {
1890  }
1891 
1892  if (toolsettings->sequencer_tool_settings) {
1894  }
1895 
1896  MEM_freeN(toolsettings);
1897 }
1898 
1899 void BKE_scene_copy_data_eevee(Scene *sce_dst, const Scene *sce_src)
1900 {
1901  /* Copy eevee data between scenes. */
1902  sce_dst->eevee = sce_src->eevee;
1903  sce_dst->eevee.light_cache_data = NULL;
1904  sce_dst->eevee.light_cache_info[0] = '\0';
1905  /* TODO Copy the cache. */
1906 }
1907 
1909 {
1910  Scene *sce_copy;
1911 
1912  /* TODO this should/could most likely be replaced by call to more generic code at some point...
1913  * But for now, let's keep it well isolated here. */
1914  if (type == SCE_COPY_EMPTY) {
1915  ListBase rv;
1916 
1917  sce_copy = BKE_scene_add(bmain, sce->id.name + 2);
1918 
1919  rv = sce_copy->r.views;
1921  sce_copy->r = sce->r;
1922  sce_copy->r.views = rv;
1923  sce_copy->unit = sce->unit;
1924  sce_copy->physics_settings = sce->physics_settings;
1925  sce_copy->audio = sce->audio;
1926  BKE_scene_copy_data_eevee(sce_copy, sce);
1927 
1928  if (sce->id.properties) {
1929  sce_copy->id.properties = IDP_CopyProperty(sce->id.properties);
1930  }
1931 
1932  BKE_sound_destroy_scene(sce_copy);
1933 
1934  /* copy color management settings */
1939 
1941  &sce->r.im_format.display_settings);
1943  &sce->r.im_format.view_settings);
1944 
1948  &sce->r.bake.im_format.view_settings);
1949 
1951 
1952  /* viewport display settings */
1953  sce_copy->display = sce->display;
1954 
1955  /* tool settings */
1957  sce_copy->toolsettings = BKE_toolsettings_copy(sce->toolsettings, 0);
1958 
1959  /* make a private copy of the avicodecdata */
1960  if (sce->r.avicodecdata) {
1961  sce_copy->r.avicodecdata = MEM_dupallocN(sce->r.avicodecdata);
1962  sce_copy->r.avicodecdata->lpFormat = MEM_dupallocN(sce_copy->r.avicodecdata->lpFormat);
1963  sce_copy->r.avicodecdata->lpParms = MEM_dupallocN(sce_copy->r.avicodecdata->lpParms);
1964  }
1965 
1966  if (sce->r.ffcodecdata.properties) { /* intentionally check scen not sce. */
1968  }
1969 
1971 
1972  /* grease pencil */
1973  sce_copy->gpd = NULL;
1974 
1975  sce_copy->preview = NULL;
1976 
1977  return sce_copy;
1978  }
1979 
1980  eDupli_ID_Flags duplicate_flags = U.dupflag | USER_DUP_OBJECT;
1981 
1982  sce_copy = (Scene *)BKE_id_copy(bmain, (ID *)sce);
1983  id_us_min(&sce_copy->id);
1984  id_us_ensure_real(&sce_copy->id);
1985 
1986  BKE_animdata_duplicate_id_action(bmain, &sce_copy->id, duplicate_flags);
1987 
1988  /* Extra actions, most notably SCE_FULL_COPY also duplicates several 'children' datablocks. */
1989 
1990  if (type == SCE_COPY_FULL) {
1991  /* Scene duplication is always root of duplication currently. */
1992  const bool is_subprocess = false;
1993  const bool is_root_id = true;
1994 
1995  if (!is_subprocess) {
1996  BKE_main_id_tag_all(bmain, LIB_TAG_NEW, false);
1998  }
1999  if (is_root_id) {
2000  /* In case root duplicated ID is linked, assume we want to get a local copy of it and
2001  * duplicate all expected linked data. */
2002  if (ID_IS_LINKED(sce)) {
2003  duplicate_flags |= USER_DUP_LINKED_ID;
2004  }
2005  }
2006 
2007  /* Copy Freestyle LineStyle datablocks. */
2008  LISTBASE_FOREACH (ViewLayer *, view_layer_dst, &sce_copy->view_layers) {
2009  LISTBASE_FOREACH (FreestyleLineSet *, lineset, &view_layer_dst->freestyle_config.linesets) {
2010  BKE_id_copy_for_duplicate(bmain, (ID *)lineset->linestyle, duplicate_flags);
2011  }
2012  }
2013 
2014  /* Full copy of world (included animations) */
2015  BKE_id_copy_for_duplicate(bmain, (ID *)sce->world, duplicate_flags);
2016 
2017  /* Full copy of GreasePencil. */
2018  BKE_id_copy_for_duplicate(bmain, (ID *)sce->gpd, duplicate_flags);
2019 
2020  /* Deep-duplicate collections and objects (using preferences' settings for which sub-data to
2021  * duplicate along the object itself). */
2023  bmain, NULL, sce_copy->master_collection, duplicate_flags, LIB_ID_DUPLICATE_IS_SUBPROCESS);
2024 
2025  if (!is_subprocess) {
2026  /* This code will follow into all ID links using an ID tagged with LIB_TAG_NEW.*/
2027  BKE_libblock_relink_to_newid(&sce_copy->id);
2028 
2029 #ifndef NDEBUG
2030  /* Call to `BKE_libblock_relink_to_newid` above is supposed to have cleared all those
2031  * flags. */
2032  ID *id_iter;
2033  FOREACH_MAIN_ID_BEGIN (bmain, id_iter) {
2034  BLI_assert((id_iter->tag & LIB_TAG_NEW) == 0);
2035  }
2037 #endif
2038 
2039  /* Cleanup. */
2040  BKE_main_id_tag_all(bmain, LIB_TAG_NEW, false);
2042 
2043  BKE_main_collection_sync(bmain);
2044  }
2045  }
2046  else {
2047  /* Remove sequencer if not full copy */
2048  /* XXX Why in Hell? :/ */
2049  remove_sequencer_fcurves(sce_copy);
2050  SEQ_editing_free(sce_copy, true);
2051  }
2052 
2053  return sce_copy;
2054 }
2055 
2057 {
2058  if (sce->rigidbody_world) {
2060  }
2061 }
2062 
2063 bool BKE_scene_can_be_removed(const Main *bmain, const Scene *scene)
2064 {
2065  /* Linked scenes can always be removed. */
2066  if (ID_IS_LINKED(scene)) {
2067  return true;
2068  }
2069  /* Local scenes can only be removed, when there is at least one local scene left. */
2070  LISTBASE_FOREACH (Scene *, other_scene, &bmain->scenes) {
2071  if (other_scene != scene && !ID_IS_LINKED(other_scene)) {
2072  return true;
2073  }
2074  }
2075  return false;
2076 }
2077 
2078 Scene *BKE_scene_add(Main *bmain, const char *name)
2079 {
2080  Scene *sce;
2081 
2082  sce = BKE_id_new(bmain, ID_SCE, name);
2083  id_us_min(&sce->id);
2084  id_us_ensure_real(&sce->id);
2085 
2086  return sce;
2087 }
2088 
2093 {
2094  LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
2095  if (BLI_findptr(&view_layer->object_bases, ob, offsetof(Base, object))) {
2096  return true;
2097  }
2098  }
2099  return false;
2100 }
2101 
2103 {
2104  LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
2105  LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) {
2106  if (STREQ(base->object->id.name + 2, name)) {
2107  return base->object;
2108  }
2109  }
2110  }
2111  return NULL;
2112 }
2113 
2121 {
2122  Object *ob;
2123 
2124  /* check for cyclic sets, for reading old files but also for definite security (py?) */
2126 
2127  /* deselect objects (for dataselect) */
2128  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
2129  ob->flag &= ~SELECT;
2130  }
2131 
2132  /* copy layers and flags from bases to objects */
2133  LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
2134  LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) {
2135  ob = base->object;
2136  /* collection patch... */
2138  }
2139  }
2140  /* No full animation update, this to enable render code to work
2141  * (render code calls own animation updates). */
2142 }
2143 
2144 /* called from creator_args.c */
2145 Scene *BKE_scene_set_name(Main *bmain, const char *name)
2146 {
2147  Scene *sce = (Scene *)BKE_libblock_find_name(bmain, ID_SCE, name);
2148  if (sce) {
2149  BKE_scene_set_background(bmain, sce);
2150  printf("Scene switch for render: '%s' in file: '%s'\n", name, BKE_main_blendfile_path(bmain));
2151  return sce;
2152  }
2153 
2154  printf("Can't find scene: '%s' in file: '%s'\n", name, BKE_main_blendfile_path(bmain));
2155  return NULL;
2156 }
2157 
2158 /* Used by meta-balls, return *all* objects (including duplis)
2159  * existing in the scene (including scene's sets). */
2161  Depsgraph *depsgraph, SceneBaseIter *iter, Scene **scene, int val, Base **base, Object **ob)
2162 {
2163  bool run_again = true;
2164 
2165  /* init */
2166  if (val == 0) {
2167  iter->phase = F_START;
2168  iter->dupob = NULL;
2169  iter->duplilist = NULL;
2170  iter->dupli_refob = NULL;
2171  }
2172  else {
2173  /* run_again is set when a duplilist has been ended */
2174  while (run_again) {
2175  run_again = false;
2176 
2177  /* the first base */
2178  if (iter->phase == F_START) {
2181  *base = view_layer->object_bases.first;
2182  if (*base) {
2183  *ob = (*base)->object;
2184  iter->phase = F_SCENE;
2185  }
2186  else {
2187  /* exception: empty scene layer */
2188  while ((*scene)->set) {
2189  (*scene) = (*scene)->set;
2190  ViewLayer *view_layer_set = BKE_view_layer_default_render((*scene));
2191  if (view_layer_set->object_bases.first) {
2192  *base = view_layer_set->object_bases.first;
2193  *ob = (*base)->object;
2194  iter->phase = F_SCENE;
2195  break;
2196  }
2197  }
2198  }
2199  }
2200  else {
2201  if (*base && iter->phase != F_DUPLI) {
2202  *base = (*base)->next;
2203  if (*base) {
2204  *ob = (*base)->object;
2205  }
2206  else {
2207  if (iter->phase == F_SCENE) {
2208  /* (*scene) is finished, now do the set */
2209  while ((*scene)->set) {
2210  (*scene) = (*scene)->set;
2211  ViewLayer *view_layer_set = BKE_view_layer_default_render((*scene));
2212  if (view_layer_set->object_bases.first) {
2213  *base = view_layer_set->object_bases.first;
2214  *ob = (*base)->object;
2215  break;
2216  }
2217  }
2218  }
2219  }
2220  }
2221  }
2222 
2223  if (*base == NULL) {
2224  iter->phase = F_START;
2225  }
2226  else {
2227  if (iter->phase != F_DUPLI) {
2228  if (depsgraph && (*base)->object->transflag & OB_DUPLI) {
2229  /* Collections cannot be duplicated for meta-balls yet,
2230  * this enters eternal loop because of
2231  * makeDispListMBall getting called inside of collection_duplilist */
2232  if ((*base)->object->instance_collection == NULL) {
2233  iter->duplilist = object_duplilist(depsgraph, (*scene), (*base)->object);
2234 
2235  iter->dupob = iter->duplilist->first;
2236 
2237  if (!iter->dupob) {
2239  iter->duplilist = NULL;
2240  }
2241  iter->dupli_refob = NULL;
2242  }
2243  }
2244  }
2245  /* handle dupli's */
2246  if (iter->dupob) {
2247  (*base)->flag_legacy |= OB_FROMDUPLI;
2248  *ob = iter->dupob->ob;
2249  iter->phase = F_DUPLI;
2250 
2251  if (iter->dupli_refob != *ob) {
2252  if (iter->dupli_refob) {
2253  /* Restore previous object's real matrix. */
2254  copy_m4_m4(iter->dupli_refob->obmat, iter->omat);
2255  }
2256  /* Backup new object's real matrix. */
2257  iter->dupli_refob = *ob;
2258  copy_m4_m4(iter->omat, iter->dupli_refob->obmat);
2259  }
2260  copy_m4_m4((*ob)->obmat, iter->dupob->mat);
2261 
2262  iter->dupob = iter->dupob->next;
2263  }
2264  else if (iter->phase == F_DUPLI) {
2265  iter->phase = F_SCENE;
2266  (*base)->flag_legacy &= ~OB_FROMDUPLI;
2267 
2268  if (iter->dupli_refob) {
2269  /* Restore last object's real matrix. */
2270  copy_m4_m4(iter->dupli_refob->obmat, iter->omat);
2271  iter->dupli_refob = NULL;
2272  }
2273 
2275  iter->duplilist = NULL;
2276  run_again = true;
2277  }
2278  }
2279  }
2280  }
2281 
2282  return iter->phase;
2283 }
2284 
2285 bool BKE_scene_has_view_layer(const Scene *scene, const ViewLayer *layer)
2286 {
2287  return BLI_findindex(&scene->view_layers, layer) != -1;
2288 }
2289 
2290 Scene *BKE_scene_find_from_collection(const Main *bmain, const Collection *collection)
2291 {
2292  for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
2294  if (BKE_view_layer_has_collection(layer, collection)) {
2295  return scene;
2296  }
2297  }
2298  }
2299 
2300  return NULL;
2301 }
2302 
2303 #ifdef DURIAN_CAMERA_SWITCH
2304 Object *BKE_scene_camera_switch_find(Scene *scene)
2305 {
2306  if (scene->r.mode & R_NO_CAMERA_SWITCH) {
2307  return NULL;
2308  }
2309 
2310  const int cfra = ((scene->r.images == scene->r.framapto) ?
2311  scene->r.cfra :
2312  (int)(scene->r.cfra *
2313  ((float)scene->r.framapto / (float)scene->r.images)));
2314  int frame = -(MAXFRAME + 1);
2315  int min_frame = MAXFRAME + 1;
2316  Object *camera = NULL;
2317  Object *first_camera = NULL;
2318 
2320  if (m->camera && (m->camera->restrictflag & OB_RESTRICT_RENDER) == 0) {
2321  if ((m->frame <= cfra) && (m->frame > frame)) {
2322  camera = m->camera;
2323  frame = m->frame;
2324 
2325  if (frame == cfra) {
2326  break;
2327  }
2328  }
2329 
2330  if (m->frame < min_frame) {
2331  first_camera = m->camera;
2332  min_frame = m->frame;
2333  }
2334  }
2335  }
2336 
2337  if (camera == NULL) {
2338  /* If there's no marker to the left of current frame,
2339  * use camera from left-most marker to solve all sort
2340  * of Schrodinger uncertainties.
2341  */
2342  return first_camera;
2343  }
2344 
2345  return camera;
2346 }
2347 #endif
2348 
2350 {
2351 #ifdef DURIAN_CAMERA_SWITCH
2352  Object *camera = BKE_scene_camera_switch_find(scene);
2353  if (camera && (camera != scene->camera)) {
2354  scene->camera = camera;
2356  return true;
2357  }
2358 #else
2359  (void)scene;
2360 #endif
2361  return false;
2362 }
2363 
2364 const char *BKE_scene_find_marker_name(const Scene *scene, int frame)
2365 {
2366  const ListBase *markers = &scene->markers;
2367  const TimeMarker *m1, *m2;
2368 
2369  /* search through markers for match */
2370  for (m1 = markers->first, m2 = markers->last; m1 && m2; m1 = m1->next, m2 = m2->prev) {
2371  if (m1->frame == frame) {
2372  return m1->name;
2373  }
2374 
2375  if (m1 == m2) {
2376  break;
2377  }
2378 
2379  if (m2->frame == frame) {
2380  return m2->name;
2381  }
2382  }
2383 
2384  return NULL;
2385 }
2386 
2387 /* return the current marker for this frame,
2388  * we can have more than 1 marker per frame, this just returns the first :/ */
2389 const char *BKE_scene_find_last_marker_name(const Scene *scene, int frame)
2390 {
2391  const TimeMarker *marker, *best_marker = NULL;
2392  int best_frame = -MAXFRAME * 2;
2393  for (marker = scene->markers.first; marker; marker = marker->next) {
2394  if (marker->frame == frame) {
2395  return marker->name;
2396  }
2397 
2398  if (marker->frame > best_frame && marker->frame < frame) {
2399  best_marker = marker;
2400  best_frame = marker->frame;
2401  }
2402  }
2403 
2404  return best_marker ? best_marker->name : NULL;
2405 }
2406 
2407 int BKE_scene_frame_snap_by_seconds(Scene *scene, double interval_in_seconds, int cfra)
2408 {
2409  const int fps = round_db_to_int(FPS * interval_in_seconds);
2410  const int second_prev = cfra - mod_i(cfra, fps);
2411  const int second_next = second_prev + fps;
2412  const int delta_prev = cfra - second_prev;
2413  const int delta_next = second_next - cfra;
2414  return (delta_prev < delta_next) ? second_prev : second_next;
2415 }
2416 
2418  Scene *scene,
2419  Object *ob,
2420  const bool free_us)
2421 {
2422  /* remove rigid body constraint from world before removing object */
2423  if (ob->rigidbody_constraint) {
2424  BKE_rigidbody_remove_constraint(bmain, scene, ob, free_us);
2425  }
2426  /* remove rigid body object from world before removing object */
2427  if (ob->rigidbody_object) {
2428  BKE_rigidbody_remove_object(bmain, scene, ob, free_us);
2429  }
2430 }
2431 
2432 /* checks for cycle, returns 1 if it's all OK */
2434 {
2435  Scene *sce_iter;
2436  int a, totscene;
2437 
2438  if (sce->set == NULL) {
2439  return true;
2440  }
2441  totscene = BLI_listbase_count(&bmain->scenes);
2442 
2443  for (a = 0, sce_iter = sce; sce_iter->set; sce_iter = sce_iter->set, a++) {
2444  /* more iterations than scenes means we have a cycle */
2445  if (a > totscene) {
2446  /* the tested scene gets zero'ed, that's typically current scene */
2447  sce->set = NULL;
2448  return false;
2449  }
2450  }
2451 
2452  return true;
2453 }
2454 
2459 {
2461 }
2462 
2463 /* This function is used to obtain arbitrary fractional frames */
2464 float BKE_scene_frame_to_ctime(const Scene *scene, const float frame)
2465 {
2466  float ctime = frame;
2467  ctime += scene->r.subframe;
2468  ctime *= scene->r.framelen;
2469 
2470  return ctime;
2471 }
2475 void BKE_scene_frame_set(struct Scene *scene, double cfra)
2476 {
2477  double intpart;
2478  scene->r.subframe = modf(cfra, &intpart);
2479  scene->r.cfra = (int)intpart;
2480 }
2481 
2482 /* -------------------------------------------------------------------- */
2487 {
2488  if ((scene->orientation_slots[slot_index].flag & SELECT) == 0) {
2489  slot_index = SCE_ORIENT_DEFAULT;
2490  }
2491  return &scene->orientation_slots[slot_index];
2492 }
2493 
2495 {
2498  int slot_index = SCE_ORIENT_DEFAULT;
2500  slot_index = SCE_ORIENT_TRANSLATE;
2501  }
2502  else if (flag & V3D_GIZMO_SHOW_OBJECT_ROTATE) {
2503  slot_index = SCE_ORIENT_ROTATE;
2504  }
2505  else if (flag & V3D_GIZMO_SHOW_OBJECT_SCALE) {
2506  slot_index = SCE_ORIENT_SCALE;
2507  }
2508  return BKE_scene_orientation_slot_get(scene, slot_index);
2509 }
2510 
2518 {
2519  const bool is_custom = orientation >= V3D_ORIENT_CUSTOM;
2520  orient_slot->type = is_custom ? V3D_ORIENT_CUSTOM : orientation;
2521  orient_slot->index_custom = is_custom ? (orientation - V3D_ORIENT_CUSTOM) : -1;
2522 }
2523 
2525 {
2526  return (orient_slot->type == V3D_ORIENT_CUSTOM) ?
2527  (orient_slot->type + orient_slot->index_custom) :
2528  orient_slot->type;
2529 }
2530 
2532 {
2534  return BKE_scene_orientation_slot_get_index(orient_slot);
2535 }
2536 
2538 {
2540  return BKE_scene_orientation_slot_get_index(orient_slot);
2541 }
2542 
2546 {
2547  wmWindowManager *wm = bmain->wm.first;
2548  wmWindow *window;
2549  for (window = wm->windows.first; window != NULL; window = window->next) {
2550  const bScreen *screen = BKE_workspace_active_screen_get(window->workspace_hook);
2551  Scene *scene = window->scene;
2553 
2554  if (type->draw_engine || !type->render) {
2555  continue;
2556  }
2557 
2558  for (ScrArea *area = screen->areabase.first; area != NULL; area = area->next) {
2559  View3D *v3d = area->spacedata.first;
2560  if (area->spacetype != SPACE_VIEW3D) {
2561  continue;
2562  }
2563  if (v3d->shading.type == OB_RENDER) {
2564  return true;
2565  }
2566  }
2567  }
2568  return false;
2569 }
2570 
2571 /* TODO(campbell): shouldn't we be able to use 'DEG_get_view_layer' here?
2572  * Currently this is NULL on load, so don't. */
2573 static void prepare_mesh_for_viewport_render(Main *bmain, const ViewLayer *view_layer)
2574 {
2575  /* This is needed to prepare mesh to be used by the render
2576  * engine from the viewport rendering. We do loading here
2577  * so all the objects which shares the same mesh datablock
2578  * are nicely tagged for update and updated.
2579  *
2580  * This makes it so viewport render engine doesn't need to
2581  * call loading of the edit data for the mesh objects.
2582  */
2583 
2584  Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
2585  if (obedit) {
2586  Mesh *mesh = obedit->data;
2587  if ((obedit->type == OB_MESH) &&
2588  ((obedit->id.recalc & ID_RECALC_ALL) || (mesh->id.recalc & ID_RECALC_ALL))) {
2589  if (check_rendered_viewport_visible(bmain)) {
2590  BMesh *bm = mesh->edit_mesh->bm;
2591  BM_mesh_bm_to_me(bmain,
2592  bm,
2593  mesh,
2594  (&(struct BMeshToMeshParams){
2595  .calc_object_remap = true,
2596  .update_shapekey_indices = true,
2597  }));
2598  DEG_id_tag_update(&mesh->id, 0);
2599  }
2600  }
2601  }
2602 }
2603 
2605 {
2607  const int recalc = scene->id.recalc;
2609  if (recalc & ID_RECALC_AUDIO_SEEK) {
2610  BKE_sound_seek_scene(bmain, scene);
2611  }
2612  if (recalc & ID_RECALC_AUDIO_FPS) {
2613  BKE_sound_update_fps(bmain, scene);
2614  }
2615  if (recalc & ID_RECALC_AUDIO_VOLUME) {
2617  }
2618  if (recalc & ID_RECALC_AUDIO_MUTE) {
2619  const bool is_mute = (scene->audio.flag & AUDIO_MUTE);
2620  BKE_sound_mute_scene(scene, is_mute);
2621  }
2622  if (recalc & ID_RECALC_AUDIO_LISTENER) {
2624  }
2626 }
2627 
2629 {
2631  /* The volume is actually updated in BKE_scene_update_sound(), from either
2632  * scene_graph_update_tagged() or from BKE_scene_graph_update_for_newframe(). */
2634 }
2635 
2636 /* TODO(sergey): This actually should become view_layer_graph or so.
2637  * Same applies to update_for_newframe.
2638  *
2639  * If only_if_tagged is truth then the function will do nothing if the dependency graph is up
2640  * to date already.
2641  */
2642 static void scene_graph_update_tagged(Depsgraph *depsgraph, Main *bmain, bool only_if_tagged)
2643 {
2644  if (only_if_tagged && DEG_is_fully_evaluated(depsgraph)) {
2645  return;
2646  }
2647 
2650  bool used_multiple_passes = false;
2651 
2652  bool run_callbacks = DEG_id_type_any_updated(depsgraph);
2653  if (run_callbacks) {
2655  }
2656 
2657  for (int pass = 0; pass < 2; pass++) {
2658  /* (Re-)build dependency graph if needed. */
2660  /* Uncomment this to check if graph was properly tagged for update. */
2661  // DEG_debug_graph_relations_validate(depsgraph, bmain, scene);
2662  /* Flush editing data if needed. */
2663  prepare_mesh_for_viewport_render(bmain, view_layer);
2664  /* Update all objects: drivers, matrices, displists, etc. flags set
2665  * by depsgraph or manual, no layer check here, gets correct flushed. */
2667  /* Update sound system. */
2669  /* Notify python about depsgraph update. */
2670  if (run_callbacks) {
2673 
2674  /* It is possible that the custom callback modified scene and removed some IDs from the main
2675  * database. In this case DEG_editors_update() will crash because it iterates over all IDs
2676  * which depsgraph was built for.
2677  *
2678  * The solution is to update relations prior to this call, avoiding access to freed IDs.
2679  * Should be safe because relations update is supposed to preserve flags of all IDs which are
2680  * still a part of the dependency graph. If an ID is kicked out of the dependency graph it
2681  * should also be fine because when/if it's added to another dependency graph it will need to
2682  * be tagged for an update anyway.
2683  *
2684  * If there are no relations changed by the callback this call will do nothing. */
2686  }
2687 
2688  /* If user callback did not tag anything for update we can skip second iteration.
2689  * Otherwise we update scene once again, but without running callbacks to bring
2690  * scene to a fully evaluated state with user modifications taken into account. */
2692  break;
2693  }
2694 
2695  /* Clear recalc flags for second pass, but back them up for editors update. */
2696  const bool backup = true;
2698  used_multiple_passes = true;
2699  run_callbacks = false;
2700  }
2701 
2702  /* Inform editors about changes, using recalc flags from both passes. */
2703  if (used_multiple_passes) {
2705  }
2706  const bool is_time_update = false;
2707  DEG_editors_update(depsgraph, is_time_update);
2708 
2709  const bool backup = false;
2711 }
2712 
2714 {
2715  scene_graph_update_tagged(depsgraph, bmain, false);
2716 }
2717 
2719 {
2720  scene_graph_update_tagged(depsgraph, bmain, true);
2721 }
2722 
2723 /* applies changes right away, does all sets too */
2725 {
2727  Main *bmain = DEG_get_bmain(depsgraph);
2728  bool used_multiple_passes = false;
2729 
2730  /* Keep this first. */
2732 
2733  for (int pass = 0; pass < 2; pass++) {
2734  /* Update animated image textures for particles, modifiers, gpu, etc,
2735  * call this at the start so modifiers with textures don't lag 1 frame.
2736  */
2740  /* Update all objects: drivers, matrices, displists, etc. flags set
2741  * by depgraph or manual, no layer check here, gets correct flushed.
2742  *
2743  * NOTE: Only update for new frame on first iteration. Second iteration is for ensuring user
2744  * edits from callback are properly taken into account. Doing a time update on those would
2745  * lose any possible unkeyed changes made by the handler. */
2746  if (pass == 0) {
2747  const float ctime = BKE_scene_frame_get(scene);
2749  }
2750  else {
2752  }
2753  /* Update sound system animation. */
2755 
2756  /* Notify editors and python about recalc. */
2757  if (pass == 0) {
2759 
2760  /* NOTE: Similar to this case in scene_graph_update_tagged(). Need to ensure that
2761  * DEG_editors_update() doesn't access freed memory of possibly removed ID. */
2763  }
2764 
2765  /* If user callback did not tag anything for update we can skip second iteration.
2766  * Otherwise we update scene once again, but without running callbacks to bring
2767  * scene to a fully evaluated state with user modifications taken into account. */
2769  break;
2770  }
2771 
2772  /* Clear recalc flags for second pass, but back them up for editors update. */
2773  const bool backup = true;
2775  used_multiple_passes = true;
2776  }
2777 
2778  /* Inform editors about changes, using recalc flags from both passes. */
2779  if (used_multiple_passes) {
2781  }
2782 
2783  const bool is_time_update = true;
2784  DEG_editors_update(depsgraph, is_time_update);
2785 
2786  /* Clear recalc flags, can be skipped for e.g. renderers that will read these
2787  * and clear the flags later. */
2788  if (clear_recalc) {
2789  const bool backup = false;
2791  }
2792 }
2793 
2795 {
2797 }
2798 
2806 {
2807  Depsgraph *depsgraph = BKE_scene_ensure_depsgraph(bmain, scene, view_layer);
2810 }
2811 
2812 /* return default view */
2814 {
2815  SceneRenderView *srv;
2816 
2817  if (!name) {
2818  name = DATA_("RenderView");
2819  }
2820 
2821  srv = MEM_callocN(sizeof(SceneRenderView), "new render view");
2822  BLI_strncpy(srv->name, name, sizeof(srv->name));
2823  BLI_uniquename(&sce->r.views,
2824  srv,
2825  DATA_("RenderView"),
2826  '.',
2827  offsetof(SceneRenderView, name),
2828  sizeof(srv->name));
2829  BLI_addtail(&sce->r.views, srv);
2830 
2831  return srv;
2832 }
2833 
2835 {
2836  const int act = BLI_findindex(&scene->r.views, srv);
2837 
2838  if (act == -1) {
2839  return false;
2840  }
2841  if (scene->r.views.first == scene->r.views.last) {
2842  /* ensure 1 view is kept */
2843  return false;
2844  }
2845 
2846  BLI_remlink(&scene->r.views, srv);
2847  MEM_freeN(srv);
2848 
2849  scene->r.actview = 0;
2850 
2851  return true;
2852 }
2853 
2854 /* render simplification */
2855 
2856 int get_render_subsurf_level(const RenderData *r, int lvl, bool for_render)
2857 {
2858  if (r->mode & R_SIMPLIFY) {
2859  if (for_render) {
2860  return min_ii(r->simplify_subsurf_render, lvl);
2861  }
2862 
2863  return min_ii(r->simplify_subsurf, lvl);
2864  }
2865 
2866  return lvl;
2867 }
2868 
2869 int get_render_child_particle_number(const RenderData *r, int num, bool for_render)
2870 {
2871  if (r->mode & R_SIMPLIFY) {
2872  if (for_render) {
2873  return (int)(r->simplify_particles_render * num);
2874  }
2875 
2876  return (int)(r->simplify_particles * num);
2877  }
2878 
2879  return num;
2880 }
2881 
2888 Base *_setlooper_base_step(Scene **sce_iter, ViewLayer *view_layer, Base *base)
2889 {
2890  if (base && base->next) {
2891  /* Common case, step to the next. */
2892  return base->next;
2893  }
2894  if ((base == NULL) && (view_layer != NULL)) {
2895  /* First time looping, return the scenes first base. */
2896  /* For the first loop we should get the layer from workspace when available. */
2897  if (view_layer->object_bases.first) {
2898  return (Base *)view_layer->object_bases.first;
2899  }
2900  /* No base on this scene layer. */
2901  goto next_set;
2902  }
2903  else {
2904  next_set:
2905  /* Reached the end, get the next base in the set. */
2906  while ((*sce_iter = (*sce_iter)->set)) {
2907  ViewLayer *view_layer_set = BKE_view_layer_default_render((*sce_iter));
2908  base = (Base *)view_layer_set->object_bases.first;
2909 
2910  if (base) {
2911  return base;
2912  }
2913  }
2914  }
2915 
2916  return NULL;
2917 }
2918 
2920 {
2922  return (type && type->flag & RE_USE_SHADING_NODES_CUSTOM);
2923 }
2924 
2926 {
2928  return (type && type->flag & RE_USE_SPHERICAL_STEREO);
2929 }
2930 
2932 {
2934 }
2935 
2937 {
2939 }
2940 
2942 {
2944 }
2945 
2947 {
2948  Base *base = view_layer->object_bases.first;
2949 
2950  while (base) {
2952  base = base->next;
2953  }
2954 }
2955 
2967 {
2968  Object *ob = base->object;
2969  ob->base_flag = base->flag;
2970 }
2971 
2973 {
2974  ColorManagedDisplaySettings *display_settings = &scene->display_settings;
2975  ColorManagedViewSettings *view_settings = &scene->view_settings;
2976  const char *view;
2977  const char *none_display_name;
2978 
2979  none_display_name = IMB_colormanagement_display_get_none_name();
2980 
2981  BLI_strncpy(display_settings->display_device,
2982  none_display_name,
2983  sizeof(display_settings->display_device));
2984 
2986 
2987  if (view) {
2988  BLI_strncpy(view_settings->view_transform, view, sizeof(view_settings->view_transform));
2989  }
2990 }
2991 
2993 {
2994  return !STREQ(scene->display_settings.display_device, "None");
2995 }
2996 
2998 {
3001 }
3002 
3004 {
3005  int threads;
3006 
3007  /* override set from command line? */
3009 
3010  if (threads > 0) {
3011  return threads;
3012  }
3013 
3014  /* fixed number of threads specified in scene? */
3015  if (rd->mode & R_FIXED_THREADS) {
3016  threads = rd->threads;
3017  }
3018  else {
3020  }
3021 
3022  return max_ii(threads, 1);
3023 }
3024 
3026 {
3027  return BKE_render_num_threads(&scene->r);
3028 }
3029 
3031 {
3032  if (r->preview_pixel_size == 0) {
3033  return (U.pixelsize > 1.5f) ? 2 : 1;
3034  }
3035  return r->preview_pixel_size;
3036 }
3037 
3042 double BKE_scene_unit_scale(const UnitSettings *unit, const int unit_type, double value)
3043 {
3044  if (unit->system == USER_UNIT_NONE) {
3045  /* Never apply scale_length when not using a unit setting! */
3046  return value;
3047  }
3048 
3049  switch (unit_type) {
3050  case B_UNIT_LENGTH:
3051  case B_UNIT_VELOCITY:
3052  case B_UNIT_ACCELERATION:
3053  return value * (double)unit->scale_length;
3054  case B_UNIT_AREA:
3055  case B_UNIT_POWER:
3056  return value * pow(unit->scale_length, 2);
3057  case B_UNIT_VOLUME:
3058  return value * pow(unit->scale_length, 3);
3059  case B_UNIT_MASS:
3060  return value * pow(unit->scale_length, 3);
3061  case B_UNIT_CAMERA: /* *Do not* use scene's unit scale for camera focal lens! See T42026. */
3062  default:
3063  return value;
3064  }
3065 }
3066 
3067 /******************** multiview *************************/
3068 
3070 {
3071  SceneRenderView *srv;
3072  int totviews = 0;
3073 
3074  if ((rd->scemode & R_MULTIVIEW) == 0) {
3075  return 1;
3076  }
3077 
3079  srv = BLI_findstring(&rd->views, STEREO_LEFT_NAME, offsetof(SceneRenderView, name));
3080  if ((srv && srv->viewflag & SCE_VIEW_DISABLE) == 0) {
3081  totviews++;
3082  }
3083 
3084  srv = BLI_findstring(&rd->views, STEREO_RIGHT_NAME, offsetof(SceneRenderView, name));
3085  if ((srv && srv->viewflag & SCE_VIEW_DISABLE) == 0) {
3086  totviews++;
3087  }
3088  }
3089  else {
3090  for (srv = rd->views.first; srv; srv = srv->next) {
3091  if ((srv->viewflag & SCE_VIEW_DISABLE) == 0) {
3092  totviews++;
3093  }
3094  }
3095  }
3096  return totviews;
3097 }
3098 
3100 {
3101  SceneRenderView *srv[2];
3102 
3103  if ((rd->scemode & R_MULTIVIEW) == 0) {
3104  return false;
3105  }
3106 
3107  srv[0] = (SceneRenderView *)BLI_findstring(
3108  &rd->views, STEREO_LEFT_NAME, offsetof(SceneRenderView, name));
3109  srv[1] = (SceneRenderView *)BLI_findstring(
3110  &rd->views, STEREO_RIGHT_NAME, offsetof(SceneRenderView, name));
3111 
3112  return (srv[0] && ((srv[0]->viewflag & SCE_VIEW_DISABLE) == 0) && srv[1] &&
3113  ((srv[1]->viewflag & SCE_VIEW_DISABLE) == 0));
3114 }
3115 
3116 /* return whether to render this SceneRenderView */
3118 {
3119  if (srv == NULL) {
3120  return false;
3121  }
3122 
3123  if ((rd->scemode & R_MULTIVIEW) == 0) {
3124  return false;
3125  }
3126 
3127  if ((srv->viewflag & SCE_VIEW_DISABLE)) {
3128  return false;
3129  }
3130 
3132  return true;
3133  }
3134 
3135  /* SCE_VIEWS_SETUP_BASIC */
3137  return true;
3138  }
3139 
3140  return false;
3141 }
3142 
3143 /* return true if viewname is the first or if the name is NULL or not found */
3144 bool BKE_scene_multiview_is_render_view_first(const RenderData *rd, const char *viewname)
3145 {
3146  SceneRenderView *srv;
3147 
3148  if ((rd->scemode & R_MULTIVIEW) == 0) {
3149  return true;
3150  }
3151 
3152  if ((!viewname) || (!viewname[0])) {
3153  return true;
3154  }
3155 
3156  for (srv = rd->views.first; srv; srv = srv->next) {
3158  return STREQ(viewname, srv->name);
3159  }
3160  }
3161 
3162  return true;
3163 }
3164 
3165 /* return true if viewname is the last or if the name is NULL or not found */
3166 bool BKE_scene_multiview_is_render_view_last(const RenderData *rd, const char *viewname)
3167 {
3168  SceneRenderView *srv;
3169 
3170  if ((rd->scemode & R_MULTIVIEW) == 0) {
3171  return true;
3172  }
3173 
3174  if ((!viewname) || (!viewname[0])) {
3175  return true;
3176  }
3177 
3178  for (srv = rd->views.last; srv; srv = srv->prev) {
3180  return STREQ(viewname, srv->name);
3181  }
3182  }
3183 
3184  return true;
3185 }
3186 
3188 {
3189  SceneRenderView *srv;
3190  size_t nr;
3191 
3192  if ((rd->scemode & R_MULTIVIEW) == 0) {
3193  return NULL;
3194  }
3195 
3196  for (srv = rd->views.first, nr = 0; srv; srv = srv->next) {
3198  if (nr++ == view_id) {
3199  return srv;
3200  }
3201  }
3202  }
3203  return srv;
3204 }
3205 
3206 const char *BKE_scene_multiview_render_view_name_get(const RenderData *rd, const int view_id)
3207 {
3209 
3210  if (srv) {
3211  return srv->name;
3212  }
3213 
3214  return "";
3215 }
3216 
3217 int BKE_scene_multiview_view_id_get(const RenderData *rd, const char *viewname)
3218 {
3219  SceneRenderView *srv;
3220  size_t nr;
3221 
3222  if ((!rd) || ((rd->scemode & R_MULTIVIEW) == 0)) {
3223  return 0;
3224  }
3225 
3226  if ((!viewname) || (!viewname[0])) {
3227  return 0;
3228  }
3229 
3230  for (srv = rd->views.first, nr = 0; srv; srv = srv->next) {
3232  if (STREQ(viewname, srv->name)) {
3233  return nr;
3234  }
3235 
3236  nr += 1;
3237  }
3238  }
3239 
3240  return 0;
3241 }
3242 
3243 void BKE_scene_multiview_filepath_get(SceneRenderView *srv, const char *filepath, char *r_filepath)
3244 {
3245  BLI_strncpy(r_filepath, filepath, FILE_MAX);
3246  BLI_path_suffix(r_filepath, FILE_MAX, srv->suffix, "");
3247 }
3248 
3256  const char *filepath,
3257  const char *viewname,
3258  char *r_filepath)
3259 {
3260  SceneRenderView *srv;
3261  char suffix[FILE_MAX];
3262 
3263  srv = BLI_findstring(&rd->views, viewname, offsetof(SceneRenderView, name));
3264  if (srv) {
3265  BLI_strncpy(suffix, srv->suffix, sizeof(suffix));
3266  }
3267  else {
3268  BLI_strncpy(suffix, viewname, sizeof(suffix));
3269  }
3270 
3271  BLI_strncpy(r_filepath, filepath, FILE_MAX);
3272  BLI_path_suffix(r_filepath, FILE_MAX, suffix, "");
3273 }
3274 
3275 const char *BKE_scene_multiview_view_suffix_get(const RenderData *rd, const char *viewname)
3276 {
3277  SceneRenderView *srv;
3278 
3279  if ((viewname == NULL) || (viewname[0] == '\0')) {
3280  return viewname;
3281  }
3282 
3283  srv = BLI_findstring(&rd->views, viewname, offsetof(SceneRenderView, name));
3284  if (srv) {
3285  return srv->suffix;
3286  }
3287 
3288  return viewname;
3289 }
3290 
3291 const char *BKE_scene_multiview_view_id_suffix_get(const RenderData *rd, const int view_id)
3292 {
3293  if ((rd->scemode & R_MULTIVIEW) == 0) {
3294  return "";
3295  }
3296 
3297  const char *viewname = BKE_scene_multiview_render_view_name_get(rd, view_id);
3298  return BKE_scene_multiview_view_suffix_get(rd, viewname);
3299 }
3300 
3302  const char *name,
3303  char *r_prefix,
3304  const char **r_ext)
3305 {
3306  SceneRenderView *srv;
3307  size_t index_act;
3308  const char *suf_act;
3309  const char delims[] = {'.', '\0'};
3310 
3311  r_prefix[0] = '\0';
3312 
3313  /* begin of extension */
3314  index_act = BLI_str_rpartition(name, delims, r_ext, &suf_act);
3315  if (*r_ext == NULL) {
3316  return;
3317  }
3318  BLI_assert(index_act > 0);
3319  UNUSED_VARS_NDEBUG(index_act);
3320 
3321  for (srv = scene->r.views.first; srv; srv = srv->next) {
3323  const size_t len = strlen(srv->suffix);
3324  const size_t ext_len = strlen(*r_ext);
3325  if (ext_len >= len && STREQLEN(*r_ext - len, srv->suffix, len)) {
3326  BLI_strncpy(r_prefix, name, strlen(name) - ext_len - len + 1);
3327  break;
3328  }
3329  }
3330  }
3331 }
3332 
3334  const size_t width,
3335  const size_t height,
3336  size_t *r_width,
3337  size_t *r_height)
3338 {
3342  width,
3343  height,
3344  r_width,
3345  r_height);
3346  }
3347  else {
3348  *r_width = width;
3349  *r_height = height;
3350  }
3351 }
3352 
3354 {
3355  if (BKE_imtype_is_movie(rd->im_format.imtype) == false) {
3356  return 0;
3357  }
3358 
3359  if ((rd->scemode & R_MULTIVIEW) == 0) {
3360  return 1;
3361  }
3362 
3364  return 1;
3365  }
3366 
3367  /* R_IMF_VIEWS_INDIVIDUAL */
3369 }
3370 
3371 /* Manipulation of depsgraph storage. */
3372 
3373 /* This is a key which identifies depsgraph. */
3374 typedef struct DepsgraphKey {
3376  /* TODO(sergey): Need to include window somehow (same layer might be in a
3377  * different states in different windows).
3378  */
3380 
3381 static unsigned int depsgraph_key_hash(const void *key_v)
3382 {
3383  const DepsgraphKey *key = key_v;
3384  unsigned int hash = BLI_ghashutil_ptrhash(key->view_layer);
3385  /* TODO(sergey): Include hash from other fields in the key. */
3386  return hash;
3387 }
3388 
3389 static bool depsgraph_key_compare(const void *key_a_v, const void *key_b_v)
3390 {
3391  const DepsgraphKey *key_a = key_a_v;
3392  const DepsgraphKey *key_b = key_b_v;
3393  /* TODO(sergey): Compare rest of */
3394  return !(key_a->view_layer == key_b->view_layer);
3395 }
3396 
3397 static void depsgraph_key_free(void *key_v)
3398 {
3399  DepsgraphKey *key = key_v;
3400  MEM_freeN(key);
3401 }
3402 
3403 static void depsgraph_key_value_free(void *value)
3404 {
3405  Depsgraph *depsgraph = value;
3407 }
3408 
3410 {
3412  depsgraph_key_hash, depsgraph_key_compare, "Scene Depsgraph Hash");
3413 }
3414 
3416 {
3417  if (scene->depsgraph_hash == NULL) {
3419  }
3420 }
3421 
3423 {
3424  if (scene->depsgraph_hash == NULL) {
3425  return;
3426  }
3429 }
3430 
3432 {
3433  if (scene->depsgraph_hash != NULL) {
3434  DepsgraphKey key = {view_layer};
3436  }
3437 }
3438 
3439 /* Query depsgraph for a specific contexts. */
3440 
3442  ViewLayer *view_layer,
3443  const bool allocate_ghash_entry)
3444 {
3445  /* bmain may be NULL here! */
3446  BLI_assert(scene != NULL);
3447  BLI_assert(view_layer != NULL);
3449 
3450  /* Make sure hash itself exists. */
3451  if (allocate_ghash_entry) {
3453  }
3454  if (scene->depsgraph_hash == NULL) {
3455  return NULL;
3456  }
3457 
3458  DepsgraphKey key;
3459  key.view_layer = view_layer;
3460 
3461  Depsgraph **depsgraph_ptr;
3462  if (!allocate_ghash_entry) {
3463  depsgraph_ptr = (Depsgraph **)BLI_ghash_lookup_p(scene->depsgraph_hash, &key);
3464  return depsgraph_ptr;
3465  }
3466 
3467  DepsgraphKey **key_ptr;
3469  scene->depsgraph_hash, &key, (void ***)&key_ptr, (void ***)&depsgraph_ptr)) {
3470  return depsgraph_ptr;
3471  }
3472 
3473  /* Depsgraph was not found in the ghash, but the key still needs allocating. */
3474  *key_ptr = MEM_mallocN(sizeof(DepsgraphKey), __func__);
3475  **key_ptr = key;
3476 
3477  *depsgraph_ptr = NULL;
3478  return depsgraph_ptr;
3479 }
3480 
3482 {
3483  BLI_assert(bmain != NULL);
3484 
3485  Depsgraph **depsgraph_ptr = scene_get_depsgraph_p(scene, view_layer, true);
3486  if (depsgraph_ptr == NULL) {
3487  /* The scene has no depsgraph hash. */
3488  return NULL;
3489  }
3490  if (*depsgraph_ptr != NULL) {
3491  /* The depsgraph was found, no need to allocate. */
3492  return depsgraph_ptr;
3493  }
3494 
3495  /* Allocate a new depsgraph. scene_get_depsgraph_p() already ensured that the pointer is stored
3496  * in the scene's depsgraph hash. */
3497  *depsgraph_ptr = DEG_graph_new(bmain, scene, view_layer, DAG_EVAL_VIEWPORT);
3498 
3499  /* TODO(sergey): Would be cool to avoid string format print,
3500  * but is a bit tricky because we can't know in advance whether
3501  * we will ever enable debug messages for this depsgraph.
3502  */
3503  char name[1024];
3504  BLI_snprintf(name, sizeof(name), "%s :: %s", scene->id.name, view_layer->name);
3505  DEG_debug_name_set(*depsgraph_ptr, name);
3506 
3507  /* These viewport depsgraphs communicate changes to the editors. */
3508  DEG_enable_editors_update(*depsgraph_ptr);
3509 
3510  return depsgraph_ptr;
3511 }
3512 
3514 {
3516 
3517  if (scene->depsgraph_hash == NULL) {
3518  return NULL;
3519  }
3520 
3521  DepsgraphKey key;
3522  key.view_layer = view_layer;
3523  return BLI_ghash_lookup(scene->depsgraph_hash, &key);
3524 }
3525 
3527 {
3528  Depsgraph **depsgraph_ptr = scene_ensure_depsgraph_p(bmain, scene, view_layer);
3529  return (depsgraph_ptr != NULL) ? *depsgraph_ptr : NULL;
3530 }
3531 
3532 static char *scene_undo_depsgraph_gen_key(Scene *scene, ViewLayer *view_layer, char *key_full)
3533 {
3534  if (key_full == NULL) {
3535  key_full = MEM_callocN(MAX_ID_NAME + FILE_MAX + MAX_NAME, __func__);
3536  }
3537 
3538  size_t key_full_offset = BLI_strncpy_rlen(key_full, scene->id.name, MAX_ID_NAME);
3539  if (scene->id.lib != NULL) {
3540  key_full_offset += BLI_strncpy_rlen(
3541  key_full + key_full_offset, scene->id.lib->filepath, FILE_MAX);
3542  }
3543  key_full_offset += BLI_strncpy_rlen(key_full + key_full_offset, view_layer->name, MAX_NAME);
3544  BLI_assert(key_full_offset < MAX_ID_NAME + FILE_MAX + MAX_NAME);
3545 
3546  return key_full;
3547 }
3548 
3550 {
3551  GHash *depsgraph_extract = BLI_ghash_new(
3553 
3554  for (Scene *scene = bmain->scenes.first; scene != NULL; scene = scene->id.next) {
3555  if (scene->depsgraph_hash == NULL) {
3556  /* In some cases, e.g. when undo has to perform multiple steps at once, no depsgraph will
3557  * be built so this pointer may be NULL. */
3558  continue;
3559  }
3560  for (ViewLayer *view_layer = scene->view_layers.first; view_layer != NULL;
3561  view_layer = view_layer->next) {
3562  DepsgraphKey key;
3563  key.view_layer = view_layer;
3565 
3566  if (depsgraph != NULL && *depsgraph != NULL) {
3567  char *key_full = scene_undo_depsgraph_gen_key(scene, view_layer, NULL);
3568 
3569  /* We steal the depsgraph from the scene. */
3570  BLI_ghash_insert(depsgraph_extract, key_full, *depsgraph);
3571  *depsgraph = NULL;
3572  }
3573  }
3574  }
3575 
3576  return depsgraph_extract;
3577 }
3578 
3579 void BKE_scene_undo_depsgraphs_restore(Main *bmain, GHash *depsgraph_extract)
3580 {
3581  for (Scene *scene = bmain->scenes.first; scene != NULL; scene = scene->id.next) {
3582  for (ViewLayer *view_layer = scene->view_layers.first; view_layer != NULL;
3583  view_layer = view_layer->next) {
3584  char key_full[MAX_ID_NAME + FILE_MAX + MAX_NAME] = {0};
3585  scene_undo_depsgraph_gen_key(scene, view_layer, key_full);
3586 
3587  Depsgraph **depsgraph_extract_ptr = (Depsgraph **)BLI_ghash_lookup_p(depsgraph_extract,
3588  key_full);
3589  if (depsgraph_extract_ptr == NULL) {
3590  continue;
3591  }
3592  BLI_assert(*depsgraph_extract_ptr != NULL);
3593 
3594  Depsgraph **depsgraph_scene_ptr = scene_get_depsgraph_p(scene, view_layer, true);
3595  BLI_assert(depsgraph_scene_ptr != NULL);
3596  BLI_assert(*depsgraph_scene_ptr == NULL);
3597 
3598  /* We steal the depsgraph back from our 'extract' storage to the scene. */
3599  Depsgraph *depsgraph = *depsgraph_extract_ptr;
3600 
3601  DEG_graph_replace_owners(depsgraph, bmain, scene, view_layer);
3602 
3604 
3605  *depsgraph_scene_ptr = depsgraph;
3606  *depsgraph_extract_ptr = NULL;
3607  }
3608  }
3609 
3610  BLI_ghash_free(depsgraph_extract, MEM_freeN, depsgraph_key_value_free);
3611 }
3612 
3613 /* -------------------------------------------------------------------- */
3618 {
3619  const int orientation_index = BKE_scene_transform_orientation_get_index(scene, orientation);
3620 
3621  for (int i = 0; i < ARRAY_SIZE(scene->orientation_slots); i++) {
3622  TransformOrientationSlot *orient_slot = &scene->orientation_slots[i];
3623  if (orient_slot->index_custom == orientation_index) {
3624  /* could also use orientation_index-- */
3625  orient_slot->type = V3D_ORIENT_GLOBAL;
3626  orient_slot->index_custom = -1;
3627  }
3628  else if (orient_slot->index_custom > orientation_index) {
3629  BLI_assert(orient_slot->type == V3D_ORIENT_CUSTOM);
3630  orient_slot->index_custom--;
3631  }
3632  }
3633 
3634  BLI_freelinkN(&scene->transform_spaces, orientation);
3635 }
3636 
3638 {
3639  return BLI_findlink(&scene->transform_spaces, index);
3640 }
3641 
3647  const TransformOrientation *orientation)
3648 {
3649  return BLI_findindex(&scene->transform_spaces, orientation);
3650 }
3651 
3654 /* -------------------------------------------------------------------- */
3660 void BKE_scene_cursor_rot_to_mat3(const View3DCursor *cursor, float mat[3][3])
3661 {
3662  if (cursor->rotation_mode > 0) {
3663  eulO_to_mat3(mat, cursor->rotation_euler, cursor->rotation_mode);
3664  }
3665  else if (cursor->rotation_mode == ROT_MODE_AXISANGLE) {
3666  axis_angle_to_mat3(mat, cursor->rotation_axis, cursor->rotation_angle);
3667  }
3668  else {
3669  float tquat[4];
3670  normalize_qt_qt(tquat, cursor->rotation_quaternion);
3671  quat_to_mat3(mat, tquat);
3672  }
3673 }
3674 
3675 void BKE_scene_cursor_rot_to_quat(const View3DCursor *cursor, float quat[4])
3676 {
3677  if (cursor->rotation_mode > 0) {
3678  eulO_to_quat(quat, cursor->rotation_euler, cursor->rotation_mode);
3679  }
3680  else if (cursor->rotation_mode == ROT_MODE_AXISANGLE) {
3681  axis_angle_to_quat(quat, cursor->rotation_axis, cursor->rotation_angle);
3682  }
3683  else {
3684  normalize_qt_qt(quat, cursor->rotation_quaternion);
3685  }
3686 }
3687 
3688 void BKE_scene_cursor_mat3_to_rot(View3DCursor *cursor, const float mat[3][3], bool use_compat)
3689 {
3690  BLI_ASSERT_UNIT_M3(mat);
3691 
3692  switch (cursor->rotation_mode) {
3693  case ROT_MODE_QUAT: {
3694  float quat[4];
3695  mat3_normalized_to_quat(quat, mat);
3696  if (use_compat) {
3697  float quat_orig[4];
3698  copy_v4_v4(quat_orig, cursor->rotation_quaternion);
3699  quat_to_compatible_quat(cursor->rotation_quaternion, quat, quat_orig);
3700  }
3701  else {
3702  copy_v4_v4(cursor->rotation_quaternion, quat);
3703  }
3704  break;
3705  }
3706  case ROT_MODE_AXISANGLE: {
3707  mat3_to_axis_angle(cursor->rotation_axis, &cursor->rotation_angle, mat);
3708  break;
3709  }
3710  default: {
3711  if (use_compat) {
3713  cursor->rotation_euler, cursor->rotation_euler, cursor->rotation_mode, mat);
3714  }
3715  else {
3716  mat3_to_eulO(cursor->rotation_euler, cursor->rotation_mode, mat);
3717  }
3718  break;
3719  }
3720  }
3721 }
3722 
3723 void BKE_scene_cursor_quat_to_rot(View3DCursor *cursor, const float quat[4], bool use_compat)
3724 {
3725  BLI_ASSERT_UNIT_QUAT(quat);
3726 
3727  switch (cursor->rotation_mode) {
3728  case ROT_MODE_QUAT: {
3729  if (use_compat) {
3730  float quat_orig[4];
3731  copy_v4_v4(quat_orig, cursor->rotation_quaternion);
3732  quat_to_compatible_quat(cursor->rotation_quaternion, quat, quat_orig);
3733  }
3734  else {
3735  copy_qt_qt(cursor->rotation_quaternion, quat);
3736  }
3737  break;
3738  }
3739  case ROT_MODE_AXISANGLE: {
3740  quat_to_axis_angle(cursor->rotation_axis, &cursor->rotation_angle, quat);
3741  break;
3742  }
3743  default: {
3744  if (use_compat) {
3746  cursor->rotation_euler, cursor->rotation_euler, cursor->rotation_mode, quat);
3747  }
3748  else {
3749  quat_to_eulO(cursor->rotation_euler, cursor->rotation_mode, quat);
3750  }
3751  break;
3752  }
3753  }
3754 }
3755 
3756 void BKE_scene_cursor_to_mat4(const View3DCursor *cursor, float mat[4][4])
3757 {
3758  float mat3[3][3];
3759  BKE_scene_cursor_rot_to_mat3(cursor, mat3);
3760  copy_m4_m3(mat, mat3);
3761  copy_v3_v3(mat[3], cursor->location);
3762 }
3763 
3764 void BKE_scene_cursor_from_mat4(View3DCursor *cursor, const float mat[4][4], bool use_compat)
3765 {
3766  float mat3[3][3];
3767  copy_m3_m4(mat3, mat);
3768  BKE_scene_cursor_mat3_to_rot(cursor, mat3, use_compat);
3769  copy_v3_v3(cursor->location, mat[3]);
3770 }
3771 
3774 /* Dependency graph evaluation. */
3775 
3777 {
3778  if (scene->sound_scene == NULL) {
3779  return;
3780  }
3781  Sequence *seq;
3782  SEQ_ALL_BEGIN (scene->ed, seq) {
3783  if (seq->scene_sound != NULL) {
3785  seq->scene_sound = NULL;
3786  }
3787  }
3788  SEQ_ALL_END;
3789 }
3790 
3792 {
3794  if (scene->ed == NULL) {
3795  return;
3796  }
3798  Sequence *seq;
3799  SEQ_ALL_BEGIN (scene->ed, seq) {
3800  if (seq->scene_sound == NULL) {
3801  if (seq->sound != NULL) {
3802  if (seq->scene_sound == NULL) {
3804  }
3805  }
3806  else if (seq->type == SEQ_TYPE_SCENE) {
3807  if (seq->scene != NULL) {
3810  }
3811  }
3812  }
3813  if (seq->scene_sound != NULL) {
3814  /* Make sure changing volume via sequence's properties panel works correct.
3815  *
3816  * Ideally, the entire BKE_scene_update_sound() will happen from a dependency graph, so
3817  * then it is no longer needed to do such manual forced updates. */
3818  if (seq->type == SEQ_TYPE_SCENE && seq->scene != NULL) {
3820  if ((seq->flag & SEQ_SCENE_STRIPS) == 0) {
3822  }
3823  }
3824  if (seq->sound != NULL) {
3827  }
3828  }
3830  seq->scene_sound, seq->volume, (seq->flag & SEQ_AUDIO_VOLUME_ANIMATED) != 0);
3832  seq->scene_sound, seq->pitch, (seq->flag & SEQ_AUDIO_PITCH_ANIMATED) != 0);
3834  seq->scene_sound, seq->pan, (seq->flag & SEQ_AUDIO_PAN_ANIMATED) != 0);
3835  }
3836  }
3837  SEQ_ALL_END;
3840 }
typedef float(TangentPoint)[2]
Blender kernel action and pose functionality.
void action_groups_remove_channel(struct bAction *act, struct FCurve *fcu)
Definition: action.c:538
struct AnimData * BKE_animdata_from_id(struct ID *id)
Definition: anim_data.c:96
void BKE_animdata_blend_read_data(struct BlendDataReader *reader, struct AnimData *adt)
Definition: anim_data.c:1574
void BKE_animdata_duplicate_id_action(struct Main *bmain, struct ID *id, const uint duplicate_flags)
void BKE_animdata_blend_write(struct BlendWriter *writer, struct AnimData *adt)
Definition: anim_data.c:1552
void BKE_keyingsets_free(struct ListBase *list)
Definition: anim_sys.c:304
void BKE_keyingsets_copy(struct ListBase *newlist, const struct ListBase *list)
void BKE_keyingsets_blend_read_lib(struct BlendLibReader *reader, struct ID *id, struct ListBase *list)
Definition: anim_sys.c:354
void BKE_keyingsets_blend_read_data(struct BlendDataReader *reader, struct ListBase *list)
Definition: anim_sys.c:341
void BKE_keyingsets_blend_write(struct BlendWriter *writer, struct ListBase *list)
Definition: anim_sys.c:323
void BKE_keyingsets_foreach_id(struct LibraryForeachIDData *data, const struct ListBase *keyingsets)
void BKE_keyingsets_blend_read_expand(struct BlendExpander *expander, struct ListBase *list)
Definition: anim_sys.c:363
void BKE_callback_exec_id_depsgraph(struct Main *bmain, struct ID *id, struct Depsgraph *depsgraph, eCbEvent evt)
Definition: callbacks.c:61
@ BKE_CB_EVT_DEPSGRAPH_UPDATE_PRE
Definition: BKE_callbacks.h:57
@ BKE_CB_EVT_FRAME_CHANGE_PRE
Definition: BKE_callbacks.h:40
@ BKE_CB_EVT_FRAME_CHANGE_POST
Definition: BKE_callbacks.h:41
@ BKE_CB_EVT_DEPSGRAPH_UPDATE_POST
Definition: BKE_callbacks.h:58
void BKE_callback_exec_id(struct Main *bmain, struct ID *id, eCbEvent evt)
Definition: callbacks.c:51
void BKE_collection_compat_blend_read_lib(struct BlendLibReader *reader, struct Library *lib, struct SceneCollection *sc)
void BKE_collection_compat_blend_read_expand(struct BlendExpander *expander, struct SceneCollection *sc)
void BKE_collection_compat_blend_read_data(struct BlendDataReader *reader, struct SceneCollection *sc)
struct Collection * BKE_collection_master_add(void)
Definition: collection.c:892
void BKE_collection_free(struct Collection *collection)
Definition: collection.c:510
void BKE_collection_blend_write_nolib(struct BlendWriter *writer, struct Collection *collection)
Definition: collection.c:197
struct Collection * BKE_collection_duplicate(struct Main *bmain, struct Collection *parent, struct Collection *collection, const uint duplicate_flags, const uint duplicate_options)
void BKE_color_managed_display_settings_copy(struct ColorManagedDisplaySettings *new_settings, const struct ColorManagedDisplaySettings *settings)
void BKE_color_managed_colorspace_settings_copy(struct ColorManagedColorspaceSettings *colorspace_settings, const struct ColorManagedColorspaceSettings *settings)
void BKE_curvemapping_free_data(struct CurveMapping *cumap)
Definition: colortools.c:99
void BKE_curvemapping_init(struct CurveMapping *cumap)
Definition: colortools.c:1200
void BKE_curvemapping_set_defaults(struct CurveMapping *cumap, int tot, float minx, float miny, float maxx, float maxy)
Definition: colortools.c:53
struct CurveMapping * BKE_curvemapping_copy(const struct CurveMapping *cumap)
void BKE_color_managed_view_settings_blend_read_data(struct BlendDataReader *reader, struct ColorManagedViewSettings *settings)
Definition: colortools.c:1836
void BKE_curvemapping_blend_read(struct BlendDataReader *reader, struct CurveMapping *cumap)
Definition: colortools.c:1252
void BKE_curvemapping_curves_blend_write(struct BlendWriter *writer, const struct CurveMapping *cumap)
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_color_managed_view_settings_blend_write(struct BlendWriter *writer, struct ColorManagedViewSettings *settings)
Definition: colortools.c:1828
void BKE_color_managed_view_settings_copy(struct ColorManagedViewSettings *new_settings, const struct ColorManagedViewSettings *settings)
void BKE_curvemapping_blend_write(struct BlendWriter *writer, const struct CurveMapping *cumap)
void BKE_color_managed_view_settings_init_render(struct ColorManagedViewSettings *settings, const struct ColorManagedDisplaySettings *display_settings, const char *view_transform)
void BKE_color_managed_display_settings_init(struct ColorManagedDisplaySettings *settings)
Definition: colortools.c:1753
void BKE_curvemapping_free(struct CurveMapping *cumap)
Definition: colortools.c:119
@ CURVEMAP_SLOPE_POS_NEG
@ CURVEMAP_SLOPE_POSITIVE
void BKE_curvemapping_copy_data(struct CurveMapping *target, const struct CurveMapping *cumap)
struct CurveMapping * BKE_curvemapping_add(int tot, float minx, float miny, float maxx, float maxy)
Definition: colortools.c:88
void BKE_curveprofile_blend_read(struct BlendDataReader *reader, struct CurveProfile *profile)
struct CurveProfile * BKE_curveprofile_copy(const struct CurveProfile *profile)
void BKE_curveprofile_blend_write(struct BlendWriter *writer, const struct CurveProfile *profile)
struct CurveProfile * BKE_curveprofile_add(eCurveProfilePresets preset)
Definition: curveprofile.c:887
void BKE_curveprofile_free(struct CurveProfile *profile)
Definition: curveprofile.c:53
struct ListBase * object_duplilist(struct Depsgraph *depsgraph, struct Scene *sce, struct Object *ob)
void free_object_duplilist(struct ListBase *lb)
struct EffectorWeights * BKE_effector_add_weights(struct Collection *collection)
Definition: effect.c:73
void BKE_fcurve_free(struct FCurve *fcu)
Definition: fcurve.c:81
void BKE_previewimg_free(struct PreviewImage **prv)
Definition: icons.cc:295
void BKE_previewimg_id_copy(struct ID *new_id, const struct ID *old_id)
void BKE_previewimg_blend_read(struct BlendDataReader *reader, struct PreviewImage *prv)
Definition: icons.cc:651
void BKE_previewimg_blend_write(struct BlendWriter *writer, const struct PreviewImage *prv)
void IDP_BlendReadExpand(struct BlendExpander *expander, struct IDProperty *prop)
Definition: idprop.c:1336
void IDP_BlendWrite(struct BlendWriter *writer, const struct IDProperty *prop)
void IDP_BlendReadLib(struct BlendLibReader *reader, struct IDProperty *prop)
Definition: idprop.c:1300
void IDP_FreePropertyContent_ex(struct IDProperty *prop, const bool do_id_user)
Definition: idprop.c:1006
#define IDP_BlendDataRead(reader, prop)
Definition: BKE_idprop.h:208
void IDP_foreach_property(struct IDProperty *id_property_root, const int type_filter, IDPForeachPropertyCallback callback, void *user_data)
Definition: idprop.c:1072
void IDP_FreeProperty(struct IDProperty *prop)
Definition: idprop.c:1040
struct IDProperty * IDP_CopyProperty_ex(const struct IDProperty *prop, const int flag) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
struct IDProperty * IDP_CopyProperty(const struct IDProperty *prop) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
@ IDTYPE_CACHE_CB_FLAGS_PERSISTENT
Definition: BKE_idtype.h:87
void(* IDTypeForeachCacheFunctionCallback)(struct ID *id, const struct IDCacheKey *cache_key, void **cache_p, uint flags, void *user_data)
Definition: BKE_idtype.h:89
void BKE_image_editors_update_frame(const struct Main *bmain, int cfra)
bool BKE_imtype_is_movie(const char imtype)
Definition: image.c:1443
struct ViewLayer * BKE_view_layer_add(struct Scene *scene, const char *name, struct ViewLayer *view_layer_source, const int type)
Definition: layer.c:200
void BKE_view_layer_copy_data(struct Scene *scene_dst, const struct Scene *scene_src, struct ViewLayer *view_layer_dst, const struct ViewLayer *view_layer_src, const int flag)
void BKE_main_collection_sync(const struct Main *bmain)
@ VIEWLAYER_ADD_NEW
Definition: BKE_layer.h:50
void BKE_view_layer_blend_read_data(struct BlendDataReader *reader, struct ViewLayer *view_layer)
Definition: layer.c:1937
struct ViewLayer * BKE_view_layer_context_active_PLACEHOLDER(const struct Scene *scene)
void BKE_view_layer_free_ex(struct ViewLayer *view_layer, const bool do_id_user)
Definition: layer.c:262
struct ViewLayer * BKE_view_layer_default_render(const struct Scene *scene)
bool BKE_view_layer_has_collection(struct ViewLayer *view_layer, const struct Collection *collection)
void BKE_view_layer_blend_read_lib(struct BlendLibReader *reader, struct Library *lib, struct ViewLayer *view_layer)
Definition: layer.c:1976
void BKE_view_layer_blend_write(struct BlendWriter *writer, struct ViewLayer *view_layer)
Definition: layer.c:1898
struct ID * BKE_id_copy(struct Main *bmain, const struct ID *id)
void id_us_min(struct ID *id)
Definition: lib_id.c:297
void BKE_libblock_free_data_py(struct ID *id)
void BKE_main_id_tag_all(struct Main *mainvar, const int tag, const bool value)
Definition: lib_id.c:923
@ LIB_ID_CREATE_NO_ALLOCATE
Definition: BKE_lib_id.h:96
@ LIB_ID_COPY_NO_PREVIEW
Definition: BKE_lib_id.h:116
@ LIB_ID_CREATE_NO_USER_REFCOUNT
Definition: BKE_lib_id.h:92
struct ID * BKE_id_copy_ex(struct Main *bmain, const struct ID *id, struct ID **r_newid, const int flag)
void BKE_main_id_clear_newpoins(struct Main *bmain)
Definition: lib_id.c:1738
void id_us_ensure_real(struct ID *id)
Definition: lib_id.c:238
struct ID * BKE_id_copy_for_duplicate(struct Main *bmain, struct ID *id, const uint duplicate_flags)
void BKE_id_blend_write(struct BlendWriter *writer, struct ID *id)
Definition: lib_id.c:2395
void id_us_plus_no_lib(struct ID *id)
Definition: lib_id.c:272
struct ID * BKE_libblock_find_name(struct Main *bmain, const short type, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: lib_id.c:1333
@ LIB_ID_DUPLICATE_IS_SUBPROCESS
Definition: BKE_lib_id.h:175
void * BKE_id_new(struct Main *bmain, const short type, const char *name)
Definition: lib_id.c:1177
#define BKE_LIB_FOREACHID_PROCESS(_data, _id_super, _cb_flag)
void BKE_lib_query_idpropertiesForeachIDLink_callback(struct IDProperty *id_prop, void *user_data)
Definition: lib_query.c:150
@ IDWALK_CB_OVERRIDE_LIBRARY_NOT_OVERRIDABLE
Definition: BKE_lib_query.h:74
@ IDWALK_CB_NEVER_SELF
Definition: BKE_lib_query.h:49
@ IDWALK_CB_USER
Definition: BKE_lib_query.h:87
@ IDWALK_CB_EMBEDDED
Definition: BKE_lib_query.h:62
@ IDWALK_CB_NOP
Definition: BKE_lib_query.h:47
bool BKE_library_foreach_ID_embedded(struct LibraryForeachIDData *data, struct ID **id_pp)
Definition: lib_query.c:161
bool BKE_lib_query_foreachid_process(struct LibraryForeachIDData *data, struct ID **id_pp, int cb_flag)
Definition: lib_query.c:79
void void BKE_libblock_relink_to_newid(struct ID *id) ATTR_NONNULL()
Definition: lib_remap.c:702
void BKE_libblock_relink_ex(struct Main *bmain, void *idv, void *old_idv, void *new_idv, const short remap_flags) ATTR_NONNULL(1
@ ID_REMAP_SKIP_NEVER_NULL_USAGE
Definition: BKE_lib_remap.h:55
Blender kernel freestyle line style functionality.
#define FOREACH_MAIN_ID_END
Definition: BKE_main.h:250
const char * BKE_main_blendfile_path(const struct Main *bmain) ATTR_NONNULL()
#define FOREACH_MAIN_ID_BEGIN(_bmain, _id)
Definition: BKE_main.h:244
void ntreeBlendWrite(struct BlendWriter *writer, struct bNodeTree *ntree)
Definition: node.cc:472
void ntreeFreeEmbeddedTree(struct bNodeTree *ntree)
Definition: node.cc:3021
#define CMP_CRYPTOMATTE_SRC_RENDER
Definition: BKE_node.h:1259
#define CMP_NODE_R_LAYERS
Definition: BKE_node.h:1152
General operations, lookup, etc. for blender objects.
void BKE_paint_blend_write(struct BlendWriter *writer, struct Paint *paint)
Definition: paint.c:1185
void BKE_paint_copy(struct Paint *src, struct Paint *tar, const int flag)
Definition: paint.c:1156
void BKE_paint_free(struct Paint *p)
Definition: paint.c:1146
void BKE_paint_blend_read_lib(struct BlendLibReader *reader, struct Scene *scene, struct Paint *paint)
Definition: paint.c:1219
void BKE_paint_blend_read_data(struct BlendDataReader *reader, const struct Scene *scene, struct Paint *paint)
void BKE_ptcache_id_from_rigidbody(PTCacheID *pid, struct Object *ob, struct RigidBodyWorld *rbw)
Definition: pointcache.c:1078
void BKE_ptcache_blend_read_data(struct BlendDataReader *reader, struct ListBase *ptcaches, struct PointCache **ocache, int force_disk)
Definition: pointcache.c:3921
void BKE_ptcache_blend_write(struct BlendWriter *writer, struct ListBase *ptcaches)
Definition: pointcache.c:3845
API for Blender-side Rigid Body stuff.
void BKE_rigidbody_remove_constraint(struct Main *bmain, struct Scene *scene, struct Object *ob, const bool free_us)
Definition: rigidbody.c:2325
void BKE_rigidbody_remove_object(struct Main *bmain, struct Scene *scene, struct Object *ob, const bool free_us)
Definition: rigidbody.c:2322
void BKE_rigidbody_free_world(struct Scene *scene)
Definition: rigidbody.c:107
void BKE_rigidbody_world_id_loop(struct RigidBodyWorld *rbw, RigidbodyWorldIDFunc func, void *userdata)
Definition: rigidbody.c:2294
struct RigidBodyWorld * BKE_rigidbody_world_copy(struct RigidBodyWorld *rbw, const int flag)
Definition: rigidbody.c:2287
void BKE_rigidbody_world_groups_relink(struct RigidBodyWorld *rbw)
Definition: rigidbody.c:2291
eSceneCopyMethod
Definition: BKE_scene.h:42
@ SCE_COPY_EMPTY
Definition: BKE_scene.h:44
@ SCE_COPY_FULL
Definition: BKE_scene.h:46
void BKE_screen_view3d_shading_blend_read_data(struct BlendDataReader *reader, struct View3DShading *shading)
Definition: screen.c:1131
void BKE_screen_view3d_shading_blend_write(struct BlendWriter *writer, struct View3DShading *shading)
Definition: screen.c:1124
void BKE_sound_set_scene_sound_pitch(void *handle, float pitch, char animated)
void BKE_sound_set_scene_sound_volume(void *handle, float volume, char animated)
void BKE_sound_seek_scene(struct Main *bmain, struct Scene *scene)
void BKE_sound_set_scene_volume(struct Scene *scene, float volume)
void BKE_sound_mute_scene(struct Scene *scene, int muted)
void BKE_sound_ensure_scene(struct Scene *scene)
void BKE_sound_reset_scene_runtime(struct Scene *scene)
void BKE_sound_set_cfra(int cfra)
void BKE_sound_update_scene_listener(struct Scene *scene)
void BKE_sound_update_scene_sound(void *handle, struct bSound *sound)
void * BKE_sound_add_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence)
void BKE_sound_destroy_scene(struct Scene *scene)
void BKE_sound_set_scene_sound_pan(void *handle, float pan, char animated)
void BKE_sound_remove_scene_sound(struct Scene *scene, void *handle)
void * BKE_sound_scene_add_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence)
void BKE_sound_update_scene(struct Depsgraph *depsgraph, struct Scene *scene)
void BKE_sound_update_fps(struct Main *bmain, struct Scene *scene)
int BKE_unit_base_of_type_get(int system, int type)
Definition: unit.c:1285
@ B_UNIT_AREA
Definition: BKE_unit.h:80
@ B_UNIT_VOLUME
Definition: BKE_unit.h:81
@ B_UNIT_LENGTH
Definition: BKE_unit.h:79
@ B_UNIT_TEMPERATURE
Definition: BKE_unit.h:89
@ B_UNIT_CAMERA
Definition: BKE_unit.h:87
@ B_UNIT_ACCELERATION
Definition: BKE_unit.h:86
@ B_UNIT_MASS
Definition: BKE_unit.h:82
@ B_UNIT_POWER
Definition: BKE_unit.h:88
@ B_UNIT_TIME
Definition: BKE_unit.h:84
@ B_UNIT_VELOCITY
Definition: BKE_unit.h:85
struct bScreen * BKE_workspace_active_screen_get(const struct WorkSpaceInstanceHook *hook) GETTER_ATTRS
#define BLI_assert(a)
Definition: BLI_assert.h:58
bool BLI_ghashutil_strcmp(const void *a, const void *b)
unsigned int BLI_ghashutil_ptrhash(const void *key)
unsigned int BLI_ghashutil_strhash_p(const void *ptr)
GHash * BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
Definition: BLI_ghash.c:718
bool BLI_ghash_remove(GHash *gh, const void *key, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
Definition: BLI_ghash.c:900
void BLI_ghash_insert(GHash *gh, void *key, void *val)
Definition: BLI_ghash.c:756
void ** BLI_ghash_lookup_p(GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
Definition: BLI_ghash.c:830
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
Definition: BLI_ghash.c:1008
bool BLI_ghash_ensure_p_ex(GHash *gh, const void *key, void ***r_key, void ***r_val) ATTR_WARN_UNUSED_RESULT
Definition: BLI_ghash.c:873
void * BLI_ghash_lookup(GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
Definition: BLI_ghash.c:803
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:172
void BLI_freelinkN(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:281
void void void void void BLI_duplicatelist(struct ListBase *dst, const struct ListBase *src) ATTR_NONNULL(1
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
Definition: BLI_listbase.h:188
BLI_INLINE void BLI_listbase_clear(struct ListBase *lb)
Definition: BLI_listbase.h:128
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
Definition: listbase.c:547
void * BLI_findstring(const struct ListBase *listbase, const char *id, const int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:110
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:133
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void * BLI_findptr(const struct ListBase *listbase, const void *ptr, const int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE int min_ii(int a, int b)
MINLINE int max_ii(int a, int b)
#define BLI_ASSERT_UNIT_M3(m)
MINLINE int mod_i(int i, int n)
#define BLI_ASSERT_UNIT_QUAT(q)
MINLINE int round_db_to_int(double a)
void copy_m3_m4(float m1[3][3], const float m2[4][4])
Definition: math_matrix.c:105
void copy_m4_m3(float m1[4][4], const float m2[3][3])
Definition: math_matrix.c:120
void copy_m4_m4(float m1[4][4], const float m2[4][4])
Definition: math_matrix.c:95
void quat_to_eulO(float eul[3], const short order, const float quat[4])
void eulO_to_quat(float quat[4], const float eul[3], const short order)
void axis_angle_to_quat(float r[4], const float axis[3], const float angle)
void mat3_to_eulO(float eul[3], const short order, const float mat[3][3])
void quat_to_compatible_eulO(float eul[3], const float old[3], const short order, const float quat[4])
float normalize_qt_qt(float r[4], const float q[4])
void mat3_to_axis_angle(float axis[3], float *angle, const float M[3][3])
void quat_to_axis_angle(float axis[3], float *angle, const float q[4])
void eulO_to_mat3(float mat[3][3], const float eul[3], const short order)
void axis_angle_to_mat3(float R[3][3], const float axis[3], const float angle)
void copy_qt_qt(float q[4], const float a[4])
Definition: math_rotation.c:52
void quat_to_compatible_quat(float q[4], const float a[4], const float old[4])
void quat_to_mat3(float mat[3][3], const float q[4])
void mat3_to_compatible_eulO(float eul[3], const float old[3], const short order, const float mat[3][3])
void mat3_normalized_to_quat(float q[4], const float mat[3][3])
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void zero_v3(float r[3])
#define FILE_MAX
bool BLI_path_suffix(char *string, size_t maxlen, const char *suffix, const char *sep) ATTR_NONNULL()
Definition: path_util.c:669
#define STR_ELEM(...)
Definition: BLI_string.h:218
size_t BLI_strncpy_rlen(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: string.c:187
size_t BLI_str_rpartition(const char *str, const char delim[], const char **sep, const char **suf) ATTR_NONNULL()
Definition: string.c:1071
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_NONNULL()
Definition: string.c:108
bool BLI_uniquename(struct ListBase *list, void *vlink, const char *defname, char delim, int name_offset, size_t len)
Definition: string_utils.c:381
unsigned char uchar
Definition: BLI_sys_types.h:86
unsigned int uint
Definition: BLI_sys_types.h:83
int BLI_system_thread_count(void)
Definition: threads.cc:309
int BLI_system_num_threads_override_get(void)
Definition: threads.cc:350
#define ARRAY_SIZE(arr)
#define SWAP(type, a, b)
#define STREQLEN(a, b, n)
#define UNUSED_VARS_NDEBUG(...)
#define UNUSED(x)
#define ELEM(...)
#define MEMCMP_STRUCT_AFTER_IS_ZERO(struct_var, member)
#define POINTER_OFFSET(v, ofs)
#define MEMCPY_STRUCT_AFTER(struct_dst, struct_src, member)
#define STREQ(a, b)
#define BLO_read_data_address(reader, ptr_p)
void BLO_reportf_wrap(struct ReportList *reports, ReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
ID * BLO_read_get_new_id_address(BlendLibReader *reader, struct Library *lib, struct ID *id)
Definition: readfile.c:5615
bool BLO_read_data_is_undo(BlendDataReader *reader)
Definition: readfile.c:5770
#define BLO_write_id_struct(writer, struct_name, id_address, id)
#define BLO_write_struct(writer, struct_name, data_ptr)
void BLO_read_list(BlendDataReader *reader, struct ListBase *list)
Definition: readfile.c:5654
void BLO_read_glob_list(BlendDataReader *reader, struct ListBase *list)
Definition: readfile.c:5780
void * BLO_read_get_new_data_address(BlendDataReader *reader, const void *old_address)
Definition: readfile.c:5600
#define BLO_read_id_address(reader, lib, id_ptr_p)
#define BLO_write_struct_array(writer, struct_name, array_size, data_ptr)
#define BLO_expand(expander, id)
void BLO_write_raw(BlendWriter *writer, size_t size_in_bytes, const void *data_ptr)
Definition: writefile.c:1286
bool BLO_write_is_undo(BlendWriter *writer)
Definition: writefile.c:1412
struct ReportList * BLO_read_lib_reports(BlendLibReader *reader)
Definition: readfile.c:5800
#define TIP_(msgid)
#define BLT_I18NCONTEXT_ID_SCENE
#define DATA_(msgid)
typedef double(DMatrix)[4][4]
void DEG_evaluate_on_refresh(Depsgraph *graph)
Depsgraph * DEG_graph_new(struct Main *bmain, struct Scene *scene, struct ViewLayer *view_layer, eEvaluationMode mode)
Definition: depsgraph.cc:281
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:51
void DEG_editors_update(struct Depsgraph *depsgraph, bool time)
void DEG_ids_clear_recalc(Depsgraph *depsgraph, const bool backup)
void DEG_enable_editors_update(struct Depsgraph *depsgraph)
void DEG_make_active(struct Depsgraph *depsgraph)
Definition: depsgraph.cc:344
@ DAG_EVAL_VIEWPORT
Definition: DEG_depsgraph.h:61
void DEG_debug_print_eval(struct Depsgraph *depsgraph, const char *function_name, const char *object_name, const void *object_address)
void DEG_evaluate_on_framechange(Depsgraph *graph, float ctime)
void DEG_graph_replace_owners(struct Depsgraph *depsgraph, struct Main *bmain, struct Scene *scene, struct ViewLayer *view_layer)
Definition: depsgraph.cc:292
void DEG_graph_free(Depsgraph *graph)
Definition: depsgraph.cc:314
void DEG_id_tag_update(struct ID *id, int flag)
void DEG_ids_restore_recalc(Depsgraph *depsgraph)
void DEG_graph_tag_relations_update(struct Depsgraph *graph)
void DEG_graph_relations_update(struct Depsgraph *graph)
void DEG_debug_name_set(struct Depsgraph *depsgraph, const char *name)
struct Scene * DEG_get_input_scene(const Depsgraph *graph)
bool DEG_is_fully_evaluated(const struct Depsgraph *depsgraph)
bool DEG_id_type_any_updated(const struct Depsgraph *depsgraph)
struct ViewLayer * DEG_get_evaluated_view_layer(const struct Depsgraph *graph)
bool DEG_is_evaluated_id(const struct ID *id)
struct Main * DEG_get_bmain(const Depsgraph *graph)
struct ViewLayer * DEG_get_input_view_layer(const Depsgraph *graph)
struct Scene * DEG_get_evaluated_scene(const struct Depsgraph *graph)
@ ID_RECALC_AUDIO_FPS
Definition: DNA_ID.h:661
@ ID_RECALC_AUDIO_LISTENER
Definition: DNA_ID.h:664
@ ID_RECALC_COPY_ON_WRITE
Definition: DNA_ID.h:654
@ ID_RECALC_AUDIO
Definition: DNA_ID.h:666
@ ID_RECALC_AUDIO_MUTE
Definition: DNA_ID.h:663
@ ID_RECALC_AUDIO_SEEK
Definition: DNA_ID.h:660
@ ID_RECALC_ALL
Definition: DNA_ID.h:697
@ ID_RECALC_AUDIO_VOLUME
Definition: DNA_ID.h:662
@ LIB_TAG_NEW
Definition: DNA_ID.h:551
#define ID_IS_LINKED(_id)
Definition: DNA_ID.h:426
#define MAX_ID_NAME
Definition: DNA_ID.h:269
@ LIB_EMBEDDED_DATA
Definition: DNA_ID.h:482
@ IDP_TYPE_FILTER_ID
Definition: DNA_ID.h:115
#define FILTER_ID_SCE
Definition: DNA_ID.h:725
@ INDEX_ID_SCE
Definition: DNA_ID.h:850
@ ID_SCE
Definition: DNA_ID_enums.h:57
@ ROT_MODE_QUAT
@ ROT_MODE_AXISANGLE
Object groups, one object can be in many groups at once.
@ CURVE_PRESET_GAUSS
@ CURVE_PRESET_BELL
@ CURVE_PRESET_MAX
@ PROF_PRESET_LINE
#define DNA_struct_default_get(struct_name)
Definition: DNA_defaults.h:44
#define DNA_struct_default_alloc(struct_name)
Definition: DNA_defaults.h:47
#define MAX_NAME
Definition: DNA_defs.h:62
@ OB_RENDER
Object is a sort of wrapper for general info.
@ OB_DUPLI
#define OB_FROMDUPLI
@ OB_MESH
@ OB_RESTRICT_RENDER
#define PTCACHE_FLAG_INFO_DIRTY
Types and defines for representing Rigid Body entities.
@ RBW_FLAG_MUTED
#define OBEDIT_FROM_VIEW_LAYER(view_layer)
#define SCE_READFILE_LIBLINK_NEED_SETSCENE_CHECK
#define USER_UNIT_METRIC
#define STEREO_LEFT_NAME
#define R_MULTIVIEW
#define R_NO_CAMERA_SWITCH
#define USER_UNIT_NONE
struct Scene Scene
#define F_START
#define PE_BRUSH_CUT
@ S3D_SQUEEZED_FRAME
#define R_FIXED_THREADS
@ SCE_VIEWS_FORMAT_STEREO_3D
@ SCE_VIEWS_FORMAT_MULTIVIEW
@ SCE_ORIENT_DEFAULT
@ SCE_ORIENT_ROTATE
@ SCE_ORIENT_TRANSLATE
@ SCE_ORIENT_SCALE
#define F_SCENE
#define STEREO_LEFT_SUFFIX
@ R_IMF_VIEWS_STEREO_3D
#define STEREO_RIGHT_NAME
#define STEREO_RIGHT_SUFFIX
#define AUDIO_MUTE
#define FPS
#define R_SIMPLIFY
#define F_DUPLI
#define SCE_VIEW_DISABLE
#define MAXFRAME
@ SEQ_EFFECT_NOT_LOADED
@ SEQ_SCENE_STRIPS
@ SEQ_AUDIO_PITCH_ANIMATED
@ SEQ_USE_PROXY
@ SEQ_AUDIO_VOLUME_ANIMATED
@ SEQ_AUDIO_PAN_ANIMATED
#define SEQ_FONT_NOT_LOADED
#define MAXSEQ
@ SEQ_TYPE_TRANSFORM
@ SEQ_TYPE_SOUND_RAM
@ SEQ_TYPE_SOUND_HD
@ SEQ_TYPE_GLOW
@ SEQ_TYPE_COLORMIX
@ SEQ_TYPE_WIPE
@ SEQ_TYPE_SCENE
@ SEQ_TYPE_GAUSSIAN_BLUR
@ SEQ_TYPE_TEXT
@ SEQ_TYPE_IMAGE
@ SEQ_TYPE_SPEED
@ SEQ_TYPE_COLOR
@ SEQ_TYPE_EFFECT
@ SEQ_TYPE_MOVIE
@ SPACE_VIEW3D
eDupli_ID_Flags
@ USER_DUP_LINKED_ID
@ USER_DUP_OBJECT
@ V3D_ORIENT_CUSTOM
@ V3D_ORIENT_GLOBAL
@ V3D_GIZMO_SHOW_OBJECT_ROTATE
@ V3D_GIZMO_SHOW_OBJECT_SCALE
@ V3D_GIZMO_SHOW_OBJECT_TRANSLATE
static AppView * view
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
const char * IMB_colormanagement_view_get_default_name(const char *display_name)
const char * IMB_colormanagement_display_get_none_name(void)
const char * IMB_colormanagement_role_colorspace_name_get(int role)
@ COLOR_ROLE_DEFAULT_SEQUENCER
void IMB_stereo3d_write_dimensions(const char mode, const bool is_squeezed, const size_t width, const size_t height, size_t *r_width, size_t *r_height)
Definition: stereoimbuf.c:521
Read Guarded memory(de)allocation.
#define MEM_SAFE_FREE(v)
static void init_data(ModifierData *md)
Group RGB to Bright Vector Camera Vector Combine Material Light Line Style Layer Add Ambient Diffuse Glossy Refraction Transparent Toon Principled Hair Volume Principled Light Particle Volume Image Sky Noise Wave Voronoi Brick Texture Vector Combine Vertex Separate Vector White RGB Map Separate Set Z Dilate Combine Combine Color Channel Split ID Combine Luminance Directional Alpha Distance Hue Movie Ellipse Bokeh View Corner CMP_NODE_CRYPTOMATTE
Platform independent time functions.
#define RE_USE_SPHERICAL_STEREO
Definition: RE_engine.h:64
#define RE_USE_SHADING_NODES_CUSTOM
Definition: RE_engine.h:63
#define SEQ_ALL_END
Definition: SEQ_iterator.h:48
#define SEQ_ALL_BEGIN(ed, _seq)
Definition: SEQ_iterator.h:41
#define SEQ_DUPE_ALL
Definition: SEQ_sequencer.h:53
static struct PyModuleDef module
ATTR_WARN_UNUSED_RESULT BMesh * bm
void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, const struct BMeshToMeshParams *params)
unsigned int U
Definition: btGjkEpa3.h:78
#define SELECT
OperationNode * node
Scene scene
const Depsgraph * depsgraph
AnimationBackup * backup
void * user_data
void EEVEE_lightcache_blend_read_data(BlendDataReader *reader, LightCache *cache)
void EEVEE_lightcache_blend_write(BlendWriter *writer, LightCache *cache)
void EEVEE_lightcache_free(LightCache *lcache)
void EEVEE_lightcache_info_update(SceneEEVEE *eevee)
bNodeTree * ntree
RenderEngineType * RE_engines_find(const char *idname)
Definition: engine.c:108
const vector< Marker > & markers
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
void *(* MEM_dupallocN)(const void *vmemh)
Definition: mallocn.c:42
size_t(* MEM_allocN_len)(const void *vmemh)
Definition: mallocn.c:40
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:45
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:47
static unsigned a[3]
Definition: RandGen.cpp:92
INLINE Rall1d< T, V, S > pow(const Rall1d< T, V, S > &arg, double m)
Definition: rall1d.h:359
static void area(int d1, int d2, int e1, int e2, float weights[2])
ListBase threads
list of all thread for every CPUDevice in cpudevices a thread exists.
#define hash
Definition: noise.c:169
void SEQ_proxy_set(struct Sequence *seq, bool value)
Definition: proxy.c:584
void BKE_scene_base_flag_to_objects(ViewLayer *view_layer)
Definition: scene.c:2946
void free_avicodecdata(AviCodecData *acd)
Definition: scene.c:1746
int BKE_scene_transform_orientation_get_index(const Scene *scene, const TransformOrientation *orientation)
Definition: scene.c:3646
void BKE_scene_graph_evaluated_ensure(Depsgraph *depsgraph, Main *bmain)
Definition: scene.c:2718
void BKE_scene_disable_color_management(Scene *scene)
Definition: scene.c:2972
static void scene_blend_read_lib(BlendLibReader *reader, ID *id)
Definition: scene.c:1397
const char * BKE_scene_multiview_render_view_name_get(const RenderData *rd, const int view_id)
Definition: scene.c:3206
static void scene_sequencer_disable_sound_strips(Scene *scene)
Definition: scene.c:3776
static void scene_undo_preserve(BlendLibReader *reader, ID *id_new, ID *id_old)
Definition: scene.c:1683
void BKE_scene_frame_set(struct Scene *scene, double cfra)
Definition: scene.c:2475
bool BKE_scene_uses_cycles(const Scene *scene)
Definition: scene.c:2941
static void scene_lib_override_apply_post(ID *id_dst, ID *UNUSED(id_src))
Definition: scene.c:1699
IDTypeInfo IDType_ID_SCE
Definition: scene.c:1712
void BKE_scene_copy_data_eevee(Scene *sce_dst, const Scene *sce_src)
Definition: scene.c:1899
int get_render_subsurf_level(const RenderData *r, int lvl, bool for_render)
Definition: scene.c:2856
static void scene_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int flag)
Definition: scene.c:253
void BKE_scene_undo_depsgraphs_restore(Main *bmain, GHash *depsgraph_extract)
Definition: scene.c:3579
const char * BKE_scene_multiview_view_id_suffix_get(const RenderData *rd, const int view_id)
Definition: scene.c:3291
int BKE_scene_num_threads(const Scene *scene)
Definition: scene.c:3025
void BKE_scene_allocate_depsgraph_hash(Scene *scene)
Definition: scene.c:3409
static void scene_graph_update_tagged(Depsgraph *depsgraph, Main *bmain, bool only_if_tagged)
Definition: scene.c:2642
void BKE_scene_free_view_layer_depsgraph(Scene *scene, ViewLayer *view_layer)
Definition: scene.c:3431
void BKE_scene_multiview_view_filepath_get(const RenderData *rd, const char *filepath, const char *viewname, char *r_filepath)
Definition: scene.c:3255
static void depsgraph_key_free(void *key_v)
Definition: scene.c:3397
const char * RE_engine_id_CYCLES
Definition: scene.c:1744
static void scene_blend_read_data(BlendDataReader *reader, ID *id)
Definition: scene.c:1071
static void direct_link_paint_helper(BlendDataReader *reader, const Scene *scene, Paint **paint)
Definition: scene.c:1046
void BKE_toolsettings_free(ToolSettings *toolsettings)
Definition: scene.c:1837
void BKE_scene_free_depsgraph_hash(Scene *scene)
Definition: scene.c:3422
eSceneForeachUndoPreserveProcess
Definition: scene.c:479
@ SCENE_FOREACH_UNDO_NO_RESTORE
Definition: scene.c:485
@ SCENE_FOREACH_UNDO_RESTORE
Definition: scene.c:482
struct DepsgraphKey DepsgraphKey
void BKE_scene_multiview_filepath_get(SceneRenderView *srv, const char *filepath, char *r_filepath)
Definition: scene.c:3243
static void link_recurs_seq(BlendDataReader *reader, ListBase *lb)
Definition: scene.c:1056
int BKE_scene_multiview_num_views_get(const RenderData *rd)
Definition: scene.c:3069
bool BKE_scene_multiview_is_render_view_active(const RenderData *rd, const SceneRenderView *srv)
Definition: scene.c:3117
void BKE_scene_transform_orientation_remove(Scene *scene, TransformOrientation *orientation)
Definition: scene.c:3617
void BKE_scene_cursor_from_mat4(View3DCursor *cursor, const float mat[4][4], bool use_compat)
Definition: scene.c:3764
bool BKE_scene_check_rigidbody_active(const Scene *scene)
Definition: scene.c:2997
Scene * BKE_scene_find_from_collection(const Main *bmain, const Collection *collection)
Definition: scene.c:2290
int BKE_render_preview_pixel_size(const RenderData *r)
Definition: scene.c:3030
static bool depsgraph_key_compare(const void *key_a_v, const void *key_b_v)
Definition: scene.c:3389
void BKE_scene_view_layer_graph_evaluated_ensure(Main *bmain, Scene *scene, ViewLayer *view_layer)
Definition: scene.c:2805
bool BKE_scene_has_view_layer(const Scene *scene, const ViewLayer *layer)
Definition: scene.c:2285
static void scene_free_markers(Scene *scene, bool do_id_user)
Definition: scene.c:367
static void scene_copy_markers(Scene *scene_dst, const Scene *scene_src, const int flag)
Definition: scene.c:243
static void scene_blend_read_expand(BlendExpander *expander, ID *id)
Definition: scene.c:1575
static void remove_sequencer_fcurves(Scene *sce)
Definition: scene.c:1762
static void composite_patch(bNodeTree *ntree, Scene *scene)
Definition: scene.c:1386
static Depsgraph ** scene_get_depsgraph_p(Scene *scene, ViewLayer *view_layer, const bool allocate_ghash_entry)
Definition: scene.c:3441
#define BKE_LIB_FOREACHID_UNDO_PRESERVE_PROCESS(__data, __id, __do_undo_restore, __action, __reader, __id_old, __cb_flag)
Definition: scene.c:523
Depsgraph * BKE_scene_ensure_depsgraph(Main *bmain, Scene *scene, ViewLayer *view_layer)
Definition: scene.c:3526
int BKE_scene_base_iter_next(Depsgraph *depsgraph, SceneBaseIter *iter, Scene **scene, int val, Base **base, Object **ob)
Definition: scene.c:2160
bool BKE_scene_camera_switch_update(Scene *scene)
Definition: scene.c:2349
static void scene_blend_write(BlendWriter *writer, ID *id, const void *id_address)
Definition: scene.c:806
static void scene_foreach_layer_collection(LibraryForeachIDData *data, ListBase *lb)
Definition: scene.c:687
SceneRenderView * BKE_scene_multiview_render_view_findindex(const RenderData *rd, const int view_id)
Definition: scene.c:3187
bool BKE_scene_multiview_is_stereo3d(const RenderData *rd)
Definition: scene.c:3099
bool BKE_scene_multiview_is_render_view_first(const RenderData *rd, const char *viewname)
Definition: scene.c:3144
int get_render_child_particle_number(const RenderData *r, int num, bool for_render)
Definition: scene.c:2869
static void scene_foreach_rigidbodyworldSceneLooper(struct RigidBodyWorld *UNUSED(rbw), ID **id_pointer, void *user_data, int cb_flag)
Definition: scene.c:466
int BKE_scene_orientation_slot_get_index(const TransformOrientationSlot *orient_slot)
Definition: scene.c:2524
void BKE_scene_cursor_rot_to_quat(const View3DCursor *cursor, float quat[4])
Definition: scene.c:3675
float BKE_scene_frame_get(const Scene *scene)
Definition: scene.c:2458
void BKE_scene_groups_relink(Scene *sce)
Definition: scene.c:2056
bool BKE_scene_can_be_removed(const Main *bmain, const Scene *scene)
Definition: scene.c:2063
void BKE_scene_set_background(Main *bmain, Scene *scene)
Definition: scene.c:2120
void BKE_scene_cursor_mat3_to_rot(View3DCursor *cursor, const float mat[3][3], bool use_compat)
Definition: scene.c:3688
Base * _setlooper_base_step(Scene **sce_iter, ViewLayer *view_layer, Base *base)
Definition: scene.c:2888
const char * RE_engine_id_BLENDER_WORKBENCH
Definition: scene.c:1743
bool BKE_scene_multiview_is_render_view_last(const RenderData *rd, const char *viewname)
Definition: scene.c:3166
int BKE_render_num_threads(const RenderData *rd)
Definition: scene.c:3003
bool BKE_scene_use_spherical_stereo(Scene *scene)
Definition: scene.c:2925
void BKE_scene_multiview_videos_dimensions_get(const RenderData *rd, const size_t width, const size_t height, size_t *r_width, size_t *r_height)
Definition: scene.c:3333
void BKE_scene_ensure_depsgraph_hash(Scene *scene)
Definition: scene.c:3415
TransformOrientation * BKE_scene_transform_orientation_find(const Scene *scene, const int index)
Definition: scene.c:3637
void BKE_scene_update_sound(Depsgraph *depsgraph, Main *bmain)
Definition: scene.c:2604
Scene * BKE_scene_duplicate(Main *bmain, Scene *sce, eSceneCopyMethod type)
Definition: scene.c:1908
SceneRenderView * BKE_scene_add_render_view(Scene *sce, const char *name)
Definition: scene.c:2813
int BKE_scene_frame_snap_by_seconds(Scene *scene, double interval_in_seconds, int cfra)
Definition: scene.c:2407
int BKE_scene_orientation_get_index_from_flag(Scene *scene, int flag)
Definition: scene.c:2537
bool BKE_scene_validate_setscene(Main *bmain, Scene *sce)
Definition: scene.c:2433
int BKE_scene_multiview_num_videos_get(const RenderData *rd)
Definition: scene.c:3353
Depsgraph * BKE_scene_get_depsgraph(const Scene *scene, const ViewLayer *view_layer)
Definition: scene.c:3513
static void scene_init_data(ID *id)
Definition: scene.c:131
const char * BKE_scene_find_last_marker_name(const Scene *scene, int frame)
Definition: scene.c:2389
static void scene_foreach_toolsettings_id_pointer_process(ID **id_p, const eSceneForeachUndoPreserveProcess action, BlendLibReader *reader, ID **id_old_p, const uint cb_flag)
Definition: scene.c:488
int BKE_scene_orientation_get_index(Scene *scene, int slot_index)
Definition: scene.c:2531
const char * BKE_scene_find_marker_name(const Scene *scene, int frame)
Definition: scene.c:2364
void BKE_scene_cursor_quat_to_rot(View3DCursor *cursor, const float quat[4], bool use_compat)
Definition: scene.c:3723
GHash * BKE_scene_undo_depsgraphs_extract(Main *bmain)
Definition: scene.c:3549
bool BKE_scene_object_find(Scene *scene, Object *ob)
Definition: scene.c:2092
void BKE_scene_orientation_slot_set_index(TransformOrientationSlot *orient_slot, int orientation)
Definition: scene.c:2517
void BKE_scene_cursor_rot_to_mat3(const View3DCursor *cursor, float mat[3][3])
Definition: scene.c:3660
const char * RE_engine_id_BLENDER_EEVEE
Definition: scene.c:1742
void BKE_scene_graph_update_tagged(Depsgraph *depsgraph, Main *bmain)
Definition: scene.c:2713
Scene * BKE_scene_add(Main *bmain, const char *name)
Definition: scene.c:2078
const char * BKE_scene_multiview_view_suffix_get(const RenderData *rd, const char *viewname)
Definition: scene.c:3275
static Depsgraph ** scene_ensure_depsgraph_p(Main *bmain, Scene *scene, ViewLayer *view_layer)
Definition: scene.c:3481
static void scene_foreach_id(ID *id, LibraryForeachIDData *data)
Definition: scene.c:701
bool BKE_scene_use_shading_nodes_custom(Scene *scene)
Definition: scene.c:2919
int BKE_scene_multiview_view_id_get(const RenderData *rd, const char *viewname)
Definition: scene.c:3217
static void scene_free_data(ID *id)
Definition: scene.c:378
static void prepare_mesh_for_viewport_render(Main *bmain, const ViewLayer *view_layer)
Definition: scene.c:2573
void BKE_scene_graph_update_for_newframe(Depsgraph *depsgraph)
Definition: scene.c:2794
TransformOrientationSlot * BKE_scene_orientation_slot_get_from_flag(Scene *scene, int flag)
Definition: scene.c:2494
double BKE_scene_unit_scale(const UnitSettings *unit, const int unit_type, double value)
Definition: scene.c:3042
static unsigned int depsgraph_key_hash(const void *key_v)
Definition: scene.c:3381
float BKE_scene_frame_to_ctime(const Scene *scene, const float frame)
Definition: scene.c:2464
static void scene_foreach_cache(ID *id, IDTypeForeachCacheFunctionCallback function_callback, void *user_data)
Definition: scene.c:788
static void scene_foreach_toolsettings(LibraryForeachIDData *data, ToolSettings *toolsett, const bool do_undo_restore, BlendLibReader *reader, ToolSettings *toolsett_old)
Definition: scene.c:577
Object * BKE_scene_object_find_by_name(const Scene *scene, const char *name)
Definition: scene.c:2102
ToolSettings * BKE_toolsettings_copy(ToolSettings *toolsettings, const int flag)
Definition: scene.c:1781
void BKE_scene_cursor_to_mat4(const View3DCursor *cursor, float mat[4][4])
Definition: scene.c:3756
static bool check_rendered_viewport_visible(Main *bmain)
Definition: scene.c:2545
void BKE_scene_graph_update_for_newframe_ex(Depsgraph *depsgraph, const bool clear_recalc)
Definition: scene.c:2724
static void depsgraph_key_value_free(void *value)
Definition: scene.c:3403
bool BKE_scene_remove_render_view(Scene *scene, SceneRenderView *srv)
Definition: scene.c:2834
void BKE_scene_update_tag_audio_volume(Depsgraph *UNUSED(depsgraph), Scene *scene)
Definition: scene.c:2628
bool BKE_scene_check_color_management_enabled(const Scene *scene)
Definition: scene.c:2992
static char * scene_undo_depsgraph_gen_key(Scene *scene, ViewLayer *view_layer, char *key_full)
Definition: scene.c:3532
void BKE_scene_remove_rigidbody_object(struct Main *bmain, Scene *scene, Object *ob, const bool free_us)
Definition: scene.c:2417
static void scene_foreach_paint(LibraryForeachIDData *data, Paint *paint, const bool do_undo_restore, BlendLibReader *reader, Paint *paint_old)
Definition: scene.c:536
void BKE_scene_object_base_flag_sync_from_base(Base *base)
Definition: scene.c:2966
Scene * BKE_scene_set_name(Main *bmain, const char *name)
Definition: scene.c:2145
bool BKE_scene_uses_blender_workbench(const Scene *scene)
Definition: scene.c:2936
void BKE_scene_multiview_view_prefix_get(Scene *scene, const char *name, char *r_prefix, const char **r_ext)
Definition: scene.c:3301
bool BKE_scene_uses_blender_eevee(const Scene *scene)
Definition: scene.c:2931
TransformOrientationSlot * BKE_scene_orientation_slot_get(Scene *scene, int slot_index)
Definition: scene.c:2486
void BKE_scene_eval_sequencer_sequences(Depsgraph *depsgraph, Scene *scene)
Definition: scene.c:3791
void SEQ_modifier_blend_write(BlendWriter *writer, ListBase *modbase)
void SEQ_modifier_blend_read_lib(BlendLibReader *reader, Scene *scene, ListBase *lb)
void SEQ_modifier_blend_read_data(BlendDataReader *reader, ListBase *lb)
void SEQ_sound_update_bounds_all(Scene *scene)
void SEQ_tool_settings_free(SequencerToolSettings *tool_settings)
Definition: sequencer.c:327
void SEQ_sequence_base_dupli_recursive(const Scene *scene_src, Scene *scene_dst, ListBase *nseqbase, const ListBase *seqbase, int dupe_flag, const int flag)
Definition: sequencer.c:559
SequencerToolSettings * SEQ_tool_settings_init(void)
Definition: sequencer.c:308
void SEQ_editing_free(Scene *scene, const bool do_id_user)
Definition: sequencer.c:255
SequencerToolSettings * SEQ_tool_settings_copy(SequencerToolSettings *tool_settings)
Definition: sequencer.c:719
_W64 int intptr_t
Definition: stdint.h:121
void SEQ_edit_update_muting(Editing *ed)
Definition: strip_edit.c:134
void SEQ_relations_session_uuid_generate(struct Sequence *sequence)
bAction * action
unsigned int cbFormat
unsigned int cbParms
struct BMesh * bm
Definition: BKE_editmesh.h:52
struct Object * cage_object
char filepath[1024]
struct ImageFormatData im_format
struct Base * next
short flag
struct Object * object
CurveMap cm[4]
const ViewLayer * view_layer
Definition: scene.c:3375
float mat[4][4]
Definition: BKE_duplilist.h:46
struct Object * ob
Definition: BKE_duplilist.h:45
struct DupliObject * next
Definition: BKE_duplilist.h:44
ListBase seqbase
struct PrefetchJob * prefetch_job
ListBase * seqbasep
Sequence * act_seq
ListBase metastack
struct SeqCache * cache
struct Collection * group
struct FCurve * next
char * rna_path
IDProperty * properties
struct CurveMapping * custom_ipo
struct Object * reference_object
struct GP_Sculpt_Guide guide
struct CurveMapping * cur_primitive
struct CurveMapping * cur_falloff
unsigned int id_session_uuid
Definition: BKE_idtype.h:56
short id_code
Definition: BKE_idtype.h:120
Definition: DNA_ID.h:273
int tag
Definition: DNA_ID.h:292
struct Library * lib
Definition: DNA_ID.h:277
int recalc
Definition: DNA_ID.h:295
IDProperty * properties
Definition: DNA_ID.h:314
struct ID * orig_id
Definition: DNA_ID.h:324
void * next
Definition: DNA_ID.h:274
char name[66]
Definition: DNA_ID.h:283
ColorManagedDisplaySettings display_settings
ColorManagedViewSettings view_settings
Stereo3dFormat stereo3d_format
struct Image * stencil
struct Image * canvas
struct Image * clone
char filepath[1024]
Definition: DNA_ID.h:352
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
struct BMEditMesh * edit_mesh
void set(const SocketType &input, bool value)
Definition: node.cpp:70
short base_flag
struct RigidBodyOb * rigidbody_object
float obmat[4][4]
struct RigidBodyCon * rigidbody_constraint
void * data
struct ListBase * ptcaches
struct Brush * brush
int tool_slots_len
struct PaintToolSlot * tool_slots
struct Palette * palette
struct Brush * brush
ParticleBrushData brush[7]
struct Object * shape_object
struct Object * object
struct Scene * scene
struct CurveMapping mblur_shutter_curve
struct BakeData bake
char engine[32]
struct ImageFormatData im_format
struct AviCodecData * avicodecdata
char pic[1024]
ListBase views
struct FFMpegCodecData ffcodecdata
short views_format
struct PointCache * pointcache
struct Collection * constraints
struct Collection * group
struct RigidBodyWorld_Shared * shared
struct Object ** objects
struct EffectorWeights * effector_weights
float omat[4][4]
Definition: BKE_scene.h:89
struct DupliObject * dupob
Definition: BKE_scene.h:88
struct Object * dupli_refob
Definition: BKE_scene.h:90
struct ListBase * duplilist
Definition: BKE_scene.h:87
View3DShading shading
struct LightCache * light_cache_data
char light_cache_info[64]
struct SceneRenderView * next
struct SceneRenderView * prev
struct bNodeTree * nodetree
struct Collection * master_collection
struct GHash * depsgraph_hash
struct PhysicsSettings physics_settings
struct RigidBodyWorld * rigidbody_world
IDProperty * layer_properties
void * sound_scene
struct SceneDisplay display
struct CustomData_MeshMasks customdata_mask
struct SceneGpencil grease_pencil_settings
struct MovieClip * clip
short flag
ListBase keyingsets
void * fps_info
struct ToolSettings * toolsettings
ColorManagedViewSettings view_settings
struct PreviewImage * preview
struct Editing * ed
struct bGPdata * gpd
struct RenderData r
View3DCursor cursor
ListBase view_layers
struct CustomData_MeshMasks customdata_mask_modal
TransformOrientationSlot orientation_slots[4]
struct AnimData * adt
struct UnitSettings unit
struct Object * camera
ListBase markers
ListBase transform_spaces
struct World * world
ColorManagedColorspaceSettings sequencer_colorspace_settings
struct Scene * set
struct AudioData audio
struct SceneEEVEE eevee
ColorManagedDisplaySettings display_settings
struct Object * gravity_object
Paint paint
struct MovieClip * clip
struct Scene * scene
ListBase anims
struct Object * scene_camera
struct Sequence * seq3
void * scene_sound
struct Mask * mask
ListBase modifiers
ListBase seqbase
struct bSound * sound
struct Sequence * seq1
struct Sequence * seq2
struct IDProperty * prop
struct Stereo3dFormat * stereo3d_format
struct anim * anim
StripProxy * proxy
StripTransform * transform
StripElem * stripdata
StripCrop * crop
struct VFont * text_font
char name[64]
struct TimeMarker * prev
struct TimeMarker * next
GpWeightPaint * gp_weightpaint
struct ImagePaintSettings imapaint
struct CurveProfile * custom_bevel_profile_preset
GpPaint * gp_paint
struct SequencerToolSettings * sequencer_tool_settings
GpSculptPaint * gp_sculptpaint
struct UnifiedPaintSettings unified_paint_settings
struct GP_Interpolate_Settings gp_interpolate
struct ParticleEditSettings particle
UvSculpt * uvsculpt
struct GP_Sculpt_Settings gp_sculpt
GpVertexPaint * gp_vertexpaint
float rotation_axis[3]
float rotation_quaternion[4]
float rotation_euler[3]
struct IDProperty * prop
View3DShading shading
ListBase object_bases
char name[64]
ListBase curves
ListBase nodes
ListBase areabase
struct Scene * scene
struct wmWindow * next
struct WorkSpaceInstanceHook * workspace_hook
__forceinline const avxi srl(const avxi &a, const int32_t b)
Definition: util_avxi.h:348
uint len