Page MenuHome

check_for_dupid.patch

check_for_dupid.patch

commit dd6a83a3d0d0794b052631e916f35bbcc9fcc658
Author: Lawrence D'Oliveiro <ldo@geek-central.gen.nz>
Date: Thu Feb 7 06:38:31 2013 +0000
more comments
more uses of bool type
define symbol for length of in_use array in check_for_dupid
diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h
index 5aa82be..525d05b 100644
--- a/source/blender/blenkernel/BKE_library.h
+++ b/source/blender/blenkernel/BKE_library.h
@@ -63,7 +63,7 @@ __attribute__((warn_unused_result))
__attribute__((nonnull))
#endif
;
-void BKE_libblock_copy_data(struct ID *id, const struct ID *id_from, const short do_action);
+void BKE_libblock_copy_data(struct ID *id, const struct ID *id_from, bool do_action);
void BKE_id_lib_local_paths(struct Main *bmain, struct Library *lib, struct ID *id);
void id_lib_extern(struct ID *id);
@@ -72,13 +72,13 @@ void id_us_ensure_real(struct ID *id);
void id_us_plus(struct ID *id);
void id_us_min(struct ID *id);
-int id_make_local(struct ID *id, int test);
+bool id_make_local(struct ID *id, bool test);
int id_single_user(struct bContext *C, struct ID *id, struct PointerRNA *ptr, struct PropertyRNA *prop);
-int id_copy(struct ID *id, struct ID **newid, int test);
+bool id_copy(struct ID *id, struct ID **newid, bool test);
int id_unlink(struct ID *id, int test);
void id_sort_by_name(struct ListBase *lb, struct ID *id);
-int new_id(struct ListBase *lb, struct ID *id, const char *name);
+bool new_id(struct ListBase *lb, struct ID *id, const char *name);
void id_clear_lib_data(struct Main *bmain, struct ID *id);
struct ListBase *which_libbase(struct Main *mainlib, short type);
@@ -96,10 +96,10 @@ void tag_main_lb(struct ListBase *lb, const short tag);
void tag_main(struct Main *mainvar, const short tag);
void rename_id(struct ID *id, const char *name);
-void name_uiprefix_id(char *name, struct ID *id);
+void name_uiprefix_id(char *name, const struct ID *id);
void test_idbutton(char *name);
-void text_idbutton(struct ID *id, char *text);
-void BKE_library_make_local(struct Main *bmain, struct Library *lib, int untagged_only);
+void text_idbutton(const struct ID *id, char *text);
+void BKE_library_make_local(struct Main *bmain, struct Library *lib, bool untagged_only);
struct ID *BKE_libblock_find_name(const short type, const char *name)
#ifdef __GNUC__
__attribute__((warn_unused_result))
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index fb2d1a3..2a4562a 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -993,7 +993,7 @@ int BKE_copybuffer_paste(bContext *C, char *libname, ReportList *reports)
/* append, rather than linking */
lib = BLI_findstring(&bmain->library, libname, offsetof(Library, filepath));
- BKE_library_make_local(bmain, lib, 1);
+ BKE_library_make_local(bmain, lib, true);
/* important we unset, otherwise these object wont
* link into other scenes from this blend file */
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index cd40f75..9709e17 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -172,6 +172,7 @@ void id_us_plus(ID *id)
}
void id_us_min(ID *id)
+/* decrements the user count for *id. */
{
if (id) {
if (id->us < 2 && (id->flag & LIB_FAKEUSER)) {
@@ -186,102 +187,106 @@ void id_us_min(ID *id)
}
}
-int id_make_local(ID *id, int test)
+bool id_make_local(ID *id, bool test)
+/* calls the appropriate make_local method for the block, unless test. Returns true
+iff the block can be made local. */
{
if (id->flag & LIB_INDIRECT)
- return 0;
+ return false;
switch (GS(id->name)) {
case ID_SCE:
- return 0; /* not implemented */
+ return false; /* not implemented */
case ID_LI:
- return 0; /* can't be linked */
+ return false; /* can't be linked */
case ID_OB:
if (!test) BKE_object_make_local((Object *)id);
- return 1;
+ return true;
case ID_ME:
if (!test) {
BKE_mesh_make_local((Mesh *)id);
BKE_key_make_local(((Mesh *)id)->key);
}
- return 1;
+ return true;
case ID_CU:
if (!test) {
BKE_curve_make_local((Curve *)id);
BKE_key_make_local(((Curve *)id)->key);
}
- return 1;
+ return true;
case ID_MB:
if (!test) BKE_mball_make_local((MetaBall *)id);
- return 1;
+ return true;
case ID_MA:
if (!test) BKE_material_make_local((Material *)id);
- return 1;
+ return true;
case ID_TE:
if (!test) BKE_texture_make_local((Tex *)id);
- return 1;
+ return true;
case ID_IM:
if (!test) BKE_image_make_local((Image *)id);
- return 1;
+ return true;
case ID_LT:
if (!test) {
BKE_lattice_make_local((Lattice *)id);
BKE_key_make_local(((Lattice *)id)->key);
}
- return 1;
+ return true;
case ID_LA:
if (!test) BKE_lamp_make_local((Lamp *)id);
- return 1;
+ return true;
case ID_CA:
if (!test) BKE_camera_make_local((Camera *)id);
- return 1;
+ return true;
case ID_SPK:
if (!test) BKE_speaker_make_local((Speaker *)id);
- return 1;
+ return true;
case ID_IP:
- return 0; /* deprecated */
+ return false; /* deprecated */
case ID_KE:
if (!test) BKE_key_make_local((Key *)id);
- return 1;
+ return true;
case ID_WO:
if (!test) BKE_world_make_local((World *)id);
- return 1;
+ return true;
case ID_SCR:
- return 0; /* can't be linked */
+ return false; /* can't be linked */
case ID_VF:
- return 0; /* not implemented */
+ return false; /* not implemented */
case ID_TXT:
- return 0; /* not implemented */
+ return false; /* not implemented */
case ID_SCRIPT:
- return 0; /* deprecated */
+ return false; /* deprecated */
case ID_SO:
- return 0; /* not implemented */
+ return false; /* not implemented */
case ID_GR:
- return 0; /* not implemented */
+ return false; /* not implemented */
case ID_AR:
if (!test) BKE_armature_make_local((bArmature *)id);
- return 1;
+ return true;
case ID_AC:
if (!test) BKE_action_make_local((bAction *)id);
- return 1;
+ return true;
case ID_NT:
- return 0; /* not implemented */
+ return false; /* not implemented */
case ID_BR:
if (!test) BKE_brush_make_local((Brush *)id);
- return 1;
+ return true;
case ID_PA:
if (!test) BKE_particlesettings_make_local((ParticleSettings *)id);
- return 1;
+ return true;
case ID_WM:
- return 0; /* can't be linked */
+ return false; /* can't be linked */
case ID_GD:
- return 0; /* not implemented */
+ return false; /* not implemented */
}
- return 0;
+ return false;
}
-int id_copy(ID *id, ID **newid, int test)
+bool id_copy(ID *id, ID **newid, bool test)
+/* invokes the appropriate copy method for the block and returns the result in
+*newid, unless test. Returns true iff the block can be copied. */
{
if (!test) *newid = NULL;
@@ -290,89 +295,89 @@ int id_copy(ID *id, ID **newid, int test)
* - id.us of the new ID is set to 1 */
switch (GS(id->name)) {
case ID_SCE:
- return 0; /* can't be copied from here */
+ return false; /* can't be copied from here */
case ID_LI:
- return 0; /* can't be copied from here */
+ return false; /* can't be copied from here */
case ID_OB:
if (!test) *newid = (ID *)BKE_object_copy((Object *)id);
- return 1;
+ return true;
case ID_ME:
if (!test) *newid = (ID *)BKE_mesh_copy((Mesh *)id);
- return 1;
+ return true;
case ID_CU:
if (!test) *newid = (ID *)BKE_curve_copy((Curve *)id);
- return 1;
+ return true;
case ID_MB:
if (!test) *newid = (ID *)BKE_mball_copy((MetaBall *)id);
- return 1;
+ return true;
case ID_MA:
if (!test) *newid = (ID *)BKE_material_copy((Material *)id);
- return 1;
+ return true;
case ID_TE:
if (!test) *newid = (ID *)BKE_texture_copy((Tex *)id);
- return 1;
+ return true;
case ID_IM:
if (!test) *newid = (ID *)BKE_image_copy((Image *)id);
- return 1;
+ return true;
case ID_LT:
if (!test) *newid = (ID *)BKE_lattice_copy((Lattice *)id);
- return 1;
+ return true;
case ID_LA:
if (!test) *newid = (ID *)BKE_lamp_copy((Lamp *)id);
- return 1;
+ return true;
case ID_SPK:
if (!test) *newid = (ID *)BKE_speaker_copy((Speaker *)id);
- return 1;
+ return true;
case ID_CA:
if (!test) *newid = (ID *)BKE_camera_copy((Camera *)id);
- return 1;
+ return true;
case ID_IP:
- return 0; /* deprecated */
+ return false; /* deprecated */
case ID_KE:
if (!test) *newid = (ID *)BKE_key_copy((Key *)id);
- return 1;
+ return true;
case ID_WO:
if (!test) *newid = (ID *)BKE_world_copy((World *)id);
- return 1;
+ return true;
case ID_SCR:
- return 0; /* can't be copied from here */
+ return false; /* can't be copied from here */
case ID_VF:
- return 0; /* not implemented */
+ return false; /* not implemented */
case ID_TXT:
if (!test) *newid = (ID *)BKE_text_copy((Text *)id);
- return 1;
+ return true;
case ID_SCRIPT:
- return 0; /* deprecated */
+ return false; /* deprecated */
case ID_SO:
- return 0; /* not implemented */
+ return false; /* not implemented */
case ID_GR:
if (!test) *newid = (ID *)BKE_group_copy((Group *)id);
- return 1;
+ return true;
case ID_AR:
if (!test) *newid = (ID *)BKE_armature_copy((bArmature *)id);
- return 1;
+ return true;
case ID_AC:
if (!test) *newid = (ID *)BKE_action_copy((bAction *)id);
- return 1;
+ return true;
case ID_NT:
if (!test) *newid = (ID *)ntreeCopyTree((bNodeTree *)id);
- return 1;
+ return true;
case ID_BR:
if (!test) *newid = (ID *)BKE_brush_copy((Brush *)id);
- return 1;
+ return true;
case ID_PA:
if (!test) *newid = (ID *)BKE_particlesettings_copy((ParticleSettings *)id);
- return 1;
+ return true;
case ID_WM:
- return 0; /* can't be copied from here */
+ return false; /* can't be copied from here */
case ID_GD:
- return 0; /* not implemented */
+ return false; /* not implemented */
case ID_MSK:
if (!test) *newid = (ID *)BKE_mask_copy((Mask *)id);
- return 1;
+ return true;
}
- return 0;
+ return false;
}
int id_unlink(ID *id, int test)
@@ -415,7 +420,7 @@ int id_single_user(bContext *C, ID *id, PointerRNA *ptr, PropertyRNA *prop)
if (id) {
/* if property isn't editable, we're going to have an extra block hanging around until we save */
if (RNA_property_editable(ptr, prop)) {
- if (id_copy(id, &newid, 0) && newid) {
+ if (id_copy(id, &newid, false) && newid) {
/* copy animation actions too */
BKE_copy_animdata_id_action(id);
/* us is 1 by convention, but RNA_property_pointer_set
@@ -538,6 +543,10 @@ void recalc_all_library_objects(Main *main)
/* note: MAX_LIBARRAY define should match this code */
int set_listbasepointers(Main *main, ListBase **lb)
+/* puts into array *lb pointers to all the ListBase structs in main,
+and returns the number of them as the function result. This is useful for
+generic traversal of all the blocks in a Main (by traversing all the
+lists in turn), without worrying about block types. */
{
int a = 0;
@@ -601,6 +610,8 @@ int set_listbasepointers(Main *main, ListBase **lb)
* **************************** */
static ID *alloc_libblock_notest(short type)
+/* allocates and returns memory of the right size for the specified block type,
+initialized to zero. */
{
ID *id = NULL;
@@ -704,6 +715,10 @@ static ID *alloc_libblock_notest(short type)
/* used everywhere in blenkernel and text.c */
void *BKE_libblock_alloc(ListBase *lb, short type, const char *name)
+/* 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. */
{
ID *id = NULL;
@@ -714,25 +729,25 @@ void *BKE_libblock_alloc(ListBase *lb, short type, const char *name)
id->icon_id = 0;
*( (short *)id->name) = type;
new_id(lb, id, name);
- /* alphabetic insterion: is in new_id */
+ /* alphabetic insertion: is in new_id */
}
return id;
}
/* by spec, animdata is first item after ID */
/* and, trust that BKE_animdata_from_id() will only find AnimData for valid ID-types */
-static void id_copy_animdata(ID *id, const short do_action)
+static void id_copy_animdata(ID *id, bool do_action)
{
AnimData *adt = BKE_animdata_from_id(id);
if (adt) {
IdAdtTemplate *iat = (IdAdtTemplate *)id;
- iat->adt = BKE_copy_animdata(iat->adt, do_action); /* could be set to FALSE, need to investigate */
+ iat->adt = BKE_copy_animdata(iat->adt, do_action); /* could be set to false, need to investigate */
}
}
/* material nodes use this since they are not treated as libdata */
-void BKE_libblock_copy_data(ID *id, const ID *id_from, const short do_action)
+void BKE_libblock_copy_data(ID *id, const ID *id_from, bool do_action)
{
if (id_from->properties)
id->properties = IDP_CopyProperty(id_from->properties);
@@ -764,7 +779,7 @@ void *BKE_libblock_copy_ex(Main *bmain, ID *id)
id->newid = idn;
idn->flag |= LIB_NEW;
- BKE_libblock_copy_data(idn, id, FALSE);
+ BKE_libblock_copy_data(idn, id, false);
return idn;
}
@@ -1202,7 +1217,7 @@ static ID *is_dupid(ListBase *lb, ID *id, const char *name)
/*
* Check to see if an ID name is already used, and find a new one if so.
- * Return 1 if created a new name (returned in name).
+ * Return true if created a new name (returned in name).
*
* Normally the ID that's being check is already in the ListBase, so ID *id
* points at the new entry. The Python Library module needs to know what
@@ -1210,11 +1225,16 @@ static ID *is_dupid(ListBase *lb, ID *id, const char *name)
* id is NULL
*/
-static int check_for_dupid(ListBase *lb, ID *id, char *name)
+static bool check_for_dupid(ListBase *lb, ID *id, char *name)
{
ID *idtest;
int nr = 0, nrtest, a, left_len;
- char in_use[64]; /* use as a boolean array, unrelated to name length */
+ enum
+ {
+ max_in_use = 64, /* something reasonable */
+ };
+ bool in_use[max_in_use];
+ /* to speed up finding unused numbers within [1 .. max_in_use - 1] (in_use[0] not used) */
char left[MAX_ID_NAME + 8], leftest[MAX_ID_NAME + 8];
@@ -1222,23 +1242,23 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name)
/* if ( strlen(name) > MAX_ID_NAME-3 ) name[MAX_ID_NAME-3] = 0; */
/* removed since this is only ever called from one place - campbell */
- while (1) {
+ while (true) {
/* phase 1: id already exists? */
idtest = is_dupid(lb, id, name);
/* if there is no double, done */
- if (idtest == NULL) return 0;
+ if (idtest == NULL) return false;
/* we have a dup; need to make a new name */
- /* quick check so we can reuse one of first 64 ids if vacant */
- memset(in_use, 0, sizeof(in_use));
+ /* quick check so we can reuse one of first max_in_use - 1 ids if vacant */
+ memset(in_use, false, sizeof(in_use));
/* get name portion, number portion ("name.number") */
left_len = BLI_split_name_num(left, &nr, name, '.');
/* if new name will be too long, truncate it */
- if (nr > 999 && left_len > (MAX_ID_NAME - 8)) {
+ if (nr > 999 && left_len > (MAX_ID_NAME - 8)) { /* assumption: won't go beyond 9999 */
left[MAX_ID_NAME - 8] = 0;
left_len = MAX_ID_NAME - 8;
}
@@ -1255,21 +1275,24 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name)
(BLI_split_name_num(leftest, &nrtest, idtest->name + 2, '.') == left_len)
)
{
- if (nrtest < sizeof(in_use))
- in_use[nrtest] = 1; /* mark as used */
+ if (nrtest < max_in_use)
+ in_use[nrtest] = true; /* mark as used */
if (nr <= nrtest)
nr = nrtest + 1; /* track largest unused */
}
}
/* decide which value of nr to use */
- for (a = 0; a < sizeof(in_use); a++) {
- if (a >= nr) break; /* stop when we've check up to biggest */
- if (in_use[a] == 0) { /* found an unused value */
+ for (a = 0; a < max_in_use; a++) {
+ if (a >= nr) break; /* stop when we've checked up to biggest */ /* redundant check */
+ if (!in_use[a]) { /* found an unused value */
nr = a;
break;
}
}
+ /* At this point, nr is either the lowest unused number within [0 .. max_in_use - 1],
+ or 1 greater than the largest used number if all those low ones are taken.
+ We can't be bothered to look for the lowest unused number beyond max_in_use - 1. */
/* If the original name has no numeric suffix,
* rather than just chopping and adding numbers,
@@ -1283,7 +1306,7 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name)
name[len--] = '\0';
idtest = is_dupid(lb, id, name);
}
- if (idtest == NULL) return 1;
+ if (idtest == NULL) return true;
/* otherwise just continue and use a number suffix */
}
@@ -1297,7 +1320,7 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name)
/* this format specifier is from hell... */
BLI_snprintf(name, sizeof(id->name) - 2, "%s.%.3d", left, nr);
- return 1;
+ return true;
}
}
@@ -1305,16 +1328,16 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name)
* Only for local blocks: external en indirect blocks already have a
* unique ID.
*
- * return 1: created a new name
+ * return true: created a new name
*/
-int new_id(ListBase *lb, ID *id, const char *tname)
+bool new_id(ListBase *lb, ID *id, const char *tname)
{
- int result;
+ bool result;
char name[MAX_ID_NAME - 2];
/* if library, don't rename */
- if (id->lib) return 0;
+ if (id->lib) return false;
/* if no libdata given, look up based on ID */
if (lb == NULL) lb = which_libbase(G.main, GS(id->name));
@@ -1431,6 +1454,8 @@ static void lib_indirect_test_id(ID *id, Library *lib)
}
}
+#undef LIBTAG
+
void tag_main_lb(ListBase *lb, const short tag)
{
ID *id;
@@ -1466,7 +1491,7 @@ void tag_main(struct Main *mainvar, const short tag)
/* if lib!=NULL, only all from lib local
* bmain is almost certainly G.main */
-void BKE_library_make_local(Main *bmain, Library *lib, int untagged_only)
+void BKE_library_make_local(Main *bmain, Library *lib, bool untagged_only)
{
ListBase *lbarray[MAX_LIBARRAY], tempbase = {NULL, NULL};
ID *id, *idn;
@@ -1486,7 +1511,7 @@ void BKE_library_make_local(Main *bmain, Library *lib, int untagged_only)
* (very nasty to discover all your links are lost after appending)
* */
if (id->flag & (LIB_EXTERN | LIB_INDIRECT | LIB_NEW) &&
- (untagged_only == 0 || !(id->flag & LIB_PRE_EXISTING)))
+ (!untagged_only || !(id->flag & LIB_PRE_EXISTING)))
{
if (lib == NULL || id->lib == lib) {
if (id->lib) {
@@ -1505,6 +1530,7 @@ void BKE_library_make_local(Main *bmain, Library *lib, int untagged_only)
}
/* patch2: make it aphabetically */
+ /* FIXME: but nothing is ever put into tempbase! */
while ( (id = tempbase.first) ) {
BLI_remlink(&tempbase, id);
BLI_addtail(lbarray[a], id);
@@ -1534,12 +1560,14 @@ void test_idbutton(char *name)
/* search for id */
idtest = BLI_findstring(lb, name, offsetof(ID, name) + 2);
- if (idtest && (new_id(lb, idtest, name) == 0)) {
+ if (idtest && !new_id(lb, idtest, name)) {
id_sort_by_name(lb, idtest);
}
}
-void text_idbutton(struct ID *id, char *text)
+void text_idbutton(const struct ID *id, char *text)
+/* puts into *text a descriptive block type prefix to be displayed before the block name. */
+/* Not actually used anywhere any more. */
{
if (id) {
if (GS(id->name) == ID_SCE)
@@ -1562,6 +1590,7 @@ void text_idbutton(struct ID *id, char *text)
}
void rename_id(ID *id, const char *name)
+/* sets the name of a block to name, suitably adjusted for uniqueness. */
{
ListBase *lb;
@@ -1571,7 +1600,9 @@ void rename_id(ID *id, const char *name)
new_id(lb, id, name);
}
-void name_uiprefix_id(char *name, ID *id)
+void name_uiprefix_id(char *name, const ID *id)
+/* returns in name the name of the block, with a 3-character prefix prepended
+indicating whether it comes from a library, has a fake user, or no users. */
{
name[0] = id->lib ? 'L' : ' ';
name[1] = id->flag & LIB_FAKEUSER ? 'F' : (id->us == 0) ? '0' : ' ';
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 97bee32..4ebae07 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -710,7 +710,7 @@ static bNodeTree *ntreeCopyTree_internal(bNodeTree *ntree, const short do_id_use
}
else {
newtree = MEM_dupallocN(ntree);
- BKE_libblock_copy_data(&newtree->id, &ntree->id, TRUE); /* copy animdata and ID props */
+ BKE_libblock_copy_data(&newtree->id, &ntree->id, true); /* copy animdata and ID props */
}
id_us_plus((ID *)newtree->gpd);
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index ff47d48..05ae32f 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -285,7 +285,7 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event)
break;
case UI_ID_LOCAL:
if (id) {
- if (id_make_local(id, 0)) {
+ if (id_make_local(id, false)) {
/* reassign to get get proper updates/notifiers */
idptr = RNA_property_pointer_get(&template->ptr, template->prop);
RNA_property_pointer_set(&template->ptr, template->prop, idptr);
@@ -459,7 +459,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
else {
but = uiDefIconBut(block, BUT, 0, ICON_LIBRARY_DATA_DIRECT, 0, 0, UI_UNIT_X, UI_UNIT_Y,
NULL, 0, 0, 0, 0, TIP_("Direct linked library datablock, click to make local"));
- if (!id_make_local(id, 1 /* test */) || (idfrom && idfrom->lib))
+ if (!id_make_local(id, true /* test */) || (idfrom && idfrom->lib))
uiButSetFlag(but, UI_BUT_DISABLED);
}
@@ -477,7 +477,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_ALONE));
if (/* test only */
- (id_copy(id, NULL, 1) == FALSE) ||
+ (!id_copy(id, NULL, true)) ||
(idfrom && idfrom->lib) ||
(editable == FALSE) ||
/* object in editmode - don't change data */
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 33b159f..7e18f3b 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -1930,11 +1930,11 @@ static void make_local_makelocalmaterial(Material *ma)
AnimData *adt;
int b;
- id_make_local(&ma->id, 0);
+ id_make_local(&ma->id, false);
for (b = 0; b < MAX_MTEX; b++)
if (ma->mtex[b] && ma->mtex[b]->tex)
- id_make_local(&ma->mtex[b]->tex->id, 0);
+ id_make_local(&ma->mtex[b]->tex->id, false);
adt = BKE_animdata_from_id(&ma->id);
if (adt) BKE_animdata_make_local(adt);
@@ -1960,7 +1960,7 @@ static int make_local_exec(bContext *C, wmOperator *op)
int a, b, mode = RNA_enum_get(op->ptr, "type");
if (mode == MAKE_LOCAL_ALL) {
- BKE_library_make_local(bmain, NULL, 0); /* NULL is all libs */
+ BKE_library_make_local(bmain, NULL, false); /* NULL is all libs */
WM_event_add_notifier(C, NC_WINDOW, NULL);
return OPERATOR_FINISHED;
}
@@ -1970,7 +1970,7 @@ static int make_local_exec(bContext *C, wmOperator *op)
CTX_DATA_BEGIN (C, Object *, ob, selected_objects)
{
if (ob->id.lib)
- id_make_local(&ob->id, 0);
+ id_make_local(&ob->id, false);
}
CTX_DATA_END;
@@ -1988,7 +1988,7 @@ static int make_local_exec(bContext *C, wmOperator *op)
id = ob->data;
if (id && (ELEM(mode, MAKE_LOCAL_SELECT_OBDATA, MAKE_LOCAL_SELECT_OBDATA_MATERIAL))) {
- id_make_local(id, 0);
+ id_make_local(id, false);
adt = BKE_animdata_from_id(id);
if (adt) BKE_animdata_make_local(adt);
@@ -2004,7 +2004,7 @@ static int make_local_exec(bContext *C, wmOperator *op)
}
for (psys = ob->particlesystem.first; psys; psys = psys->next)
- id_make_local(&psys->part->id, 0);
+ id_make_local(&psys->part->id, false);
adt = BKE_animdata_from_id(&ob->id);
if (adt) BKE_animdata_make_local(adt);
@@ -2019,7 +2019,7 @@ static int make_local_exec(bContext *C, wmOperator *op)
for (b = 0; b < MAX_MTEX; b++)
if (la->mtex[b] && la->mtex[b]->tex)
- id_make_local(&la->mtex[b]->tex->id, 0);
+ id_make_local(&la->mtex[b]->tex->id, false);
}
else {
for (a = 0; a < ob->totcol; a++) {
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index b2070cc..e5fcdea 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -300,7 +300,7 @@ static void id_local_cb(bContext *C, Scene *UNUSED(scene), TreeElement *UNUSED(t
if (tselem->id->lib && (tselem->id->flag & LIB_EXTERN)) {
/* if the ID type has no special local function,
* just clear the lib */
- if (id_make_local(tselem->id, FALSE) == FALSE) {
+ if (!id_make_local(tselem->id, false)) {
Main *bmain = CTX_data_main(C);
id_clear_lib_data(bmain, tselem->id);
}
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index 184ee23..2dbea7b 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -260,7 +260,7 @@ static ID *rna_ID_copy(ID *id)
{
ID *newid;
- if (id_copy(id, &newid, 0)) {
+ if (id_copy(id, &newid, false)) {
if (newid) id_us_min(newid);
return newid;
}
diff --git a/source/blender/python/intern/bpy_library.c b/source/blender/python/intern/bpy_library.c
index ec6322a..3f66fb7 100644
--- a/source/blender/python/intern/bpy_library.c
+++ b/source/blender/python/intern/bpy_library.c
@@ -411,7 +411,7 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args))
/* append, rather than linking */
if ((self->flag & FILE_LINK) == 0) {
- BKE_library_make_local(bmain, lib, 1);
+ BKE_library_make_local(bmain, lib, true);
}
}
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index e22694a..e651d4c 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -2143,7 +2143,7 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
/* append, rather than linking */
if ((flag & FILE_LINK) == 0) {
Library *lib = BLI_findstring(&bmain->library, libname, offsetof(Library, filepath));
- if (lib) BKE_library_make_local(bmain, lib, 1);
+ if (lib) BKE_library_make_local(bmain, lib, true);
else BLI_assert(!"cant find name of just added library!");
}

File Metadata

Mime Type
text/x-diff
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
d5/97/e852276393bb4c9e79146e8922e6

Event Timeline