[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39528] trunk/blender/source/blender/ editors/interface/interface.c: disable undo for screen & wm RNA buttons, changing shading mode via the UI for eg was doing an undo push.

Campbell Barton ideasman42 at gmail.com
Thu Aug 18 18:26:35 CEST 2011


Revision: 39528
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39528
Author:   campbellbarton
Date:     2011-08-18 16:26:34 +0000 (Thu, 18 Aug 2011)
Log Message:
-----------
disable undo for screen & wm RNA buttons, changing shading mode via the UI for eg was doing an undo push.

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-08-18 16:10:44 UTC (rev 39527)
+++ trunk/blender/source/blender/editors/interface/interface.c	2011-08-18 16:26:34 UTC (rev 39528)
@@ -2636,6 +2636,17 @@
 		UI_DEF_BUT_RNA_DISABLE(but);
 	}
 
+	/* avoid undo push for buttons who's ID are screen or wm level
+	 * we could disable undo for buttons with no ID too but but may have
+	 * unforseen conciquences, so best check for ID's we _know_ are not
+	 * handled by undo - campbell */
+	if (but->flag & UI_BUT_UNDO) {
+		ID *id= ptr->id.data;
+		if(id && ELEM(GS(id->name), ID_SCR, ID_WM)) {
+			but->flag &= ~UI_BUT_UNDO;
+		}
+	}
+
 	/* If this button uses units, calculate the step from this */
 	if(ui_is_but_unit(but))
 		but->a1= ui_get_but_step_unit(but, but->a1);




More information about the Bf-blender-cvs mailing list