diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2016-06-27 16:43:04 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2016-06-27 16:46:43 +0300 |
commit | e2c7ee773311734450a229051673fbfea61b641a (patch) | |
tree | cd60c84987531e174c365ee3345099afe09cdd7e /source/blender/editors/space_outliner | |
parent | 34024c7cd8b3e7e90754c80d60ac5cd02de87a85 (diff) |
Fix T48740: User could remap indirect libdata usages from outliner.
Remapping indirect usage of IDs is forbidden from user space, this is calling for
nice nightmare with libraries handling (and undo crash, among other things).
Not sure why I was 'laxist' about indirect usage cases detection like that,
for now just consider any ID used by another linked datablock as indirect usage case!
Also, added some error/warning reports to Outliner's remap code.
Diffstat (limited to 'source/blender/editors/space_outliner')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_edit.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index 687869ae727..57d9ff7825b 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -399,13 +399,22 @@ static int outliner_id_remap_exec(bContext *C, wmOperator *op) ID *new_id = BLI_findlink(which_libbase(CTX_data_main(C), id_type), RNA_enum_get(op->ptr, "new_id")); /* check for invalid states */ - if (soops == NULL) + if (soops == NULL) { return OPERATOR_CANCELLED; + } if (!(old_id && (old_id != new_id) && (GS(old_id->name) == GS(new_id->name)))) { + BKE_reportf(op->reports, RPT_ERROR_INVALID_INPUT, "Invalid old/new ID pair ('%s' / '%s')", + old_id->name, new_id->name); return OPERATOR_CANCELLED; } + if (old_id->lib) { + BKE_reportf(op->reports, RPT_WARNING, + "Old ID '%s' is linked from a library, indirect usages of this datablock will not be remapped", + old_id->name); + } + BKE_libblock_remap(bmain, old_id, new_id, ID_REMAP_SKIP_INDIRECT_USAGE | ID_REMAP_SKIP_NEVER_NULL_USAGE); |