[Bf-blender-cvs] [bd7060a87fd] blender2.8: Fix crash on Collada exporter

Dalai Felinto noreply at git.blender.org
Fri Jan 26 11:38:56 CET 2018


Commit: bd7060a87fd9f46c2bdd141e26934e8573c6e3f8
Author: Dalai Felinto
Date:   Fri Jan 26 08:38:46 2018 -0200
Branches: blender2.8
https://developer.blender.org/rBbd7060a87fd9f46c2bdd141e26934e8573c6e3f8

Fix crash on Collada exporter

===================================================================

M	source/blender/collada/EffectExporter.cpp
M	source/blender/editors/space_outliner/outliner_ops.c

===================================================================

diff --git a/source/blender/collada/EffectExporter.cpp b/source/blender/collada/EffectExporter.cpp
index 87392352a48..5e7f92047d3 100644
--- a/source/blender/collada/EffectExporter.cpp
+++ b/source/blender/collada/EffectExporter.cpp
@@ -67,7 +67,7 @@ EffectsExporter::EffectsExporter(COLLADASW::StreamWriter *sw, const ExportSettin
 
 bool EffectsExporter::hasEffects(Scene *sce)
 {
-	FOREACH_SCENE_OBJECT(scene, ob)
+	FOREACH_SCENE_OBJECT(sce, ob)
 	{
 		int a;
 		for (a = 0; a < ob->totcol; a++) {
diff --git a/source/blender/editors/space_outliner/outliner_ops.c b/source/blender/editors/space_outliner/outliner_ops.c
index 599096c0ee9..ff322b49a27 100644
--- a/source/blender/editors/space_outliner/outliner_ops.c
+++ b/source/blender/editors/space_outliner/outliner_ops.c
@@ -250,21 +250,36 @@ static int outliner_item_drag_drop_modal(bContext *C, wmOperator *op, const wmEv
 	return retval;
 }
 
+/**
+ * Check if the given TreeElement is a collection
+ *
+ * This test is mainly used to see if next/prev TreeElement is a collection.
+ * It will fail when there is no next/prev TreeElement, or when the
+ * element is an Override or something else in the future.
+ */
+static bool tree_element_is_collection_get(const TreeElement *te) {
+	if (te == NULL) {
+		return false;
+	}
+
+	TreeStoreElem *tselem = TREESTORE(te);
+	return ELEM(tselem->type, TSE_LAYER_COLLECTION, TSE_SCENE_COLLECTION);
+}
+
 static const char *outliner_drag_drop_tooltip_get(
         const TreeElement *te_float)
 {
 	const char *name = NULL;
-	TreeStoreElem *tselem = TREESTORE(te_float);
 
 	const TreeElement *te_insert = te_float->drag_data->insert_handle;
-	if (ELEM(tselem->type, TSE_LAYER_COLLECTION, TSE_SCENE_COLLECTION)) {
+	if (tree_element_is_collection_get(te_float)) {
 		if (te_insert == NULL) {
 			name = TIP_("Move collection");
 		}
 		else {
 			switch (te_float->drag_data->insert_type) {
 				case TE_INSERT_BEFORE:
-					if (te_insert->prev) {
+					if (tree_element_is_collection_get(te_insert->prev)) {
 						name = TIP_("Move between collections");
 					}
 					else {
@@ -272,7 +287,7 @@ static const char *outliner_drag_drop_tooltip_get(
 					}
 					break;
 				case TE_INSERT_AFTER:
-					if (te_insert->next) {
+					if (tree_element_is_collection_get(te_insert->next)) {
 						name = TIP_("Move between collections");
 					}
 					else {
@@ -285,7 +300,7 @@ static const char *outliner_drag_drop_tooltip_get(
 			}
 		}
 	}
-	else if ((tselem->type == 0) && (te_float->idcode == ID_OB)) {
+	else if ((TREESTORE(te_float)->type == 0) && (te_float->idcode == ID_OB)) {
 		name = TIP_("Move to collection (Ctrl to add)");
 	}



More information about the Bf-blender-cvs mailing list