[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51172] trunk/blender/source/blender/ editors/space_outliner/outliner_tools.c: Code cleanup - Convert if blocks to switch

Joshua Leung aligorith at gmail.com
Mon Oct 8 10:44:49 CEST 2012


Revision: 51172
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51172
Author:   aligorith
Date:     2012-10-08 08:44:48 +0000 (Mon, 08 Oct 2012)
Log Message:
-----------
Code cleanup - Convert if blocks to switch

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

Modified: trunk/blender/source/blender/editors/space_outliner/outliner_tools.c
===================================================================
--- trunk/blender/source/blender/editors/space_outliner/outliner_tools.c	2012-10-08 08:28:05 UTC (rev 51171)
+++ trunk/blender/source/blender/editors/space_outliner/outliner_tools.c	2012-10-08 08:44:48 UTC (rev 51172)
@@ -1160,38 +1160,50 @@
 	event = RNA_enum_get(op->ptr, "type");
 	set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel);
 	
-	if (datalevel == TSE_POSE_CHANNEL) {
-		if (event > 0) {
+	if (event <= 0)
+		return OPERATOR_CANCELLED;
+	
+	switch (datalevel) {
+		case TSE_POSE_CHANNEL:
+		{
 			outliner_do_data_operation(soops, datalevel, event, &soops->tree, pchan_cb, NULL);
 			WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
 			ED_undo_push(C, "PoseChannel operation");
 		}
-	}
-	else if (datalevel == TSE_BONE) {
-		if (event > 0) {
+			break;
+		
+		case TSE_BONE:
+		{
 			outliner_do_data_operation(soops, datalevel, event, &soops->tree, bone_cb, NULL);
 			WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
 			ED_undo_push(C, "Bone operation");
 		}
-	}
-	else if (datalevel == TSE_EBONE) {
-		if (event > 0) {
+			break;
+			
+		case TSE_EBONE:
+		{
 			outliner_do_data_operation(soops, datalevel, event, &soops->tree, ebone_cb, NULL);
 			WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
 			ED_undo_push(C, "EditBone operation");
 		}
-	}
-	else if (datalevel == TSE_SEQUENCE) {
-		if (event > 0) {
+			break;
+			
+		case TSE_SEQUENCE:
+		{
 			Scene *scene = CTX_data_scene(C);
 			outliner_do_data_operation(soops, datalevel, event, &soops->tree, sequence_cb, scene);
 		}
+			break;
+			
+		case TSE_RNA_STRUCT:
+			if (event == 5) {
+				outliner_do_data_operation(soops, datalevel, event, &soops->tree, data_select_linked_cb, C);
+			}
+			break;
+			
+		default:
+			break;
 	}
-	else if (datalevel == TSE_RNA_STRUCT) {
-		if (event == 5) {
-			outliner_do_data_operation(soops, datalevel, event, &soops->tree, data_select_linked_cb, C);
-		}
-	}
 	
 	return OPERATOR_FINISHED;
 }




More information about the Bf-blender-cvs mailing list