[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57859] trunk/blender/source/blender/ editors/object/object_relations.c: fix for crash linking fonts to other objects with linked obdata (link, undo would crash).
Campbell Barton
ideasman42 at gmail.com
Fri Jun 28 20:39:41 CEST 2013
Revision: 57859
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57859
Author: campbellbarton
Date: 2013-06-28 18:39:39 +0000 (Fri, 28 Jun 2013)
Log Message:
-----------
fix for crash linking fonts to other objects with linked obdata (link, undo would crash).
Modified Paths:
--------------
trunk/blender/source/blender/editors/object/object_relations.c
Modified: trunk/blender/source/blender/editors/object/object_relations.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_relations.c 2013-06-28 18:19:55 UTC (rev 57858)
+++ trunk/blender/source/blender/editors/object/object_relations.c 2013-06-28 18:39:39 UTC (rev 57859)
@@ -1430,12 +1430,13 @@
Scene *scene = CTX_data_scene(C);
const int type = RNA_enum_get(op->ptr, "type");
Object *ob_src;
- ID *id;
+ ID *obdata_id;
int a;
/* group */
LinkNode *ob_groups = NULL;
- int is_cycle = FALSE;
+ bool is_cycle = false;
+ bool is_lib = false;
ob_src = ED_object_active_context(C);
@@ -1450,14 +1451,15 @@
if (ob_src != ob_dst) {
if (allow_make_links_data(type, ob_src, ob_dst)) {
+ obdata_id = ob_dst->data;
+
switch (type) {
case MAKE_LINKS_OBDATA: /* obdata */
- id = ob_dst->data;
- id->us--;
+ obdata_id->us--;
- id = ob_src->data;
- id_us_plus(id);
- ob_dst->data = id;
+ obdata_id = ob_src->data;
+ id_us_plus(obdata_id);
+ ob_dst->data = obdata_id;
/* if amount of material indices changed: */
test_object_materials(bmain, ob_dst->data);
@@ -1473,6 +1475,10 @@
break;
case MAKE_LINKS_ANIMDATA:
BKE_copy_animdata_id((ID *)ob_dst, (ID *)ob_src, FALSE);
+ if (obdata_id->lib) {
+ is_lib = true;
+ break;
+ }
BKE_copy_animdata_id((ID *)ob_dst->data, (ID *)ob_src->data, FALSE);
break;
case MAKE_LINKS_GROUP:
@@ -1508,6 +1514,11 @@
Curve *cu_src = ob_src->data;
Curve *cu_dst = ob_dst->data;
+ if (obdata_id->lib) {
+ is_lib = true;
+ break;
+ }
+
if (cu_dst->vfont) cu_dst->vfont->id.us--;
cu_dst->vfont = cu_src->vfont;
id_us_plus((ID *)cu_dst->vfont);
@@ -1540,6 +1551,10 @@
}
}
+ if (is_lib) {
+ BKE_report(op->reports, RPT_WARNING, "Skipped editing library object data");
+ }
+
DAG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C));
WM_event_add_notifier(C, NC_OBJECT, NULL);
More information about the Bf-blender-cvs
mailing list