Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2016-11-21 22:57:02 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2016-11-21 22:57:02 +0300
commit94d8e6fc6cdef926e930ca22a5c689193760c705 (patch)
treec17cbb2ac6ebb8163c006a6c6352611ddb0c180e /source/blender
parentb97c567c1df1e5c38833c4af8a95962e0ece4c61 (diff)
Partly revert own rBb97c567c1df1e, clear_proxy is actually safe.
This is very confusing, in fact, and rna tooltip was wrong, BKE_object_make_local_ex actually ensures we never have several proxies of same object, since it always clears proxy when it has to copy object to make it local... What that RNA function is probably missing, though, is same logic as in BKE_library_make_local to actually remap proxy from old linked object to new local one.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/makesrna/intern/rna_ID.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index b5015c3fbde..87fb45a4419 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -348,21 +348,13 @@ static void rna_ID_user_remap(ID *id, Main *bmain, ID *new_id)
}
}
-static struct ID *rna_ID_make_local(struct ID *self, Main *bmain, int UNUSED(clear_proxy))
+static struct ID *rna_ID_make_local(struct ID *self, Main *bmain, int clear_proxy)
{
- /* XXX This is *very, very bad*, since it may leave Main in invalid state (two objects, one local and one linked,
- * proxies of same reference linked object).
- * This can be allowed in C code (with extensive warning and documentation),
- * but is totally fully forbidden in our RNA API!
- * So disabling for now. */
-#if 0
/* Special case, as we can't rely on id_make_local(); it clears proxies. */
if (!clear_proxy && GS(self->name) == ID_OB) {
BKE_object_make_local_ex(bmain, (Object *)self, false, clear_proxy);
}
- else
-#endif
- {
+ else {
id_make_local(bmain, self, false, false);
}
@@ -1026,7 +1018,9 @@ static void rna_def_ID(BlenderRNA *brna)
RNA_def_function_ui_description(func, "Make this datablock local, return local one "
"(may be a copy of the original, in case it is also indirectly used)");
RNA_def_function_flag(func, FUNC_USE_MAIN);
- parm = RNA_def_boolean(func, "clear_proxy", true, "", "DO NOT USE! - has no effect at all");
+ parm = RNA_def_boolean(func, "clear_proxy", true, "",
+ "Whether to clear proxies (the default behavior, "
+ "note that if object has to be duplicated to be made local, proxies are always cleared)");
RNA_def_property_flag(parm, PROP_PYFUNC_OPTIONAL);
parm = RNA_def_pointer(func, "id", "ID", "", "This ID, or the new ID if it was copied");
RNA_def_function_return(func, parm);