2023-05-31 16:19:06 +02:00
|
|
|
/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2020-02-10 16:54:24 +01:00
|
|
|
#pragma once
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2019-02-17 22:08:12 +01:00
|
|
|
/** \file
|
|
|
|
* \ingroup bke
|
2020-02-10 15:05:54 +01:00
|
|
|
*
|
2020-02-15 05:58:06 +01:00
|
|
|
* API to manage data-blocks inside of Blender's Main data-base, or as independent runtime-only
|
2020-02-10 15:05:54 +01:00
|
|
|
* data.
|
|
|
|
*
|
|
|
|
* \note `BKE_lib_` files are for operations over data-blocks themselves, although they might
|
|
|
|
* alter Main as well (when creating/renaming/deleting an ID e.g.).
|
|
|
|
*
|
|
|
|
* \section Function Names
|
|
|
|
*
|
|
|
|
* \warning Descriptions below is ideal goal, current status of naming does not yet fully follow it
|
|
|
|
* (this is WIP).
|
|
|
|
*
|
|
|
|
* - `BKE_lib_id_` should be used for rather high-level operations, that involve Main database and
|
|
|
|
* relations with other IDs, and can be considered as 'safe' (as in, in themselves, they leave
|
|
|
|
* affected IDs/Main in a consistent status).
|
|
|
|
* - `BKE_lib_libblock_` should be used for lower level operations, that perform some parts of
|
|
|
|
* `BKE_lib_id_` ones, but will generally not ensure caller that affected data is in a consistent
|
|
|
|
* state by their own execution alone.
|
|
|
|
* - `BKE_lib_main_` should be used for operations performed over all IDs of a given Main
|
|
|
|
* data-base.
|
|
|
|
*
|
|
|
|
* \note External code should typically not use `BKE_lib_libblock_` functions, except in some
|
|
|
|
* specific cases requiring advanced (and potentially dangerous) handling.
|
2011-02-18 14:05:18 +01:00
|
|
|
*/
|
2020-02-10 15:05:54 +01:00
|
|
|
|
2020-05-08 18:16:39 +02:00
|
|
|
#include "BLI_compiler_attrs.h"
|
2021-11-04 20:51:37 +01:00
|
|
|
#include "BLI_utildefines.h"
|
2020-05-08 18:16:39 +02:00
|
|
|
|
2023-04-25 03:45:12 +02:00
|
|
|
#include "DNA_userdef_enums.h"
|
|
|
|
|
2010-10-05 02:05:14 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2020-09-30 03:51:13 +02:00
|
|
|
struct BlendWriter;
|
2016-11-01 13:39:31 +01:00
|
|
|
struct GHash;
|
2002-10-12 13:37:38 +02:00
|
|
|
struct ID;
|
|
|
|
struct Library;
|
2019-01-28 11:08:24 +01:00
|
|
|
struct ListBase;
|
|
|
|
struct Main;
|
2011-06-29 06:34:20 +02:00
|
|
|
struct PointerRNA;
|
|
|
|
struct PropertyRNA;
|
2019-01-28 11:08:24 +01:00
|
|
|
struct bContext;
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Get allocation size of a given data-block type and optionally allocation name.
|
|
|
|
*/
|
2017-06-13 17:42:31 +02:00
|
|
|
size_t BKE_libblock_get_alloc_info(short type, const char **name);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Allocates and returns memory of the right size for the specified block type,
|
|
|
|
* initialized to zero.
|
|
|
|
*/
|
2018-01-25 00:21:31 +01:00
|
|
|
void *BKE_libblock_alloc_notest(short type) ATTR_WARN_UNUSED_RESULT;
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Allocates and returns a block of the specified type, with the specified name
|
|
|
|
* (adjusted as necessary to ensure uniqueness), and appended to the specified list.
|
|
|
|
* The user count is set to 1, all other content (apart from name and links) being
|
|
|
|
* initialized to zero.
|
|
|
|
*/
|
2022-01-07 01:38:08 +01:00
|
|
|
void *BKE_libblock_alloc(struct Main *bmain, short type, const char *name, int flag)
|
2018-05-04 12:53:20 +02:00
|
|
|
ATTR_WARN_UNUSED_RESULT;
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Initialize an ID of given type, such that it has valid 'empty' data.
|
|
|
|
* ID is assumed to be just calloc'ed.
|
|
|
|
*/
|
2018-01-25 00:21:31 +01:00
|
|
|
void BKE_libblock_init_empty(struct ID *id) ATTR_NONNULL(1);
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
|
2022-02-11 14:53:08 +01:00
|
|
|
/**
|
|
|
|
* Reset the runtime counters used by ID remapping.
|
|
|
|
*/
|
|
|
|
void BKE_libblock_runtime_reset_remapping_status(struct ID *id) ATTR_NONNULL(1);
|
|
|
|
|
2020-03-05 16:17:14 +01:00
|
|
|
/* *** ID's session_uuid management. *** */
|
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
2022-09-21 03:57:20 +02:00
|
|
|
* When an ID's UUID is of that value, it is unset/invalid (e.g. for runtime IDs, etc.).
|
2021-12-07 07:19:15 +01:00
|
|
|
*/
|
2020-03-05 16:17:14 +01:00
|
|
|
#define MAIN_ID_SESSION_UUID_UNSET 0
|
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
2022-09-21 03:57:20 +02:00
|
|
|
* Generate a session-wise UUID for the given \a id.
|
2021-12-07 07:19:15 +01:00
|
|
|
*
|
|
|
|
* \note "session-wise" here means while editing a given .blend file. Once a new .blend file is
|
2022-09-21 03:57:20 +02:00
|
|
|
* loaded or created, undo history is cleared/reset, and so is the UUID counter.
|
2021-12-07 07:19:15 +01:00
|
|
|
*/
|
2020-03-05 16:17:14 +01:00
|
|
|
void BKE_lib_libblock_session_uuid_ensure(struct ID *id);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
2022-09-21 03:57:20 +02:00
|
|
|
* Re-generate a new session-wise UUID for the given \a id.
|
2021-12-07 07:19:15 +01:00
|
|
|
*
|
|
|
|
* \warning This has a few very specific use-cases, no other usage is expected currently:
|
|
|
|
* - To handle UI-related data-blocks that are kept across new file reading, when we do keep
|
|
|
|
* existing UI.
|
|
|
|
* - For IDs that are made local without needing any copying.
|
|
|
|
*/
|
2020-04-21 18:26:32 +02:00
|
|
|
void BKE_lib_libblock_session_uuid_renew(struct ID *id);
|
2020-03-05 16:17:14 +01:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Generic helper to create a new empty data-block of given type in given \a bmain database.
|
|
|
|
*
|
|
|
|
* \param name: can be NULL, in which case we get default name for this ID type.
|
|
|
|
*/
|
2022-01-07 01:38:08 +01:00
|
|
|
void *BKE_id_new(struct Main *bmain, short type, const char *name);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Generic helper to create a new temporary empty data-block of given type,
|
|
|
|
* *outside* of any Main database.
|
|
|
|
*
|
|
|
|
* \param name: can be NULL, in which case we get default name for this ID type.
|
|
|
|
*/
|
2022-01-07 01:38:08 +01:00
|
|
|
void *BKE_id_new_nomain(short type, const char *name);
|
2018-05-04 12:53:20 +02:00
|
|
|
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
/**
|
|
|
|
* New ID creation/copying options.
|
|
|
|
*/
|
|
|
|
enum {
|
|
|
|
/* *** Generic options (should be handled by all ID types copying, ID creation, etc.). *** */
|
2022-09-16 10:13:19 +02:00
|
|
|
/** Create data-block outside of any main database -
|
2019-04-27 04:07:07 +02:00
|
|
|
* similar to 'localize' functions of materials etc. */
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
LIB_ID_CREATE_NO_MAIN = 1 << 0,
|
2022-09-16 10:13:19 +02:00
|
|
|
/** Do not affect user refcount of data-blocks used by new one
|
|
|
|
* (which also gets zero user-count then).
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
* Implies LIB_ID_CREATE_NO_MAIN. */
|
|
|
|
LIB_ID_CREATE_NO_USER_REFCOUNT = 1 << 1,
|
2022-09-16 10:13:19 +02:00
|
|
|
/** Assume given 'newid' already points to allocated memory for whole data-block
|
2019-04-27 04:07:07 +02:00
|
|
|
* (ID + data) - USE WITH CAUTION!
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
* Implies LIB_ID_CREATE_NO_MAIN. */
|
|
|
|
LIB_ID_CREATE_NO_ALLOCATE = 1 << 2,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-27 04:07:07 +02:00
|
|
|
/** Do not tag new ID for update in depsgraph. */
|
2019-02-04 16:29:02 +01:00
|
|
|
LIB_ID_CREATE_NO_DEG_TAG = 1 << 8,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-10-06 17:43:12 +02:00
|
|
|
/** Very similar to #LIB_ID_CREATE_NO_MAIN, and should never be used with it (typically combined
|
|
|
|
* with #LIB_ID_CREATE_LOCALIZE or #LIB_ID_COPY_LOCALIZE in fact).
|
|
|
|
* It ensures that IDs created with it will get the #LIB_TAG_LOCALIZED tag, and uses some
|
|
|
|
* specific code in some copy cases (mostly for node trees). */
|
|
|
|
LIB_ID_CREATE_LOCAL = 1 << 9,
|
|
|
|
|
2021-05-18 04:53:28 +02:00
|
|
|
/** Create for the depsgraph, when set #LIB_TAG_COPIED_ON_WRITE must be set.
|
|
|
|
* Internally this is used to share some pointers instead of duplicating them. */
|
|
|
|
LIB_ID_COPY_SET_COPIED_ON_WRITE = 1 << 10,
|
|
|
|
|
2019-02-04 16:29:02 +01:00
|
|
|
/* *** Specific options to some ID types or usages. *** */
|
|
|
|
/* *** May be ignored by unrelated ID copying functions. *** */
|
2019-04-27 04:07:07 +02:00
|
|
|
/** Object only, needed by make_local code. */
|
2020-02-20 00:21:23 +01:00
|
|
|
/* LIB_ID_COPY_NO_PROXY_CLEAR = 1 << 16, */ /* UNUSED */
|
2019-04-27 04:07:07 +02:00
|
|
|
/** Do not copy preview data, when supported. */
|
2019-02-04 16:29:02 +01:00
|
|
|
LIB_ID_COPY_NO_PREVIEW = 1 << 17,
|
2019-04-27 04:07:07 +02:00
|
|
|
/** Copy runtime data caches. */
|
2019-02-04 16:29:02 +01:00
|
|
|
LIB_ID_COPY_CACHES = 1 << 18,
|
2022-09-21 03:57:20 +02:00
|
|
|
/** Don't copy `id->adt`, used by ID data-block localization routines. */
|
2019-02-04 16:29:02 +01:00
|
|
|
LIB_ID_COPY_NO_ANIMDATA = 1 << 19,
|
2022-03-10 01:32:48 +01:00
|
|
|
/** Do not copy id->override_library, used by ID data-block override routines. */
|
2021-04-10 15:16:38 +02:00
|
|
|
LIB_ID_COPY_NO_LIB_OVERRIDE = 1 << 21,
|
2021-11-19 11:48:25 +01:00
|
|
|
/** When copying local sub-data (like constraints or modifiers), do not set their "library
|
|
|
|
* override local data" flag. */
|
|
|
|
LIB_ID_COPY_NO_LIB_OVERRIDE_LOCAL_DATA_FLAG = 1 << 22,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-02-04 16:29:02 +01:00
|
|
|
/* *** XXX Hackish/not-so-nice specific behaviors needed for some corner cases. *** */
|
|
|
|
/* *** Ideally we should not have those, but we need them for now... *** */
|
2022-03-10 01:32:48 +01:00
|
|
|
/** EXCEPTION! Deep-copy actions used by animation-data of copied ID. */
|
2019-02-04 16:29:02 +01:00
|
|
|
LIB_ID_COPY_ACTIONS = 1 << 24,
|
2022-03-10 01:32:48 +01:00
|
|
|
/** Keep the library pointer when copying data-block outside of bmain. */
|
2019-02-04 16:29:02 +01:00
|
|
|
LIB_ID_COPY_KEEP_LIB = 1 << 25,
|
2022-03-10 01:32:48 +01:00
|
|
|
/** EXCEPTION! Deep-copy shape-keys used by copied obdata ID. */
|
2019-02-04 16:29:02 +01:00
|
|
|
LIB_ID_COPY_SHAPEKEY = 1 << 26,
|
2020-09-27 11:59:07 +02:00
|
|
|
/** EXCEPTION! Specific deep-copy of node trees used e.g. for rendering purposes. */
|
|
|
|
LIB_ID_COPY_NODETREE_LOCALIZE = 1 << 27,
|
2021-11-13 03:07:13 +01:00
|
|
|
/**
|
|
|
|
* EXCEPTION! Specific handling of RB objects regarding collections differs depending whether we
|
|
|
|
* duplicate scene/collections, or objects.
|
|
|
|
*/
|
2021-09-30 15:22:16 +02:00
|
|
|
LIB_ID_COPY_RIGID_BODY_NO_COLLECTION_HANDLING = 1 << 28,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-02-04 17:27:01 +01:00
|
|
|
/* *** Helper 'defines' gathering most common flag sets. *** */
|
2022-03-10 01:32:48 +01:00
|
|
|
/** Shape-keys are not real ID's, more like local data to geometry IDs. */
|
2019-02-04 17:27:01 +01:00
|
|
|
LIB_ID_COPY_DEFAULT = LIB_ID_COPY_SHAPEKEY,
|
2020-09-27 11:59:07 +02:00
|
|
|
|
|
|
|
/** Create a local, outside of bmain, data-block to work on. */
|
|
|
|
LIB_ID_CREATE_LOCALIZE = LIB_ID_CREATE_NO_MAIN | LIB_ID_CREATE_NO_USER_REFCOUNT |
|
|
|
|
LIB_ID_CREATE_NO_DEG_TAG,
|
2019-04-27 04:07:07 +02:00
|
|
|
/** Generate a local copy, outside of bmain, to work on (used by COW e.g.). */
|
2021-04-10 15:16:38 +02:00
|
|
|
LIB_ID_COPY_LOCALIZE = LIB_ID_CREATE_LOCALIZE | LIB_ID_COPY_NO_PREVIEW | LIB_ID_COPY_CACHES |
|
|
|
|
LIB_ID_COPY_NO_LIB_OVERRIDE,
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
};
|
|
|
|
|
2019-09-16 22:55:44 +02:00
|
|
|
void BKE_libblock_copy_ex(struct Main *bmain,
|
|
|
|
const struct ID *id,
|
|
|
|
struct ID **r_newid,
|
2022-01-07 01:38:08 +01:00
|
|
|
int orig_flag);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Used everywhere in blenkernel.
|
|
|
|
*/
|
2017-06-14 22:36:30 +02:00
|
|
|
void *BKE_libblock_copy(struct Main *bmain, const struct ID *id) ATTR_WARN_UNUSED_RESULT
|
|
|
|
ATTR_NONNULL();
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Sets the name of a block to name, suitably adjusted for uniqueness.
|
|
|
|
*/
|
2015-12-28 07:17:25 +01:00
|
|
|
void BKE_libblock_rename(struct Main *bmain, struct ID *id, const char *name) ATTR_NONNULL();
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Use after setting the ID's name
|
|
|
|
* When name exists: call 'new_id'
|
|
|
|
*/
|
2015-12-28 07:17:25 +01:00
|
|
|
void BLI_libblock_ensure_unique_name(struct Main *bmain, const char *name) ATTR_NONNULL();
|
|
|
|
|
2018-05-31 16:04:04 +02:00
|
|
|
struct ID *BKE_libblock_find_name(struct Main *bmain,
|
2022-01-07 01:38:08 +01:00
|
|
|
short type,
|
2018-05-31 16:04:04 +02:00
|
|
|
const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
|
2021-11-05 17:19:12 +01:00
|
|
|
struct ID *BKE_libblock_find_session_uuid(struct Main *bmain, short type, uint32_t session_uuid);
|
2020-06-17 15:02:04 +02:00
|
|
|
/**
|
|
|
|
* Duplicate (a.k.a. deep copy) common processing options.
|
|
|
|
* See also eDupli_ID_Flags for options controlling what kind of IDs to duplicate.
|
|
|
|
*/
|
|
|
|
typedef enum eLibIDDuplicateFlags {
|
|
|
|
/** This call to a duplicate function is part of another call for some parent ID.
|
2021-08-24 12:23:39 +02:00
|
|
|
* Therefore, this sub-process should not clear `newid` pointers, nor handle remapping itself.
|
|
|
|
* NOTE: In some cases (like Object one), the duplicate function may be called on the root ID
|
|
|
|
* with this flag set, as remapping and/or other similar tasks need to be handled by the caller.
|
|
|
|
*/
|
2020-06-17 15:02:04 +02:00
|
|
|
LIB_ID_DUPLICATE_IS_SUBPROCESS = 1 << 0,
|
2021-08-24 12:23:39 +02:00
|
|
|
/** This call is performed on a 'root' ID, and should therefore perform some decisions regarding
|
|
|
|
* sub-IDs (dependencies), check for linked vs. locale data, etc. */
|
|
|
|
LIB_ID_DUPLICATE_IS_ROOT_ID = 1 << 1,
|
2020-06-17 15:02:04 +02:00
|
|
|
} eLibIDDuplicateFlags;
|
|
|
|
|
2021-11-04 20:51:37 +01:00
|
|
|
ENUM_OPERATORS(eLibIDDuplicateFlags, LIB_ID_DUPLICATE_IS_ROOT_ID)
|
|
|
|
|
2023-07-31 03:50:54 +02:00
|
|
|
/* `lib_remap.cc` (keep here since they're general functions) */
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
/**
|
|
|
|
* New freeing logic options.
|
|
|
|
*/
|
|
|
|
enum {
|
|
|
|
/* *** Generic options (should be handled by all ID types freeing). *** */
|
2019-06-26 04:40:22 +02:00
|
|
|
/** Do not try to remove freed ID from given Main (passed Main may be NULL). */
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
LIB_ID_FREE_NO_MAIN = 1 << 0,
|
2019-06-26 04:40:22 +02:00
|
|
|
/**
|
2022-09-16 10:13:19 +02:00
|
|
|
* Do not affect user refcount of data-blocks used by freed one.
|
2019-06-26 04:40:22 +02:00
|
|
|
* Implies LIB_ID_FREE_NO_MAIN.
|
|
|
|
*/
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
LIB_ID_FREE_NO_USER_REFCOUNT = 1 << 1,
|
2019-06-26 04:40:22 +02:00
|
|
|
/**
|
2022-09-16 10:13:19 +02:00
|
|
|
* Assume freed ID data-block memory is managed elsewhere, do not free it
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
* (still calls relevant ID type's freeing function though) - USE WITH CAUTION!
|
2019-06-26 04:40:22 +02:00
|
|
|
* Implies LIB_ID_FREE_NO_MAIN.
|
|
|
|
*/
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
LIB_ID_FREE_NOT_ALLOCATED = 1 << 2,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-06-26 04:40:22 +02:00
|
|
|
/** Do not tag freed ID for update in depsgraph. */
|
|
|
|
LIB_ID_FREE_NO_DEG_TAG = 1 << 8,
|
|
|
|
/** Do not attempt to remove freed ID from UI data/notifiers/... */
|
|
|
|
LIB_ID_FREE_NO_UI_USER = 1 << 9,
|
2022-09-16 10:13:19 +02:00
|
|
|
/** Do not remove freed ID's name from a potential runtime name-map. */
|
2022-07-27 10:49:29 +02:00
|
|
|
LIB_ID_FREE_NO_NAMEMAP_REMOVE = 1 << 10,
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
};
|
|
|
|
|
2022-01-07 01:38:08 +01:00
|
|
|
void BKE_libblock_free_datablock(struct ID *id, int flag) ATTR_NONNULL();
|
|
|
|
void BKE_libblock_free_data(struct ID *id, bool do_id_user) ATTR_NONNULL();
|
2019-01-14 21:24:25 +01:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* In most cases #BKE_id_free_ex handles this, when lower level functions are called directly
|
|
|
|
* this function will need to be called too, if Python has access to the data.
|
|
|
|
*
|
|
|
|
* ID data-blocks such as #Material.nodetree are not stored in #Main.
|
|
|
|
*/
|
2021-08-11 08:56:11 +02:00
|
|
|
void BKE_libblock_free_data_py(struct ID *id);
|
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Complete ID freeing, extended version for corner cases.
|
|
|
|
* Can override default (and safe!) freeing process, to gain some speed up.
|
|
|
|
*
|
|
|
|
* At that point, given id is assumed to not be used by any other data-block already
|
|
|
|
* (might not be actually true, in case e.g. several inter-related IDs get freed together...).
|
|
|
|
* However, they might still be using (referencing) other IDs, this code takes care of it if
|
|
|
|
* #LIB_TAG_NO_USER_REFCOUNT is not defined.
|
|
|
|
*
|
|
|
|
* \param bmain: #Main database containing the freed #ID,
|
|
|
|
* can be NULL in case it's a temp ID outside of any #Main.
|
|
|
|
* \param idv: Pointer to ID to be freed.
|
|
|
|
* \param flag: Set of \a LIB_ID_FREE_... flags controlling/overriding usual freeing process,
|
|
|
|
* 0 to get default safe behavior.
|
2022-09-16 10:13:19 +02:00
|
|
|
* \param use_flag_from_idtag: Still use freeing info flags from given #ID data-block,
|
2021-12-07 07:19:15 +01:00
|
|
|
* even if some overriding ones are passed in \a flag parameter.
|
|
|
|
*/
|
2022-01-07 01:38:08 +01:00
|
|
|
void BKE_id_free_ex(struct Main *bmain, void *idv, int flag, bool use_flag_from_idtag);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Complete ID freeing, should be usable in most cases (even for out-of-Main IDs).
|
|
|
|
*
|
|
|
|
* See #BKE_id_free_ex description for full details.
|
|
|
|
*
|
|
|
|
* \param bmain: Main database containing the freed ID,
|
|
|
|
* can be NULL in case it's a temp ID outside of any Main.
|
|
|
|
* \param idv: Pointer to ID to be freed.
|
|
|
|
*/
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
void BKE_id_free(struct Main *bmain, void *idv);
|
2019-01-14 16:22:27 +01:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Not really a freeing function by itself,
|
2022-09-16 10:13:19 +02:00
|
|
|
* it decrements user-count of given id, and only frees it if it reaches 0.
|
2021-12-07 07:19:15 +01:00
|
|
|
*/
|
2019-01-16 11:50:20 +01:00
|
|
|
void BKE_id_free_us(struct Main *bmain, void *idv) ATTR_NONNULL();
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Properly delete a single ID from given \a bmain database.
|
|
|
|
*/
|
2019-01-16 11:50:20 +01:00
|
|
|
void BKE_id_delete(struct Main *bmain, void *idv) ATTR_NONNULL();
|
2023-05-10 16:14:00 +02:00
|
|
|
/**
|
|
|
|
* Like BKE_id_delete, but with extra corner-case options.
|
|
|
|
*
|
2023-05-20 13:24:42 +02:00
|
|
|
* \param extra_remapping_flags: Additional `ID_REMAP_` flags to pass to remapping code when
|
2023-05-10 16:14:00 +02:00
|
|
|
* ensuring that deleted IDs are not used by any other ID in given `bmain`. Typical example would
|
|
|
|
* be e.g. `ID_REMAP_FORCE_UI_POINTERS`, required when default UI-handling callbacks of remapping
|
2023-05-20 13:24:42 +02:00
|
|
|
* code won't be working (e.g. from readfile code).
|
|
|
|
*/
|
2023-05-10 16:14:00 +02:00
|
|
|
void BKE_id_delete_ex(struct Main *bmain, void *idv, const int extra_remapping_flags)
|
|
|
|
ATTR_NONNULL(1, 2);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Properly delete all IDs tagged with \a LIB_TAG_DOIT, in given \a bmain database.
|
|
|
|
*
|
|
|
|
* This is more efficient than calling #BKE_id_delete repetitively on a large set of IDs
|
|
|
|
* (several times faster when deleting most of the IDs at once).
|
|
|
|
*
|
|
|
|
* \warning Considered experimental for now, seems to be working OK but this is
|
|
|
|
* risky code in a complicated area.
|
2022-09-16 10:13:19 +02:00
|
|
|
* \return Number of deleted data-blocks.
|
2021-12-07 07:19:15 +01:00
|
|
|
*/
|
2020-12-22 14:05:49 +01:00
|
|
|
size_t BKE_id_multi_tagged_delete(struct Main *bmain) ATTR_NONNULL();
|
2019-01-14 21:24:25 +01:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
2022-09-16 10:13:19 +02:00
|
|
|
* Add a 'NO_MAIN' data-block to given main (also sets user-counts of its IDs if needed).
|
2021-12-07 07:19:15 +01:00
|
|
|
*/
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
void BKE_libblock_management_main_add(struct Main *bmain, void *idv);
|
2021-12-07 07:19:15 +01:00
|
|
|
/** Remove a data-block from given main (set it to 'NO_MAIN' status). */
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
void BKE_libblock_management_main_remove(struct Main *bmain, void *idv);
|
|
|
|
|
|
|
|
void BKE_libblock_management_usercounts_set(struct Main *bmain, void *idv);
|
|
|
|
void BKE_libblock_management_usercounts_clear(struct Main *bmain, void *idv);
|
|
|
|
|
2002-10-12 13:37:38 +02:00
|
|
|
void id_lib_extern(struct ID *id);
|
2019-09-16 14:52:06 +02:00
|
|
|
void id_lib_indirect_weak_link(struct ID *id);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Ensure we have a real user
|
|
|
|
*
|
|
|
|
* \note Now that we have flags, we could get rid of the 'fake_user' special case,
|
|
|
|
* flags are enough to ensure we always have a real user.
|
|
|
|
* However, #ID_REAL_USERS is used in several places outside of core lib.c,
|
|
|
|
* so think we can wait later to make this change.
|
|
|
|
*/
|
2012-12-18 09:41:38 +01:00
|
|
|
void id_us_ensure_real(struct ID *id);
|
2016-02-22 12:09:36 +01:00
|
|
|
void id_us_clear_real(struct ID *id);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Same as \a id_us_plus, but does not handle lib indirect -> extern.
|
2023-07-31 03:50:54 +02:00
|
|
|
* Only used by `readfile.cc` so far, but simpler/safer to keep it here nonetheless.
|
2021-12-07 07:19:15 +01:00
|
|
|
*/
|
2016-03-14 15:05:52 +01:00
|
|
|
void id_us_plus_no_lib(struct ID *id);
|
2002-10-12 13:37:38 +02:00
|
|
|
void id_us_plus(struct ID *id);
|
2021-12-07 07:19:15 +01:00
|
|
|
/* decrements the user count for *id. */
|
2009-05-27 02:03:49 +02:00
|
|
|
void id_us_min(struct ID *id);
|
2015-11-09 20:59:42 +01:00
|
|
|
void id_fake_user_set(struct ID *id);
|
|
|
|
void id_fake_user_clear(struct ID *id);
|
2021-09-16 12:16:35 +02:00
|
|
|
void BKE_id_newptr_and_tag_clear(struct ID *id);
|
2012-05-05 16:03:12 +02:00
|
|
|
|
2021-02-05 06:23:34 +01:00
|
|
|
/** Flags to control make local code behavior. */
|
2020-03-04 11:42:15 +01:00
|
|
|
enum {
|
|
|
|
/** Making that ID local is part of making local a whole library. */
|
|
|
|
LIB_ID_MAKELOCAL_FULL_LIBRARY = 1 << 0,
|
|
|
|
|
2021-09-06 17:37:04 +02:00
|
|
|
/** In case caller code already knows this ID should be made local without copying. */
|
|
|
|
LIB_ID_MAKELOCAL_FORCE_LOCAL = 1 << 1,
|
|
|
|
/** In case caller code already knows this ID should be made local using copying. */
|
|
|
|
LIB_ID_MAKELOCAL_FORCE_COPY = 1 << 2,
|
|
|
|
|
2021-10-21 12:55:15 +02:00
|
|
|
/** Clear asset data (in case the ID can actually be made local, in copy case asset data is never
|
|
|
|
* copied over). */
|
|
|
|
LIB_ID_MAKELOCAL_ASSET_DATA_CLEAR = 1 << 3,
|
2023-06-27 11:49:56 +02:00
|
|
|
|
|
|
|
/** Clear any liboverride data as part of making this linked data local. */
|
|
|
|
LIB_ID_MAKELOCAL_LIBOVERRIDE_CLEAR = 1 << 4,
|
2020-03-04 11:42:15 +01:00
|
|
|
};
|
|
|
|
|
2022-01-24 17:38:36 +01:00
|
|
|
/**
|
|
|
|
* Helper to decide whether given `id` can be directly made local, or needs to be copied.
|
|
|
|
* `r_force_local` and `r_force_copy` cannot be true together. But both can be false, in case no
|
|
|
|
* action should be performed.
|
|
|
|
*
|
|
|
|
* \note low-level helper to de-duplicate logic between `BKE_lib_id_make_local_generic` and the
|
|
|
|
* specific corner-cases implementations needed for objects and brushes.
|
|
|
|
*/
|
|
|
|
void BKE_lib_id_make_local_generic_action_define(
|
|
|
|
struct Main *bmain, struct ID *id, int flags, bool *r_force_local, bool *r_force_copy);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Generic 'make local' function, works for most of data-block types.
|
|
|
|
*/
|
2022-01-07 01:38:08 +01:00
|
|
|
void BKE_lib_id_make_local_generic(struct Main *bmain, struct ID *id, int flags);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Calls the appropriate make_local method for the block, unless test is set.
|
|
|
|
*
|
|
|
|
* \note Always set #ID.newid pointer in case it gets duplicated.
|
|
|
|
*
|
|
|
|
* \param flags: Special flag used when making a whole library's content local,
|
|
|
|
* it needs specific handling.
|
|
|
|
* \return true is the ID has successfully been made local.
|
|
|
|
*/
|
2022-01-07 01:38:08 +01:00
|
|
|
bool BKE_lib_id_make_local(struct Main *bmain, struct ID *id, int flags);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* \note Does *not* set #ID.newid pointer.
|
|
|
|
*/
|
2013-03-10 06:46:24 +01:00
|
|
|
bool id_single_user(struct bContext *C,
|
|
|
|
struct ID *id,
|
|
|
|
struct PointerRNA *ptr,
|
|
|
|
struct PropertyRNA *prop);
|
2022-08-03 10:48:43 +02:00
|
|
|
|
|
|
|
/** Test whether given `id` can be copied or not. */
|
2019-02-04 15:34:31 +01:00
|
|
|
bool BKE_id_copy_is_allowed(const struct ID *id);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Generic entry point for copying a data-block (new API).
|
|
|
|
*
|
|
|
|
* \note Copy is generally only affecting the given data-block
|
|
|
|
* (no ID used by copied one will be affected, besides user-count).
|
|
|
|
*
|
|
|
|
* There are exceptions though:
|
|
|
|
* - Embedded IDs (root node trees and master collections) are always copied with their owner.
|
2022-03-10 01:32:48 +01:00
|
|
|
* - If #LIB_ID_COPY_ACTIONS is defined, actions used by anim-data will be duplicated.
|
2021-12-07 07:19:15 +01:00
|
|
|
* - If #LIB_ID_COPY_SHAPEKEY is defined, shape-keys will be duplicated.
|
|
|
|
* - If #LIB_ID_CREATE_LOCAL is defined, root node trees will be deep-duplicated recursively.
|
|
|
|
*
|
|
|
|
* \note User-count of new copy is always set to 1.
|
|
|
|
*
|
|
|
|
* \param bmain: Main database, may be NULL only if LIB_ID_CREATE_NO_MAIN is specified.
|
|
|
|
* \param id: Source data-block.
|
|
|
|
* \param r_newid: Pointer to new (copied) ID pointer, may be NULL.
|
|
|
|
* Used to allow copying into already allocated memory.
|
|
|
|
* \param flag: Set of copy options, see `DNA_ID.h` enum for details
|
|
|
|
* (leave to zero for default, full copy).
|
|
|
|
* \return NULL when copying that ID type is not supported, the new copy otherwise.
|
|
|
|
*/
|
2022-01-07 01:38:08 +01:00
|
|
|
struct ID *BKE_id_copy_ex(struct Main *bmain, const struct ID *id, struct ID **r_newid, int flag);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
2022-08-03 10:48:43 +02:00
|
|
|
* Invoke the appropriate copy method for the block and return the new id as result.
|
|
|
|
*
|
|
|
|
* See #BKE_id_copy_ex for details.
|
|
|
|
*/
|
|
|
|
struct ID *BKE_id_copy(struct Main *bmain, const struct ID *id);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Invoke the appropriate copy method for the block and return the new id as result.
|
|
|
|
*
|
|
|
|
* Unlike #BKE_id_copy, it does set the #ID.newid pointer of the given `id` to the copied one.
|
|
|
|
*
|
|
|
|
* It is designed as a basic common helper for the higher-level 'duplicate' operations (aka 'deep
|
|
|
|
* copy' of data-blocks and some of their dependency ones), see e.g. #BKE_object_duplicate.
|
|
|
|
*
|
|
|
|
* Currently, it only handles the given ID, and their shape keys and actions if any, according to
|
|
|
|
* the given `duplicate_flags`.
|
|
|
|
*
|
2022-08-11 03:17:24 +02:00
|
|
|
* \param duplicate_flags: is of type #eDupli_ID_Flags, see #UserDef.dupflag. Currently only
|
2022-08-03 10:48:43 +02:00
|
|
|
* `USER_DUP_LINKED_ID` and `USER_DUP_ACT` have an effect here.
|
2022-08-11 03:17:24 +02:00
|
|
|
* \param copy_flags: flags passed to #BKE_id_copy_ex.
|
2021-12-07 07:19:15 +01:00
|
|
|
*/
|
2020-06-17 17:01:21 +02:00
|
|
|
struct ID *BKE_id_copy_for_duplicate(struct Main *bmain,
|
|
|
|
struct ID *id,
|
2023-04-25 03:45:12 +02:00
|
|
|
eDupli_ID_Flags duplicate_flags,
|
2022-01-07 01:38:08 +01:00
|
|
|
int copy_flags);
|
2020-03-17 11:13:14 +01:00
|
|
|
|
2022-08-11 03:17:24 +02:00
|
|
|
/**
|
|
|
|
* Special version of #BKE_id_copy which is safe from using evaluated id as source with a copy
|
2022-08-03 10:54:11 +02:00
|
|
|
* result appearing in the main database.
|
2022-08-11 03:17:24 +02:00
|
|
|
* Takes care of the referenced data-blocks consistency.
|
|
|
|
*/
|
2022-08-03 10:54:11 +02:00
|
|
|
struct ID *BKE_id_copy_for_use_in_bmain(struct Main *bmain, const struct ID *id);
|
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Does a mere memory swap over the whole IDs data (including type-specific memory).
|
|
|
|
* \note Most internal ID data itself is not swapped (only IDProperties are).
|
|
|
|
*
|
2023-04-17 17:17:02 +02:00
|
|
|
* \param bmain: May be NULL, in which case there is no guarantee that internal remapping of ID
|
2023-04-19 00:02:41 +02:00
|
|
|
* pointers to themselves will be complete (regarding depsgraph and/or runtime data updates).
|
2023-04-17 17:17:02 +02:00
|
|
|
* \param do_self_remap: Whether to remap internal pointers to itself or not.
|
|
|
|
* \param self_remap_flags: Flags controlling self remapping, see BKE_lib_remap.h.
|
2021-12-07 07:19:15 +01:00
|
|
|
*/
|
2023-04-17 17:17:02 +02:00
|
|
|
void BKE_lib_id_swap(struct Main *bmain,
|
|
|
|
struct ID *id_a,
|
|
|
|
struct ID *id_b,
|
|
|
|
const bool do_self_remap,
|
|
|
|
const int self_remap_flags);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Does a mere memory swap over the whole IDs data (including type-specific memory).
|
|
|
|
* \note All internal ID data itself is also swapped.
|
|
|
|
*
|
2023-04-17 17:17:02 +02:00
|
|
|
* For parameters description, see #BKE_lib_id_swap above.
|
2021-12-07 07:19:15 +01:00
|
|
|
*/
|
2023-04-17 17:17:02 +02:00
|
|
|
void BKE_lib_id_swap_full(struct Main *bmain,
|
|
|
|
struct ID *id_a,
|
|
|
|
struct ID *id_b,
|
|
|
|
const bool do_self_remap,
|
|
|
|
const int self_remap_flags);
|
2020-03-17 11:13:14 +01:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Sort given \a id into given \a lb list, using case-insensitive comparison of the id names.
|
|
|
|
*
|
|
|
|
* \note All other IDs beside given one are assumed already properly sorted in the list.
|
|
|
|
*
|
|
|
|
* \param id_sorting_hint: Ignored if NULL. Otherwise, used to check if we can insert \a id
|
|
|
|
* immediately before or after that pointer. It must always be into given \a lb list.
|
|
|
|
*/
|
2019-12-19 21:58:59 +01:00
|
|
|
void id_sort_by_name(struct ListBase *lb, struct ID *id, struct ID *id_sorting_hint);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Expand ID usages of given id as 'extern' (and no more indirect) linked data.
|
|
|
|
* Used by ID copy/make_local functions.
|
|
|
|
*/
|
2022-01-07 01:38:08 +01:00
|
|
|
void BKE_lib_id_expand_local(struct Main *bmain, struct ID *id, int flags);
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Ensures given ID has a unique name in given listbase.
|
|
|
|
*
|
2023-11-15 11:33:36 +01:00
|
|
|
* Uniqueness is only ensured within the ID's library (nullptr for local ones), libraries act as
|
|
|
|
* some kind of namespace for IDs.
|
2021-12-07 07:19:15 +01:00
|
|
|
*
|
2023-02-06 17:19:02 +01:00
|
|
|
* \param name: The new name of the given ID, if NULL the current given ID name is used instead.
|
2021-12-07 07:19:15 +01:00
|
|
|
* \param do_linked_data: if true, also ensure a unique name in case the given \a id is linked
|
|
|
|
* (otherwise, just ensure that it is properly sorted).
|
|
|
|
*
|
|
|
|
* \return true if a new name had to be created.
|
|
|
|
*/
|
IDManagement: Speedup ID unique name assignment by tracking used names/basenames/suffixes
An implementation of T73412, roughly as outlined there:
Track the names that are in use, as well as base names (before
numeric suffix) plus a bit map for each base name, indicating which
numeric suffixes are already used. This is done per-Main/Library,
per-object-type.
Timings (Windows, VS2022 Release build, AMD Ryzen 5950X):
- Scene with 10k cubes, Shift+D to duplicate them all: 8.7s -> 1.9s.
Name map memory usage for resulting 20k objects: 4.3MB.
- Importing a 2.5GB .obj file of exported Blender 3.0 splash scene
(24k objects), using the new C++ importer: 34.2s-> 22.0s. Name map
memory usage for resulting scene: 8.6MB.
- Importing Disney Moana USD scene (almost half a million objects):
56min -> 10min. Name map usage: ~100MB. Blender crashes later on
when trying to render it, in the same place in both cases, but
that's for another day.
Reviewed By: Bastien Montagne
Differential Revision: https://developer.blender.org/D14162
2022-07-20 13:27:14 +02:00
|
|
|
bool BKE_id_new_name_validate(struct Main *bmain,
|
|
|
|
struct ListBase *lb,
|
2021-06-01 11:39:28 +02:00
|
|
|
struct ID *id,
|
|
|
|
const char *name,
|
IDManagement: Speedup ID unique name assignment by tracking used names/basenames/suffixes
An implementation of T73412, roughly as outlined there:
Track the names that are in use, as well as base names (before
numeric suffix) plus a bit map for each base name, indicating which
numeric suffixes are already used. This is done per-Main/Library,
per-object-type.
Timings (Windows, VS2022 Release build, AMD Ryzen 5950X):
- Scene with 10k cubes, Shift+D to duplicate them all: 8.7s -> 1.9s.
Name map memory usage for resulting 20k objects: 4.3MB.
- Importing a 2.5GB .obj file of exported Blender 3.0 splash scene
(24k objects), using the new C++ importer: 34.2s-> 22.0s. Name map
memory usage for resulting scene: 8.6MB.
- Importing Disney Moana USD scene (almost half a million objects):
56min -> 10min. Name map usage: ~100MB. Blender crashes later on
when trying to render it, in the same place in both cases, but
that's for another day.
Reviewed By: Bastien Montagne
Differential Revision: https://developer.blender.org/D14162
2022-07-20 13:27:14 +02:00
|
|
|
bool do_linked_data) ATTR_NONNULL(1, 2, 3);
|
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Pull an ID out of a library (make it local). Only call this for IDs that
|
|
|
|
* don't have other library users.
|
|
|
|
*
|
|
|
|
* \param flags: Same set of `LIB_ID_MAKELOCAL_` flags as passed to #BKE_lib_id_make_local.
|
|
|
|
*/
|
2022-01-07 01:38:08 +01:00
|
|
|
void BKE_lib_id_clear_library_data(struct Main *bmain, struct ID *id, int flags);
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Clear or set given tags for all ids of given type in `bmain` (runtime tags).
|
|
|
|
*
|
|
|
|
* \note Affect whole Main database.
|
|
|
|
*/
|
2022-01-07 01:38:08 +01:00
|
|
|
void BKE_main_id_tag_idcode(struct Main *mainvar, short type, int tag, bool value);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Clear or set given tags for all ids in listbase (runtime tags).
|
|
|
|
*/
|
2022-01-07 01:38:08 +01:00
|
|
|
void BKE_main_id_tag_listbase(struct ListBase *lb, int tag, bool value);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Clear or set given tags for all ids in bmain (runtime tags).
|
|
|
|
*/
|
2022-01-07 01:38:08 +01:00
|
|
|
void BKE_main_id_tag_all(struct Main *mainvar, int tag, bool value);
|
2013-12-30 03:25:27 +01:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Clear or set given flags for all ids in listbase (persistent flags).
|
|
|
|
*/
|
2022-01-07 01:38:08 +01:00
|
|
|
void BKE_main_id_flag_listbase(struct ListBase *lb, int flag, bool value);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Clear or set given flags for all ids in bmain (persistent flags).
|
|
|
|
*/
|
2022-01-07 01:38:08 +01:00
|
|
|
void BKE_main_id_flag_all(struct Main *bmain, int flag, bool value);
|
2013-12-30 03:25:27 +01:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
2023-07-31 03:50:54 +02:00
|
|
|
* Next to indirect usage in `readfile.cc` / `writefile.cc` also in `editobject.c`, `scene.cc`.
|
2021-12-07 07:19:15 +01:00
|
|
|
*/
|
2021-05-27 14:44:02 +02:00
|
|
|
void BKE_main_id_newptr_and_tag_clear(struct Main *bmain);
|
2011-01-05 06:33:27 +01:00
|
|
|
|
2022-01-07 01:38:08 +01:00
|
|
|
void BKE_main_id_refcount_recompute(struct Main *bmain, bool do_linked_only);
|
2019-05-22 21:08:51 +02:00
|
|
|
|
2013-12-30 03:25:27 +01:00
|
|
|
void BKE_main_lib_objects_recalc_all(struct Main *bmain);
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Only for repairing files via versioning, avoid for general use.
|
|
|
|
*/
|
IDManagement: Speedup ID unique name assignment by tracking used names/basenames/suffixes
An implementation of T73412, roughly as outlined there:
Track the names that are in use, as well as base names (before
numeric suffix) plus a bit map for each base name, indicating which
numeric suffixes are already used. This is done per-Main/Library,
per-object-type.
Timings (Windows, VS2022 Release build, AMD Ryzen 5950X):
- Scene with 10k cubes, Shift+D to duplicate them all: 8.7s -> 1.9s.
Name map memory usage for resulting 20k objects: 4.3MB.
- Importing a 2.5GB .obj file of exported Blender 3.0 splash scene
(24k objects), using the new C++ importer: 34.2s-> 22.0s. Name map
memory usage for resulting scene: 8.6MB.
- Importing Disney Moana USD scene (almost half a million objects):
56min -> 10min. Name map usage: ~100MB. Blender crashes later on
when trying to render it, in the same place in both cases, but
that's for another day.
Reviewed By: Bastien Montagne
Differential Revision: https://developer.blender.org/D14162
2022-07-20 13:27:14 +02:00
|
|
|
void BKE_main_id_repair_duplicate_names_listbase(struct Main *bmain, struct ListBase *lb);
|
2019-01-29 13:43:11 +01:00
|
|
|
|
2018-10-31 12:18:36 +01:00
|
|
|
#define MAX_ID_FULL_NAME (64 + 64 + 3 + 1) /* 64 is MAX_ID_NAME - 2 */
|
2019-07-07 07:38:41 +02:00
|
|
|
#define MAX_ID_FULL_NAME_UI (MAX_ID_FULL_NAME + 3) /* Adds 'keycode' two letters at beginning. */
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Generate full name of the data-block (without ID code, but with library if any).
|
|
|
|
*
|
|
|
|
* \note Result is unique to a given ID type in a given Main database.
|
|
|
|
*
|
|
|
|
* \param name: An allocated string of minimal length #MAX_ID_FULL_NAME,
|
|
|
|
* will be filled with generated string.
|
|
|
|
* \param separator_char: Character to use for separating name and library name.
|
|
|
|
* Can be 0 to use default (' ').
|
|
|
|
*/
|
2020-09-04 20:59:13 +02:00
|
|
|
void BKE_id_full_name_get(char name[MAX_ID_FULL_NAME], const struct ID *id, char separator_char);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Generate full name of the data-block (without ID code, but with library if any),
|
|
|
|
* with a 2 to 3 character prefix prepended indicating whether it comes from a library,
|
|
|
|
* is overriding, has a fake or no user, etc.
|
|
|
|
*
|
|
|
|
* \note Result is unique to a given ID type in a given Main database.
|
|
|
|
*
|
|
|
|
* \param name: An allocated string of minimal length #MAX_ID_FULL_NAME_UI,
|
|
|
|
* will be filled with generated string.
|
|
|
|
* \param separator_char: Character to use for separating name and library name.
|
|
|
|
* Can be 0 to use default (' ').
|
|
|
|
* \param r_prefix_len: The length of the prefix added.
|
|
|
|
*/
|
2020-06-10 15:08:23 +02:00
|
|
|
void BKE_id_full_name_ui_prefix_get(char name[MAX_ID_FULL_NAME_UI],
|
|
|
|
const struct ID *id,
|
2022-01-07 01:38:08 +01:00
|
|
|
bool add_lib_hint,
|
2020-07-23 09:24:17 +02:00
|
|
|
char separator_char,
|
|
|
|
int *r_prefix_len);
|
2013-12-30 03:25:27 +01:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Generate a concatenation of ID name (including two-chars type code) and its lib name, if any.
|
|
|
|
*
|
|
|
|
* \return A unique allocated string key for any ID in the whole Main database.
|
|
|
|
*/
|
2018-08-23 08:37:32 +02:00
|
|
|
char *BKE_id_to_unique_string_key(const struct ID *id);
|
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Make linked data-blocks local.
|
|
|
|
*
|
|
|
|
* \param bmain: Almost certainly global main.
|
|
|
|
* \param lib: If not NULL, only make local data-blocks from this library.
|
|
|
|
* \param untagged_only: If true, only make local data-blocks not tagged with
|
|
|
|
* #LIB_TAG_PRE_EXISTING.
|
|
|
|
* \param set_fake: If true, set fake user on all localized data-blocks
|
|
|
|
* (except group and objects ones).
|
|
|
|
*/
|
2016-05-13 12:54:09 +02:00
|
|
|
void BKE_library_make_local(struct Main *bmain,
|
2016-11-01 13:39:31 +01:00
|
|
|
const struct Library *lib,
|
|
|
|
struct GHash *old_to_new_ids,
|
2022-01-07 01:38:08 +01:00
|
|
|
bool untagged_only,
|
|
|
|
bool set_fake);
|
2013-12-30 03:25:27 +01:00
|
|
|
|
2016-11-08 17:54:14 +01:00
|
|
|
void BKE_id_tag_set_atomic(struct ID *id, int tag);
|
|
|
|
void BKE_id_tag_clear_atomic(struct ID *id, int tag);
|
2007-12-24 19:38:03 +01:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Check that given ID pointer actually is in G_MAIN.
|
|
|
|
* Main intended use is for debug asserts in places we cannot easily get rid of #G_Main.
|
|
|
|
*/
|
2018-11-09 13:44:02 +01:00
|
|
|
bool BKE_id_is_in_global_main(struct ID *id);
|
2018-06-22 11:37:08 +02:00
|
|
|
|
2020-12-11 23:16:29 +01:00
|
|
|
bool BKE_id_can_be_asset(const struct ID *id);
|
|
|
|
|
2022-09-08 13:06:40 +02:00
|
|
|
/**
|
|
|
|
* Return the owner ID of the given `id`, if any.
|
|
|
|
*
|
2022-09-09 07:37:33 +02:00
|
|
|
* \note This will only return non-NULL for embedded IDs (master collections etc.), and shape-keys.
|
2022-09-08 13:06:40 +02:00
|
|
|
*/
|
|
|
|
struct ID *BKE_id_owner_get(struct ID *id);
|
|
|
|
|
2023-05-27 07:10:58 +02:00
|
|
|
/**
|
|
|
|
* Check if that ID can be considered as editable from a high-level (editor) perspective.
|
2022-03-28 17:34:36 +02:00
|
|
|
*
|
|
|
|
* NOTE: This used to be done with a check on whether ID was linked or not, but now with system
|
|
|
|
* overrides this is not enough anymore.
|
|
|
|
*
|
|
|
|
* NOTE: Execution of this function can be somewhat expensive currently. If this becomes an issue,
|
|
|
|
* we should either cache that status info also in virtual override IDs, or address the
|
2022-03-30 02:38:24 +02:00
|
|
|
* long-standing TODO of getting an efficient 'owner_id' access for all embedded ID types.
|
|
|
|
*/
|
2022-05-31 17:31:32 +02:00
|
|
|
bool BKE_id_is_editable(const struct Main *bmain, const struct ID *id);
|
2022-03-28 17:34:36 +02:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Returns ordered list of data-blocks for display in the UI.
|
|
|
|
* Result is list of #LinkData of IDs that must be freed.
|
|
|
|
*/
|
2018-08-23 16:13:52 +02:00
|
|
|
void BKE_id_ordered_list(struct ListBase *ordered_lb, const struct ListBase *lb);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Reorder ID in the list, before or after the "relative" ID.
|
|
|
|
*/
|
2018-08-23 16:13:52 +02:00
|
|
|
void BKE_id_reorder(const struct ListBase *lb, struct ID *id, struct ID *relative, bool after);
|
|
|
|
|
2020-08-28 15:45:11 +02:00
|
|
|
void BKE_id_blend_write(struct BlendWriter *writer, struct ID *id);
|
|
|
|
|
Split id->flag in two, persistent flags and runtime tags.
This is purely internal sanitizing/cleanup, no change in behavior is expected at all.
This change was also needed because we were getting short on ID flags, and
future enhancement of 'user_one' ID behavior requires two new ones.
id->flag remains for persistent data (fakeuser only, so far!), this also allows us
100% backward & forward compatibility.
New id->tag is used for most flags. Though written in .blend files, its content
is cleared at read time.
Note that .blend file version was bumped, so that we can clear runtimeflags from
old .blends, important in case we add new persistent flags in future.
Also, behavior of tags (either status ones, or whether they need to be cleared before/after use)
has been added as comments to their declaration.
Reviewers: sergey, campbellbarton
Differential Revision: https://developer.blender.org/D1683
2015-12-27 11:53:50 +01:00
|
|
|
#define IS_TAGGED(_id) ((_id) && (((ID *)_id)->tag & LIB_TAG_DOIT))
|
2010-12-20 08:21:08 +01:00
|
|
|
|
2023-07-31 03:50:54 +02:00
|
|
|
/* `lib_id_eval.cc` */
|
2021-12-07 07:19:15 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Copy relatives parameters, from `id` to `id_cow`.
|
|
|
|
* Use handle the #ID_RECALC_PARAMETERS tag.
|
|
|
|
* \note Keep in sync with #ID_TYPE_SUPPORTS_PARAMS_WITHOUT_COW.
|
|
|
|
*/
|
2021-06-24 11:13:52 +02:00
|
|
|
void BKE_id_eval_properties_copy(struct ID *id_cow, struct ID *id);
|
|
|
|
|
2010-10-05 02:05:14 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|