diff options
Diffstat (limited to 'source/blender/editors/object/object_add.c')
-rw-r--r-- | source/blender/editors/object/object_add.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 20523264cd9..4ed1e85fb48 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -1154,7 +1154,21 @@ static int object_delete_exec(bContext *C, wmOperator *op) base->object->id.name + 2, scene->id.name + 2); continue; } + + /* This is sort of a quick hack to address T51243 - Proper thing to do here would be to nuke most of all this + * custom scene/object/base handling, and use generic lib remap/query for that. + * But this is for later (aka 2.8, once layers & co are settled and working). + */ + if (use_global && base->object->id.lib == NULL) { + /* We want to nuke the object, let's nuke it the easy way (not for linked data though)... */ + BKE_libblock_delete(bmain, &base->object->id); + changed = true; + continue; + } + /* remove from Grease Pencil parent */ + /* XXX This is likely not correct? Will also remove parent from grease pencil from other scenes, + * even when use_global is false... */ for (bGPdata *gpd = bmain->gpencil.first; gpd; gpd = gpd->id.next) { for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) { if (gpl->parent != NULL) { @@ -1450,8 +1464,6 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base, } if (ob_dst->parent) { - invert_m4_m4(ob_dst->parentinv, dob->mat); - /* note, this may be the parent of other objects, but it should * still work out ok */ BKE_object_apply_mat4(ob_dst, dob->mat, false, true); @@ -1472,7 +1484,6 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base, ob_dst->partype = PAROBJECT; /* similer to the code above, see comments */ - invert_m4_m4(ob_dst->parentinv, dob->mat); BKE_object_apply_mat4(ob_dst, dob->mat, false, true); DAG_id_tag_update(&ob_dst->id, OB_RECALC_OB); } @@ -1626,7 +1637,7 @@ static int convert_exec(bContext *C, wmOperator *op) MetaBall *mb; Mesh *me; const short target = RNA_enum_get(op->ptr, "target"); - const bool keep_original = RNA_boolean_get(op->ptr, "keep_original"); + bool keep_original = RNA_boolean_get(op->ptr, "keep_original"); int a, mballConverted = 0; /* don't forget multiple users! */ @@ -1664,6 +1675,19 @@ static int convert_exec(bContext *C, wmOperator *op) { for (CollectionPointerLink *link = selected_editable_bases.first; link; link = link->next) { Base *base = link->ptr.data; + ob = base->object; + + /* The way object type conversion works currently (enforcing conversion of *all* objetcs using converted + * obdata, even some un-selected/hidden/inother scene ones, sounds totally bad to me. + * However, changing this is more design than bugfix, not to mention convoluted code below, + * so that will be for later. + * But at the very least, do not do that with linked IDs! */ + if ((ID_IS_LINKED_DATABLOCK(ob) || (ob->data && ID_IS_LINKED_DATABLOCK(ob->data))) && !keep_original) { + keep_original = true; + BKE_reportf(op->reports, RPT_INFO, + "Converting some linked object/object data, enforcing 'Keep Original' option to True"); + } + DAG_id_tag_update(&base->object->id, OB_RECALC_DATA); } |