[Bf-blender-cvs] [043b156c83e] blender2.8: Code Cleanup: Use utility function here

Joshua Leung noreply at git.blender.org
Fri Aug 11 14:17:39 CEST 2017


Commit: 043b156c83e56d8b1abd66e996c16fa53e65b0b6
Author: Joshua Leung
Date:   Fri Aug 11 14:44:08 2017 +1200
Branches: blender2.8
https://developer.blender.org/rB043b156c83e56d8b1abd66e996c16fa53e65b0b6

Code Cleanup: Use utility function here

There's no reason to manually iterate over items in a DLRBT_Tree,
as the structure is designed to be able to be safely casted down
to a ListBase and ListBase-like nodes..

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

M	source/blender/editors/space_nla/nla_draw.c

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

diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index 33ac5d50a01..fbb05025adf 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -135,10 +135,8 @@ static void nla_action_draw_keyframes(AnimData *adt, bAction *act, float y, floa
 	immUnbindProgram();
 
 	/* count keys before drawing */
-	unsigned int key_ct = 0;
-	for (ActKeyColumn *ak = keys.first; ak; ak = ak->next) {
-		key_ct++;
-	}
+	/* Note: It's safe to cast DLRBT_Tree, as it's designed to degrade down to a ListBase */
+	unsigned int key_ct = BLI_listbase_count((ListBase *)&keys);
 
 	if (key_ct > 0) {
 		format = immVertexFormat();




More information about the Bf-blender-cvs mailing list