void id_lib_extern(ID *id)
{
- if (id && ID_IS_LINKED_DATABLOCK(id)) {
+ if (id && ID_IS_LINKED(id)) {
BLI_assert(BKE_idcode_is_linkable(GS(id->name)));
if (id->tag & LIB_TAG_INDIRECT) {
id->tag -= LIB_TAG_INDIRECT;
*/
void BKE_id_copy_ensure_local(Main *bmain, const ID *old_id, ID *new_id)
{
- if (ID_IS_LINKED_DATABLOCK(old_id)) {
+ if (ID_IS_LINKED(old_id)) {
BKE_id_expand_local(bmain, new_id);
BKE_id_lib_local_paths(bmain, old_id->lib, new_id);
}
* In case we make a whole lib's content local, we always want to localize, and we skip remapping (done later).
*/
- if (!ID_IS_LINKED_DATABLOCK(id)) {
+ if (!ID_IS_LINKED(id)) {
return;
}
/* Do not make new copy local in case we are copying outside of main...
* XXX TODO: is this behavior OK, or should we need own flag to control that? */
if ((flag & LIB_ID_CREATE_NO_MAIN) == 0) {
+ BLI_assert((flag & LIB_ID_COPY_KEEP_LIB) == 0);
BKE_id_copy_ensure_local(bmain, id, *r_newid);
}
+ else {
+ (*r_newid)->lib = id->lib;
+ }
return true;
}
new_id(lb, id, NULL);
/* alphabetic insertion: is in new_id */
id->tag &= ~(LIB_TAG_NO_MAIN | LIB_TAG_NO_USER_REFCOUNT);
+ bmain->is_memfile_undo_written = false;
BKE_main_unlock(bmain);
}
BKE_main_lock(bmain);
BLI_remlink(lb, id);
id->tag |= LIB_TAG_NO_MAIN;
+ bmain->is_memfile_undo_written = false;
BKE_main_unlock(bmain);
}
/* flag for full recalc */
for (ob = bmain->object.first; ob; ob = ob->id.next) {
- if (ID_IS_LINKED_DATABLOCK(ob)) {
+ if (ID_IS_LINKED(ob)) {
DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
}
}
BKE_main_lock(bmain);
BLI_addtail(lb, id);
new_id(lb, id, name);
+ bmain->is_memfile_undo_written = false;
/* alphabetic insertion: is in new_id */
BKE_main_unlock(bmain);
for (idtest = lb->first; idtest; idtest = idtest->next) {
/* if idtest is not a lib */
- if (id != idtest && !ID_IS_LINKED_DATABLOCK(idtest)) {
+ if (id != idtest && !ID_IS_LINKED(idtest)) {
/* do not test alphabetic! */
/* optimized */
if (idtest->name[2] == name[0]) {
for (idtest = lb->first; idtest; idtest = idtest->next) {
int nrtest;
if ( (id != idtest) &&
- !ID_IS_LINKED_DATABLOCK(idtest) &&
+ !ID_IS_LINKED(idtest) &&
(*name == *(idtest->name + 2)) &&
STREQLEN(name, idtest->name + 2, left_len) &&
(BLI_split_name_num(leftest, &nrtest, idtest->name + 2, '.') == left_len)
char name[MAX_ID_NAME - 2];
/* if library, don't rename */
- if (ID_IS_LINKED_DATABLOCK(id))
+ if (ID_IS_LINKED(id))
return false;
- /* if no libdata given, look up based on ID */
- if (lb == NULL)
- lb = which_libbase(G.main, GS(id->name));
-
/* if no name given, use name of current ID
* else make a copy (tname args can be const) */
if (tname == NULL)
GSet *loop_tags = BLI_gset_ptr_new(__func__);
for (LinkNode *it = todo_ids; it; it = it->next) {
library_make_local_copying_check(it->link, loop_tags, bmain->relations, done_ids);
- BLI_assert(BLI_gset_size(loop_tags) == 0);
+ BLI_assert(BLI_gset_len(loop_tags) == 0);
}
BLI_gset_free(loop_tags, NULL);
BLI_gset_free(done_ids, NULL);
* was not used locally would be a nasty bug! */
if (is_local || is_lib) {
printf("Warning, made-local proxy object %s will loose its link to %s, "
- "because the linked-in proxy is referenced (is_local=%i, is_lib=%i).\n",
- id->newid->name, ob->proxy->id.name, is_local, is_lib);
+ "because the linked-in proxy is referenced (is_local=%i, is_lib=%i).\n",
+ id->newid->name, ob->proxy->id.name, is_local, is_lib);
}
else {
/* we can switch the proxy'ing from the linked-in to the made-local proxy.
* was not used locally would be a nasty bug! */
else if (is_local || is_lib) {
printf("Warning, made-local proxy object %s will loose its link to %s, "
- "because the linked-in proxy is referenced (is_local=%i, is_lib=%i).\n",
- id->newid->name, ob->proxy->id.name, is_local, is_lib);
+ "because the linked-in proxy is referenced (is_local=%i, is_lib=%i).\n",
+ id->newid->name, ob->proxy->id.name, is_local, is_lib);
}
else {
/* we can switch the proxy'ing from the linked-in to the made-local proxy.
ListBase *lb;
ID *idtest;
-
lb = which_libbase(bmain, GS(name));
if (lb == NULL) return;
void BKE_id_tag_set_atomic(ID *id, int tag)
{
- atomic_fetch_and_or_uint32((uint32_t *)&id->tag, tag);
+ atomic_fetch_and_or_int32(&id->tag, tag);
}
void BKE_id_tag_clear_atomic(ID *id, int tag)
{
- atomic_fetch_and_and_uint32((uint32_t *)&id->tag, ~tag);
+ atomic_fetch_and_and_int32(&id->tag, ~tag);
}