Merge branch 'master' into blender2.8

Conflicts:
	source/blender/collada/MeshImporter.cpp
	source/blender/editors/object/object_add.c
	source/blender/editors/screen/screen_edit.c
This commit is contained in:
2017-06-15 15:54:11 +02:00
8 changed files with 31 additions and 21 deletions

View File

@@ -1395,9 +1395,7 @@ void BKE_mesh_from_nurbs_displist(Object *ob, ListBase *dispbase, const bool use
cu->mat = NULL;
cu->totcol = 0;
if (ob->data) {
BKE_libblock_free(bmain, ob->data);
}
/* Do not decrement ob->data usercount here, it's done at end of func with BKE_libblock_free_us() call. */
ob->data = me;
ob->type = OB_MESH;
@@ -1407,11 +1405,14 @@ void BKE_mesh_from_nurbs_displist(Object *ob, ListBase *dispbase, const bool use
if (ob1->data == cu) {
ob1->type = OB_MESH;
id_us_min((ID *)ob1->data);
ob1->data = ob->data;
id_us_plus((ID *)ob->data);
id_us_plus((ID *)ob1->data);
}
ob1 = ob1->id.next;
}
BKE_libblock_free_us(bmain, cu);
}
void BKE_mesh_from_nurbs(Object *ob)

View File

@@ -5185,6 +5185,7 @@ Sequence *BKE_sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoad
sound = BKE_sound_new_file(bmain, seq_load->path); /* handles relative paths */
if (sound->playback_handle == NULL) {
BKE_libblock_free(bmain, sound);
#if 0
if (op)
BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");

View File

@@ -271,13 +271,13 @@ void BLO_update_defaults_startup_blend(Main *bmain)
/* remove polish brush (flatten/contrast does the same) */
br = (Brush *)BKE_libblock_find_name_ex(bmain, ID_BR, "Polish");
if (br) {
BKE_libblock_free(bmain, br);
BKE_libblock_delete(bmain, br);
}
/* remove brush brush (huh?) from some modes (draw brushes do the same) */
br = (Brush *)BKE_libblock_find_name_ex(bmain, ID_BR, "Brush");
if (br) {
BKE_libblock_free(bmain, br);
BKE_libblock_delete(bmain, br);
}
/* remove draw brush from texpaint (draw brushes do the same) */

View File

@@ -391,9 +391,7 @@ Object *DocumentImporter::create_camera_object(COLLADAFW::InstanceCamera *camera
Camera *cam = uid_camera_map[cam_uid];
Camera *old_cam = (Camera *)ob->data;
ob->data = cam;
id_us_min(&old_cam->id);
if (old_cam->id.us == 0)
BKE_libblock_free(G.main, old_cam);
BKE_libblock_free_us(G.main, old_cam);
return ob;
}
@@ -409,9 +407,7 @@ Object *DocumentImporter::create_lamp_object(COLLADAFW::InstanceLight *lamp, Sce
Lamp *la = uid_lamp_map[lamp_uid];
Lamp *old_lamp = (Lamp *)ob->data;
ob->data = la;
id_us_min(&old_lamp->id);
if (old_lamp->id.us == 0)
BKE_libblock_free(G.main, old_lamp);
BKE_libblock_free_us(G.main, old_lamp);
return ob;
}

View File

@@ -1156,8 +1156,9 @@ Object *MeshImporter::create_mesh_object(COLLADAFW::Node *node, COLLADAFW::Insta
BKE_mesh_assign_object(ob, new_mesh);
BKE_mesh_calc_normals(new_mesh);
if (old_mesh->id.us == 0) BKE_libblock_free(G.main, old_mesh);
id_us_plus(&old_mesh->id); /* Because BKE_mesh_assign_object would have already decreased it... */
BKE_libblock_free_us(G.main, old_mesh);
COLLADAFW::MaterialBindingArray& mat_array =
geom->getMaterialBindings();

View File

@@ -1701,7 +1701,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! */
@@ -1738,7 +1738,20 @@ static int convert_exec(bContext *C, wmOperator *op)
* on other objects data masks too, see: T50950. */
{
for (CollectionPointerLink *link = selected_editable_bases.first; link; link = link->next) {
Base *base = link->ptr.data;
BaseLegacy *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) || 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");
}
DEG_id_tag_update(&base->object->id, OB_RECALC_DATA);
}
@@ -1749,7 +1762,7 @@ static int convert_exec(bContext *C, wmOperator *op)
}
for (CollectionPointerLink *link = selected_editable_bases.first; link; link = link->next) {
Base *base = link->ptr.data;
BaseLegacy *base = link->ptr.data;
ob = base->object;
if (ob->flag & OB_DONE || !IS_TAGGED(ob->data)) {

View File

@@ -522,8 +522,7 @@ static int group_unlink_exec(bContext *C, wmOperator *UNUSED(op))
if (!group)
return OPERATOR_CANCELLED;
BKE_libblock_unlink(bmain, group, false, false);
BKE_libblock_free(bmain, group);
BKE_libblock_delete(bmain, group);
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, NULL);

View File

@@ -239,8 +239,7 @@ static void unlink_group_cb(
}
else {
Main *bmain = CTX_data_main(C);
BKE_libblock_unlink(bmain, group, false, false);
BKE_libblock_free(bmain, group);
BKE_libblock_delete(bmain, group);
}
}