[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35607] trunk/blender/source/blender/ editors/interface/interface.c: while looking into a problem in interface.c, noticed ui_get_but_val() is called frequently when the return value isn' t used (no functional change).
Campbell Barton
ideasman42 at gmail.com
Fri Mar 18 06:42:16 CET 2011
Revision: 35607
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35607
Author: campbellbarton
Date: 2011-03-18 05:42:16 +0000 (Fri, 18 Mar 2011)
Log Message:
-----------
while looking into a problem in interface.c, noticed ui_get_but_val() is called frequently when the return value isn't used (no functional change).
Modified Paths:
--------------
trunk/blender/source/blender/editors/interface/interface.c
Modified: trunk/blender/source/blender/editors/interface/interface.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface.c 2011-03-18 02:44:40 UTC (rev 35606)
+++ trunk/blender/source/blender/editors/interface/interface.c 2011-03-18 05:42:16 UTC (rev 35607)
@@ -914,15 +914,14 @@
static void ui_is_but_sel(uiBut *but)
{
- double value;
- int lvalue;
+ double value; /* only initialized when needed, to avoid calling when not used */
short push=0, true=1;
- value= ui_get_but_val(but);
-
if(ELEM3(but->type, TOGN, ICONTOGN, OPTIONN)) true= 0;
if( but->bit ) {
+ int lvalue;
+ value= ui_get_but_val(but);
lvalue= (int)value;
if( BTST(lvalue, (but->bitnr)) ) push= true;
else push= !true;
@@ -943,15 +942,18 @@
case BUT_TOGDUAL:
case ICONTOG:
case OPTION:
+ value= ui_get_but_val(but);
if(value!=but->hardmin) push= 1;
break;
case ICONTOGN:
case TOGN:
case OPTIONN:
+ value= ui_get_but_val(but);
if(value==0.0) push= 1;
break;
case ROW:
case LISTROW:
+ value= ui_get_but_val(but);
/* support for rna enum buts */
if(but->rnaprop && (RNA_property_flag(but->rnaprop) & PROP_ENUM_FLAG)) {
if((int)value & (int)but->hardmax) push= 1;
More information about the Bf-blender-cvs
mailing list