Commit: 6c10ec74d5ec3d6fbbc1531463c117332b91ebed Author: Dalai Felinto Date: Fri Nov 9 10:59:12 2018 -0200 Branches: blender2.8 https://developer.blender.org/rB6c10ec74d5ec3d6fbbc1531463c117332b91ebed
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. =================================================================== M source/blender/editors/space_outliner/outliner_draw.c M source/blender/makesrna/intern/rna_ID.c =================================================================== 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)) _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs