Blender V5.3
usd_capi_import.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2019 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#include "IO_types.hh"
6#include "usd.hh"
7#include "usd_hook.hh"
9#include "usd_reader_geom.hh"
10#include "usd_reader_prim.hh"
11#include "usd_reader_stage.hh"
12
13#include "BKE_cachefile.hh"
14#include "BKE_collection.hh"
15#include "BKE_context.hh"
16#include "BKE_global.hh"
17#include "BKE_layer.hh"
18#include "BKE_lib_id.hh"
19#include "BKE_library.hh"
20#include "BKE_main.hh"
21#include "BKE_object.hh"
22#include "BKE_report.hh"
23
24#include "BLI_listbase.hh"
25#include "BLI_path_utils.hh"
26#include "BLI_string.hh"
27#include "BLI_timeit.hh"
28
29#include "BLT_translation.hh"
30
31#include "DEG_depsgraph.hh"
33
34#include "DNA_cachefile_types.h"
36#include "DNA_layer_types.h"
37#include "DNA_listBase.h"
38#include "DNA_object_types.h"
39#include "DNA_scene_types.h"
41
42#include "ED_undo.hh"
43
44#include "MEM_guardedalloc.h"
45
46#include "WM_api.hh"
47#include "WM_types.hh"
48
49#include <pxr/usd/usd/stage.h>
50#include <pxr/usd/usdGeom/metrics.h>
51
52#include <fmt/core.h>
53
54#include "CLG_log.h"
55
56namespace blender {
57
58static CLG_LogRef LOG = {"io.usd"};
59
60namespace io::usd {
61
63{
64 return reinterpret_cast<CacheArchiveHandle *>(reader);
65}
66
68{
69 return reinterpret_cast<USDStageReader *>(handle);
70}
71
72static bool gather_objects_paths(const pxr::UsdPrim &object,
73 ListBaseT<CacheObjectPath> *object_paths)
74{
75 if (!object.IsValid()) {
76 return false;
77 }
78
79 for (const pxr::UsdPrim &childPrim : object.GetChildren()) {
80 gather_objects_paths(childPrim, object_paths);
81 }
82
83 CacheObjectPath *usd_path = MEM_new<CacheObjectPath>("CacheObjectPath");
84
85 STRNCPY(usd_path->path, object.GetPrimPath().GetString().c_str());
86 BLI_addtail(object_paths, usd_path);
87
88 return true;
89}
90
91enum {
94};
95
115
117{
118 timeit::Nanoseconds duration = timeit::Clock::now() - data->start_time;
119 fmt::print("USD import of '{}' took ", data->filepath);
120 timeit::print_duration(duration);
121 fmt::print("\n");
122}
123
124static void import_startjob(void *customdata, wmJobWorkerStatus *worker_status)
125{
126 ImportJobData *data = static_cast<ImportJobData *>(customdata);
127 data->was_canceled = false;
128 data->archive = nullptr;
129 data->start_time = timeit::Clock::now();
130 data->cache_file = nullptr;
131
132 data->params.worker_status = worker_status;
133
134 if (data->wm) {
135 WM_locked_interface_set(data->wm, true);
136 }
137 G.is_break = false;
138
140
141 pxr::UsdStagePopulationMask pop_mask;
142 for (const std::string &mask_token : pxr::TfStringTokenize(data->params.prim_path_mask, ",;")) {
143 pxr::SdfPath prim_path(mask_token);
144 if (!prim_path.IsEmpty()) {
145 pop_mask.Add(prim_path);
146 }
147 }
148
149 pxr::UsdStageRefPtr stage = pop_mask.IsEmpty() ?
150 pxr::UsdStage::Open(data->filepath) :
151 pxr::UsdStage::OpenMasked(data->filepath, pop_mask);
152
153 if (!stage) {
154 BKE_reportf(worker_status->reports,
155 RPT_ERROR,
156 "USD Import: unable to open stage to read %s",
157 data->filepath);
158 data->import_ok = false;
159 data->error_code = USD_ARCHIVE_FAIL;
160 return;
161 }
162
163 worker_status->progress = 0.05f;
164 worker_status->do_update = true;
165 if (G.is_break) {
166 data->was_canceled = true;
167 return;
168 }
169
170 double scene_scale = data->params.scale;
171 if (data->params.apply_unit_conversion_scale) {
172 scene_scale *= pxr::UsdGeomGetStageMetersPerUnit(stage);
173 }
174
175 /* Callback function to lazily create a cache file when converting
176 * time varying data. */
177 auto get_cache_file = [data, scene_scale]() {
178 if (!data->cache_file) {
179 data->cache_file = static_cast<CacheFile *>(
180 BKE_cachefile_add(data->bmain, BLI_path_basename(data->filepath)));
181
182 /* Decrement the ID ref-count because it is going to be incremented for each
183 * modifier and constraint that it will be attached to, so since currently
184 * it is not used by anyone, its use count will off by one. */
185 id_us_min(&data->cache_file->id);
186
187 data->cache_file->is_sequence = data->params.is_sequence;
188 data->cache_file->scale = scene_scale;
189 STRNCPY(data->cache_file->filepath, data->filepath);
190 if (data->params.relative_path && !BLI_path_is_rel(data->cache_file->filepath)) {
191 BLI_path_rel(data->cache_file->filepath, BKE_main_blendfile_path_from_global());
192 }
193 }
194 return data->cache_file;
195 };
196
197 USDStageReader *archive = new USDStageReader(stage, data->params, get_cache_file);
198 data->archive = archive;
199
200 /* Ensure Python types for invoking hooks are registered. */
202
204
205 worker_status->progress = 0.1f;
206 worker_status->do_update = true;
207 if (G.is_break) {
208 data->was_canceled = true;
209 return;
210 }
211
212 archive->collect_readers();
213
214 worker_status->progress = 0.15f;
215 worker_status->do_update = true;
216 if (G.is_break) {
217 data->was_canceled = true;
218 return;
219 }
220
221 if (data->params.import_lights && data->params.create_world_material &&
222 !archive->dome_light_readers().is_empty())
223 {
224 /* NOTE: Since Blender does not have dome light objects, we need to modify the Scene directly
225 * in order to setup environment lighting. */
226 if (data->scene) {
227 USDDomeLightReader *dome_light_reader = archive->dome_light_readers().first();
228 dome_light_reader->create_object(data->scene, data->bmain);
229 }
230 }
231
232 if (data->params.import_materials && data->params.import_all_materials) {
233 archive->import_all_materials(data->bmain);
234 }
235
236 worker_status->progress = 0.2f;
237 worker_status->do_update = true;
238
239 /* Sort readers by name: when creating a lot of objects in Blender,
240 * it is much faster if the order is sorted by name. */
241 archive->sort_readers();
242
243 worker_status->progress = 0.25f;
244 worker_status->do_update = true;
245
246 const float size = float(archive->readers().size());
247 size_t i = 0;
248
249 /* Create blender objects. */
250 for (USDPrimReader *reader : archive->readers()) {
251 reader->create_object(data->bmain);
252
253 worker_status->progress = 0.25f + 0.25f * (++i / size);
254 worker_status->do_update = true;
255
256 if (G.is_break) {
257 data->was_canceled = true;
258 return;
259 }
260 }
261
262 /* Setup parenthood and read actual object data. */
263 i = 0;
264 for (USDPrimReader *reader : archive->readers()) {
265 Object *ob = reader->object();
266 reader->read_object_data(data->bmain, 0.0);
267
268 USDPrimReader *parent = reader->parent();
269 if (parent == nullptr) {
270 ob->parent = nullptr;
271 }
272 else {
273 ob->parent = parent->object();
274 }
275
276 worker_status->progress = 0.5f + 0.5f * (++i / size);
277 worker_status->do_update = true;
278
279 if (G.is_break) {
280 data->was_canceled = true;
281 return;
282 }
283 }
284
285 if (data->params.import_skeletons) {
287 }
288
289 data->import_ok = !data->was_canceled;
290
291 worker_status->progress = 1.0f;
292 worker_status->do_update = true;
293}
294
295static void import_endjob(void *customdata)
296{
297 ImportJobData *data = static_cast<ImportJobData *>(customdata);
298
299 /* Delete objects on cancellation. */
300 if (data->was_canceled && data->archive) {
301 for (const USDPrimReader *reader : data->archive->readers()) {
302 /* It's possible that cancellation occurred between the creation of
303 * the reader and the creation of the Blender object. */
304 if (Object *ob = reader->object()) {
305 BKE_id_free_us(data->bmain, ob);
306 }
307 }
308 }
309 else if (data->archive) {
310 Collection *collection_dst = nullptr;
311
312 if (data->scene) {
313 /* Set scene animation range. */
314 if (data->params.set_frame_range) {
315 const pxr::UsdStageRefPtr stage = data->archive->stage();
316 data->scene->r.sfra = stage->GetStartTimeCode();
317 data->scene->r.efra = stage->GetEndTimeCode();
318 }
319
320 ViewLayer *view_layer = CTX_data_view_layer(data->C);
321
322 /* Create a new collection if required. */
323 if (data->params.create_collection) {
324 char display_name[MAX_ID_NAME - 2];
326 display_name, sizeof(display_name), BLI_path_basename(data->filepath));
327 Collection *import_collection = BKE_collection_add(
328 data->bmain, data->scene->master_collection, display_name);
329
330 DEG_id_tag_update(&import_collection->id, ID_RECALC_SYNC_TO_EVAL);
332
333 BKE_view_layer_synced_ensure(*data->bmain, data->scene, view_layer);
335 view_layer, import_collection);
336 }
337
338 BKE_view_layer_base_deselect_all(*data->bmain, data->scene, view_layer);
339
341 if (!ID_IS_EDITABLE(lc->collection)) {
343 data->params.worker_status->reports,
345 "Could not find an editable collection in current scene, imported data will not "
346 "be instantiated");
347 }
348
349 collection_dst = lc->collection;
350 }
351
352 /* Create prototype collections for instancing. */
353 data->archive->create_proto_collections(data->bmain, collection_dst);
354
355 /* Add all objects to the collection. */
356 for (const USDPrimReader *reader : data->archive->readers()) {
357 if (reader->is_in_proto()) {
358 /* Skip prototype prims, as these are added to prototype collections. */
359 continue;
360 }
361 Object *ob = reader->object();
362 if (!ob) {
363 continue;
364 }
365 BKE_collection_object_add(data->bmain, collection_dst, ob);
366 }
367
368 /* Sync and do the view layer operations. */
369 if (data->scene) {
370 ViewLayer *view_layer = CTX_data_view_layer(data->C);
371 BKE_view_layer_synced_ensure(*data->bmain, data->scene, view_layer);
372
373 bool has_instantiated_object = false;
374 bool has_uninstantiated_object = false;
375 for (const USDPrimReader *reader : data->archive->readers()) {
376 Object *ob = reader->object();
377 if (!ob) {
378 continue;
379 }
380 Base *base = BKE_view_layer_base_find(view_layer, ob);
381 if (!base) {
382 /* Object not instantiated in current viewlayer. */
383 has_uninstantiated_object = true;
384 continue;
385 }
386 has_instantiated_object = true;
387 /* TODO: is setting active needed? */
389
392 &ob->id,
395 }
396 if (has_instantiated_object && has_uninstantiated_object) {
397 CLOG_ERROR(&LOG, "Some imported objects were not instantiated, while others were");
398 }
399
401 }
402
404
405 if (data->params.import_materials && data->params.import_all_materials) {
406 data->archive->fake_users_for_unused_materials();
407 }
408
409 data->archive->call_material_import_hooks(data->bmain);
410
411 call_import_hooks(data->archive, data->params.worker_status->reports);
412
413 if (data->is_background_job) {
414 /* Blender already returned from the import operator, so we need to store our own extra undo
415 * step. */
416 ED_undo_push(data->C, "USD Import Finished");
417 }
418 }
419
420 if (data->wm) {
421 WM_locked_interface_set(data->wm, false);
422 }
423
424 switch (data->error_code) {
425 default:
426 case USD_NO_ERROR:
427 data->import_ok = !data->was_canceled;
428 break;
429 case USD_ARCHIVE_FAIL:
430 BKE_report(data->params.worker_status->reports,
431 RPT_ERROR,
432 "Could not open USD archive for reading, see console for detail");
433 break;
434 }
435
438}
439
440static void import_freejob(void *user_data)
441{
442 ImportJobData *data = static_cast<ImportJobData *>(user_data);
443
444 delete data->archive;
445 delete data;
446}
447
449 const char *filepath,
450 const USDImportParams *params,
451 bool as_background_job,
452 ReportList *reports)
453{
454 /* Using new here since `MEM_*` functions do not call constructor to properly initialize data. */
455 ImportJobData *job = new ImportJobData();
456 job->C = C;
457 job->bmain = CTX_data_main(C);
458 job->scene = CTX_data_scene(C); // May be null
459 job->wm = CTX_wm_manager(C); // May be null
460 job->import_ok = false;
461 job->is_background_job = as_background_job;
462 STRNCPY(job->filepath, filepath);
463
465 job->was_canceled = false;
466 job->archive = nullptr;
467
468 job->params = *params;
469
470 G.is_break = false;
471
472 bool import_ok = false;
473 if (as_background_job) {
477 "Importing USD...",
480
481 /* setup job */
483 WM_jobs_timer(wm_job, 0.1, NC_SCENE, NC_SCENE);
484 WM_jobs_callbacks(wm_job, import_startjob, nullptr, nullptr, import_endjob);
485
487 }
488 else {
489 wmJobWorkerStatus worker_status = {};
490 /* Use the operator's reports in non-background case. */
491 worker_status.reports = reports;
492
493 import_startjob(job, &worker_status);
494 import_endjob(job);
495 import_ok = job->import_ok;
496
497 import_freejob(job);
498 }
499
500 return import_ok;
501}
502
503/* TODO(makowalski): Extend this function with basic validation that the
504 * USD reader is compatible with the type of the given (currently unused) 'ob'
505 * Object parameter, similar to the logic in get_abc_reader() in the
506 * Alembic importer code. */
508 const Object * /*ob*/,
509 const char **r_err_str)
510{
511 USDPrimReader *usd_reader = reinterpret_cast<USDPrimReader *>(reader);
512 pxr::UsdPrim iobject = usd_reader->prim();
513
514 if (!iobject.IsValid()) {
515 *r_err_str = RPT_("Invalid object: verify object path");
516 return nullptr;
517 }
518
519 return usd_reader;
520}
521
522USDMeshReadParams create_mesh_read_params(const double motion_sample_time, const int read_flags)
523{
524 USDMeshReadParams params = {};
525 params.motion_sample_time = motion_sample_time;
526 params.read_flags = read_flags;
527 return params;
528}
529
531 const Object *ob,
532 bke::GeometrySet &geometry_set,
533 const USDMeshReadParams params,
534 const char **r_err_str)
535{
536 USDGeomReader *usd_reader = dynamic_cast<USDGeomReader *>(get_usd_reader(reader, ob, r_err_str));
537
538 if (usd_reader == nullptr) {
539 return;
540 }
541
542 usd_reader->read_geometry(geometry_set, params, r_err_str);
543}
544
546 const Object *ob,
547 const Mesh *existing_mesh,
548 const double time,
549 const char **r_err_str)
550{
551 USDGeomReader *usd_reader = dynamic_cast<USDGeomReader *>(get_usd_reader(reader, ob, r_err_str));
552
553 if (usd_reader == nullptr) {
554 return false;
555 }
556
557 return usd_reader->topology_changed(existing_mesh, time);
558}
559
561 CacheReader *reader,
562 Object *object,
563 const char *object_path)
564{
565 if (object_path[0] == '\0') {
566 return reader;
567 }
568
569 USDStageReader *archive = stage_reader_from_handle(handle);
570
571 if (!archive || !archive->valid()) {
572 return reader;
573 }
574
575 if (reader) {
576 USD_CacheReader_free(reader);
577 }
578
579 pxr::UsdPrim prim = archive->stage()->GetPrimAtPath(pxr::SdfPath(object_path));
580
581 if (!prim) {
582 return nullptr;
583 }
584
585 /* TODO(makowalski): The handle does not have the proper import params or settings. */
586 USDPrimReader *usd_reader = archive->create_reader(prim);
587
588 if (usd_reader == nullptr) {
589 /* This object is not supported. */
590 return nullptr;
591 }
592 if (!usd_reader->valid()) {
593 /* This object is invalid for some reason. */
594 return nullptr;
595 }
596 usd_reader->object(object);
597 usd_reader->incref();
598
599 return reinterpret_cast<CacheReader *>(usd_reader);
600}
601
603{
604 USDPrimReader *usd_reader = reinterpret_cast<USDPrimReader *>(reader);
605 usd_reader->decref();
606
607 if (usd_reader->refcount() == 0) {
608 delete usd_reader;
609 }
610}
611
613 const char *filepath,
614 ListBaseT<CacheObjectPath> *object_paths)
615{
616 pxr::UsdStageRefPtr stage = pxr::UsdStage::Open(filepath);
617
618 if (!stage) {
619 return nullptr;
620 }
621
622 USDImportParams params{};
623
624 USDStageReader *stage_reader = new USDStageReader(stage, params);
625
626 if (object_paths) {
627 gather_objects_paths(stage->GetPseudoRoot(), object_paths);
628 }
629
630 return handle_from_stage_reader(stage_reader);
631}
632
634{
635 USDStageReader *stage_reader = stage_reader_from_handle(handle);
636 delete stage_reader;
637}
638
639void USD_get_transform(CacheReader *reader, float4x4 &r_mat_world, float time, float scale)
640{
641 if (!reader) {
642 return;
643 }
644 const USDXformReader *usd_reader = reinterpret_cast<USDXformReader *>(reader);
645 bool is_constant = false;
646
647 /* Convert from the local matrix we obtain from USD to world coordinates
648 * for Blender. This conversion is done here rather than by Blender due to
649 * work around the non-standard interpretation of CONSTRAINT_SPACE_LOCAL in
650 * BKE_constraint_mat_convertspace(). */
651 Object *object = usd_reader->object();
652 if (object->parent == nullptr) {
653 /* No parent, so local space is the same as world space. */
654 usd_reader->read_matrix(r_mat_world, time, scale, &is_constant);
655 return;
656 }
657
658 float4x4 mat_parent;
659 BKE_object_get_parent_matrix(object, object->parent, mat_parent.ptr());
660
661 float4x4 mat_local;
662 usd_reader->read_matrix(mat_local, time, scale, &is_constant);
663
664 r_mat_world = mat_parent * float4x4(object->parentinv);
665 r_mat_world *= mat_local;
666}
667
668} // namespace io::usd
669} // namespace blender
General operations, lookup, etc. for blender objects.
#define FILE_MAX
#define RPT_(msgid)
#define CLOG_ERROR(clg_ref,...)
Definition CLG_log.h:188
#define MAX_ID_NAME
Definition DNA_ID.h:367
#define ID_IS_EDITABLE(_id)
Definition DNA_ID.h:708
Object groups, one object can be in many groups at once.
These structs are the foundation for all linked lists in the library system.
Object is a sort of wrapper for general info.
Read Blender memory allocation and freeing.
#define C
Definition RandGen.cpp:29
#define NC_ID
Definition WM_types.hh:408
#define NC_SCENE
Definition WM_types.hh:391
#define NA_ADDED
Definition WM_types.hh:636
virtual bool topology_changed(const Mesh *, pxr::UsdTimeCode)
virtual void read_geometry(bke::GeometrySet &geometry_set, USDMeshReadParams params, const char **r_err_str)=0
const pxr::UsdPrim & prim() const
USDPrimReader * parent() const
USDPrimReader * create_reader(const pxr::UsdPrim &prim)
const Vector< USDDomeLightReader * > & dome_light_readers() const
USDStageReader(pxr::UsdStageRefPtr stage, const USDImportParams &params, const std::function< CacheFile *()> &get_cache_file_fn={})
const Vector< USDPrimReader * > & readers() const
void import_all_materials(struct Main *bmain)
void read_matrix(float4x4 &r_mat, pxr::UsdTimeCode time, float scale, bool *r_is_constant) const
float3x3 scale(float3x3 mat, float2 scale)
static void import_endjob(void *customdata)
static USDPrimReader * get_usd_reader(CacheReader *reader, const Object *, const char **r_err_str)
CacheReader * CacheReader_open_usd_object(CacheArchiveHandle *handle, CacheReader *reader, Object *object, const char *object_path)
static void import_freejob(void *user_data)
static void report_job_duration(const ExportJobData *data)
bool USD_mesh_topology_changed(CacheReader *reader, const Object *ob, const Mesh *existing_mesh, const double time, const char **r_err_str)
USDMeshReadParams create_mesh_read_params(const double motion_sample_time, const int read_flags)
void USD_read_geometry(CacheReader *reader, const Object *ob, bke::GeometrySet &geometry_set, const USDMeshReadParams params, const char **r_err_str)
bool USD_import(bContext *C, const char *filepath, const USDImportParams *params, bool as_background_job, ReportList *reports)
void call_import_hooks(USDStageReader *archive, ReportList *reports)
Definition usd_hook.cc:619
void USD_get_transform(CacheReader *reader, float4x4 &r_mat_world, float time, float scale)
void USD_free_handle(CacheArchiveHandle *handle)
void USD_CacheReader_free(CacheReader *reader)
static void import_startjob(void *customdata, wmJobWorkerStatus *worker_status)
static bool gather_objects_paths(const pxr::UsdPrim &object, ListBaseT< CacheObjectPath > *object_paths)
static USDStageReader * stage_reader_from_handle(CacheArchiveHandle *handle)
static CacheArchiveHandle * handle_from_stage_reader(USDStageReader *reader)
CacheArchiveHandle * USD_create_handle(Main *, const char *filepath, ListBaseT< CacheObjectPath > *object_paths)
void register_hook_converters()
Definition usd_hook.cc:299
std::chrono::nanoseconds Nanoseconds
Definition BLI_timeit.hh:21
Clock::time_point TimePoint
Definition BLI_timeit.hh:20
void print_duration(Nanoseconds duration)
Definition timeit.cc:45
BMesh Iterators.
void WM_main_add_notifier(uint type, void *reference)
void * BKE_cachefile_add(Main *bmain, const char *name)
Definition cachefile.cc:310
char * STRNCPY(char(&dst)[N], const char *src)
LayerCollection * BKE_layer_collection_get_active_editable(ViewLayer *view_layer)
void BKE_view_layer_base_select_and_set_active(ViewLayer *view_layer, Base *selbase)
@ RPT_WARNING
Definition BKE_report.hh:40
void WM_jobs_callbacks(wmJob *wm_job, wm_jobs_start_callback startjob, void(*initjob)(void *), void(*update)(void *), void(*endjob)(void *))
Definition wm_jobs.cc:407
void BKE_id_free_us(Main *bmain, void *idv) ATTR_NONNULL()
bool BLI_path_abs(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1
void BKE_object_get_parent_matrix(const Object *ob, Object *par, float r_parentmat[4][4])
Definition object.cc:3419
@ WM_JOB_TYPE_USD_IMPORT
Definition WM_api.hh:2038
wmWindow * CTX_wm_window(const bContext *C)
const char * BKE_main_blendfile_path_from_global()
Definition main.cc:1063
void WM_jobs_customdata_set(wmJob *wm_job, void *customdata, void(*free)(void *customdata))
Definition wm_jobs.cc:377
MatBase< float, 4, 4 > float4x4
@ WM_JOB_PROGRESS
Definition WM_api.hh:1997
ViewLayer * CTX_data_view_layer(const bContext *C)
void WM_jobs_start(wmWindowManager *wm, wmJob *wm_job)
Definition wm_jobs.cc:498
Global G
Definition blender.cc:57
void WM_locked_interface_set(wmWindowManager *wm, bool lock)
void void void const char * BLI_path_basename(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
void DEG_id_tag_update_ex(Main *bmain, ID *id, unsigned int flags)
void DEG_id_tag_update(ID *id, unsigned int flags)
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:162
BMesh const char void * data
wmWindowManager * CTX_wm_manager(const bContext *C)
void ED_undo_push(bContext *C, const char *str, UndoEncodeHints hints=UndoEncodeHints(0))
Definition ed_undo.cc:103
bool void BLI_path_rel(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1)
bool BKE_view_layer_synced_ensure(const Main &bmain, const Scene *scene, ViewLayer *view_layer)
LayerCollection * BKE_layer_collection_first_from_scene_collection(const ViewLayer *view_layer, const Collection *collection)
bool BKE_collection_object_add(Main *bmain, Collection *collection, Object *ob)
void BLI_path_to_display_name(char *display_name, int display_name_maxncpy, const char *name) ATTR_NONNULL(1
void BKE_view_layer_base_deselect_all(const Main &bmain, const Scene *scene, ViewLayer *view_layer)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
Definition report.cc:191
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:118
Main * CTX_data_main(const bContext *C)
wmJob * WM_jobs_get(wmWindowManager *wm, wmWindow *win, const void *owner, const char *name, const eWM_JobFlag flag, const eWM_JobType job_type)
Definition wm_jobs.cc:228
bool BLI_path_is_rel(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
@ ID_RECALC_ANIMATION
Definition DNA_ID.h:1077
@ ID_RECALC_TRANSFORM
Definition DNA_ID.h:1054
@ ID_RECALC_SYNC_TO_EVAL
Definition DNA_ID.h:1118
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:1074
@ ID_RECALC_BASE_FLAGS
Definition DNA_ID.h:1104
Base * BKE_view_layer_base_find(ViewLayer *view_layer, Object *ob)
static CLG_LogRef LOG
Definition logging.cpp:12
void DEG_relations_tag_update(Main *bmain)
Scene * CTX_data_scene(const bContext *C)
void id_us_min(ID *id)
Definition lib_id.cc:441
void WM_jobs_timer(wmJob *wm_job, double time_step, uint note, uint endnote, void(*timer_step)(void *))
Definition wm_jobs.cc:393
Collection * BKE_collection_add(Main *bmain, Collection *collection_parent, const char *name_custom)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
struct Collection * collection
const c_style_mat & ptr() const
struct Object * parent
LayerCollection * active_collection