Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-06-05 13:57:19 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-06-05 13:57:19 +0400
commitf885306bb8b12fb20817bd499fb52d9f072d6b55 (patch)
tree6e03d28b403505d2731b942b9af6eeb934396c31 /source/blender/editors/space_outliner
parentae8103240d2cf66d2d6aea5bddbc0074700df122 (diff)
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.
Diffstat (limited to 'source/blender/editors/space_outliner')
-rw-r--r--source/blender/editors/space_outliner/outliner_edit.c7
-rw-r--r--source/blender/editors/space_outliner/space_outliner.c11
2 files changed, 16 insertions, 2 deletions
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index a752a7d71ae..e5f7b8fd76d 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -1503,7 +1503,12 @@ static int parent_drop_invoke(bContext *C, wmOperator *op, wmEvent *event)
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)) {
diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c
index 4d45be561c6..c78be8bd223 100644
--- a/source/blender/editors/space_outliner/space_outliner.c
+++ b/source/blender/editors/space_outliner/space_outliner.c
@@ -98,7 +98,16 @@ static int outliner_parent_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
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;
}
}