[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59112] trunk/blender/source/blender/ editors/space_outliner: Fix crash happening when clearing parent in outliner modes which doesn' t support this.

Sergey Sharybin sergey.vfx at gmail.com
Tue Aug 13 16:46:39 CEST 2013


Revision: 59112
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59112
Author:   nazgul
Date:     2013-08-13 14:46:39 +0000 (Tue, 13 Aug 2013)
Log Message:
-----------
Fix crash happening when clearing parent in outliner modes which doesn't support this.

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	2013-08-13 10:40:23 UTC (rev 59111)
+++ trunk/blender/source/blender/editors/space_outliner/outliner_edit.c	2013-08-13 14:46:39 UTC (rev 59112)
@@ -1648,6 +1648,17 @@
 	RNA_def_enum(ot->srna, "type", prop_make_parent_types, 0, "Type", "");
 }
 
+static int outliner_parenting_poll(bContext *C)
+{
+	SpaceOops *soops = CTX_wm_space_outliner(C);
+
+	if (soops) {
+		return ELEM4(soops->outlinevis, SO_ALL_SCENES, SO_CUR_SCENE, SO_VISIBLE, SO_GROUPS);
+	}
+
+	return FALSE;
+}
+
 static int parent_clear_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
 {
 	Main *bmain = CTX_data_main(C);
@@ -1662,13 +1673,7 @@
 
 	/* search forwards to find the object */
 	te = outliner_find_id(soops, &soops->tree, (ID *)ob);
-	/* then search backwards to get the scene */
-	scene = (Scene *)outliner_search_back(soops, te, ID_SCE);
 
-	if (scene == NULL) {
-		return OPERATOR_CANCELLED;
-	}
-
 	ED_object_parent_clear(ob, RNA_enum_get(op->ptr, "type"));
 
 	DAG_relations_tag_update(bmain);
@@ -1687,7 +1692,7 @@
 	/* api callbacks */
 	ot->invoke = parent_clear_invoke;
 
-	ot->poll = ED_operator_outliner_active;
+	ot->poll = outliner_parenting_poll;
 
 	/* flags */
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;

Modified: trunk/blender/source/blender/editors/space_outliner/space_outliner.c
===================================================================
--- trunk/blender/source/blender/editors/space_outliner/space_outliner.c	2013-08-13 10:40:23 UTC (rev 59111)
+++ trunk/blender/source/blender/editors/space_outliner/space_outliner.c	2013-08-13 14:46:39 UTC (rev 59112)
@@ -144,6 +144,10 @@
 
 	UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
 
+	if (!ELEM4(soops->outlinevis, SO_ALL_SCENES, SO_CUR_SCENE, SO_VISIBLE, SO_GROUPS)) {
+		return FALSE;
+	}
+
 	if (drag->type == WM_DRAG_ID) {
 		ID *id = (ID *)drag->poin;
 		if (GS(id->name) == ID_OB) {




More information about the Bf-blender-cvs mailing list