diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-11-09 15:59:12 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-11-09 16:01:55 +0300 |
commit | 6c10ec74d5ec3d6fbbc1531463c117332b91ebed (patch) | |
tree | b0e3226945dab9efab86b938eb18bfb2ebe993c1 | |
parent | 88d621a68f943f105e2ddf81542b54ac261397e2 (diff) |
Fix crash when renaming metaballs
This handles both renaming via outliner and rna.
Metaballs as we all know have their geometry based on the metaballs that
share the same name with them.
Changing the name of a metaball without tagging its geometry to change
is asking for trouble.
-rw-r--r-- | source/blender/editors/space_outliner/outliner_draw.c | 8 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_ID.c | 7 |
2 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index da26aab93b5..e5d1a42c274 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -335,6 +335,14 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname) WM_event_add_notifier(C, NC_IMAGE, NULL); break; case ID_SCE: WM_event_add_notifier(C, NC_SCENE, NULL); break; + case ID_OB: + { + Object *ob = (Object *)tselem->id; + if (ob->type == OB_MBALL) { + DEG_id_tag_update(&ob->id, DEG_TAG_GEOMETRY); + } + WM_event_add_notifier(C, NC_ID | NA_RENAME, NULL); break; + } default: WM_event_add_notifier(C, NC_ID | NA_RENAME, NULL); break; } diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index ab4bdc4e064..20383d4dc23 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -153,6 +153,13 @@ void rna_ID_name_set(PointerRNA *ptr, const char *value) BLI_strncpy_utf8(id->name + 2, value, sizeof(id->name) - 2); BLI_assert(BKE_id_is_in_global_main(id)); BLI_libblock_ensure_unique_name(G_MAIN, id->name); + + if (GS(id->name) == ID_OB) { + Object *ob = (Object *)id; + if (ob->type == OB_MBALL) { + DEG_id_tag_update(&ob->id, DEG_TAG_GEOMETRY); + } + } } static int rna_ID_name_editable(PointerRNA *ptr, const char **UNUSED(r_info)) |