[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47454] trunk/blender/source/blender/ editors/space_outliner: Fix #31702: Drag and Drop parenting crashes Blender

Sergey Sharybin sergey.vfx at gmail.com
Tue Jun 5 11:57:20 CEST 2012


Revision: 47454
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47454
Author:   nazgul
Date:     2012-06-05 09:57:19 +0000 (Tue, 05 Jun 2012)
Log Message:
-----------
Fix #31702: Drag and Drop parenting crashes Blender

Crash was caused by recent changes in parent drop operator which were
aimed to prevent parenting objects between different scenes (which probably
makes sense).

The problem was how it was checked if objects belongs to the same scene --
outliner tree with type ID_SCE was used for this which works pretty nice
for All Scenes outliner view. But in other view modes there is no scene
element in outliner tree which lead to some NULL pointer dereferences.

Currently resolved this by assuming that if there's no Scene parent element
in outliner tree parent and child belongs to the same scene which is active
scene. This is truth for current view modes of outliner but if it'll be
changed in the future this assumption shall be updated and re-implemented
with some smarter checks of which scene object from outliner belongs to.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_outliner/outliner_edit.c
    trunk/blender/source/blender/editors/space_outliner/space_outliner.c

Modified: trunk/blender/source/blender/editors/space_outliner/outliner_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_outliner/outliner_edit.c	2012-06-05 09:37:44 UTC (rev 47453)
+++ trunk/blender/source/blender/editors/space_outliner/outliner_edit.c	2012-06-05 09:57:19 UTC (rev 47454)
@@ -1503,7 +1503,12 @@
 		scene = (Scene *)outliner_search_back(soops, te_found, ID_SCE);
 
 		if (scene == NULL) {
-			return OPERATOR_CANCELLED;
+			/* currently outlier organized in a way, that if there's no parent scene
+			 * element for object it means that all displayed objects belong to
+			 * active scene and parenting them is allowed (sergey)
+			 */
+
+			scene = CTX_data_scene(C);
 		}
 
 		if ((par->type != OB_ARMATURE) && (par->type != OB_CURVE) && (par->type != OB_LATTICE)) {

Modified: trunk/blender/source/blender/editors/space_outliner/space_outliner.c
===================================================================
--- trunk/blender/source/blender/editors/space_outliner/space_outliner.c	2012-06-05 09:37:44 UTC (rev 47453)
+++ trunk/blender/source/blender/editors/space_outliner/space_outliner.c	2012-06-05 09:57:19 UTC (rev 47454)
@@ -98,9 +98,18 @@
 				if (te_valid) {
 					/* check that parent/child are both in the same scene */
 					Scene *scene = (Scene *)outliner_search_back(soops, te_valid, ID_SCE);
-					if (BKE_scene_base_find(scene, (Object *)id)) {
+
+					if (!scene) {
+						/* currently outlier organized in a way, that if there's no parent scene
+						 * element for object it means that all displayed objects belong to
+						 * active scene and parenting them is allowed (sergey)
+						 */
 						return 1;
 					}
+
+					if (scene && BKE_scene_base_find(scene, (Object *)id)) {
+						return 1;
+					}
 				}
 			}
 		}




More information about the Bf-blender-cvs mailing list