[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34675] trunk/blender/source/blender/ editors/armature/poselib.c: PoseLib Preview/Browse Bugfixes:

Joshua Leung aligorith at gmail.com
Sun Feb 6 23:20:27 CET 2011


Revision: 34675
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34675
Author:   aligorith
Date:     2011-02-06 22:20:26 +0000 (Sun, 06 Feb 2011)
Log Message:
-----------
PoseLib Preview/Browse Bugfixes:

- [#25951] Hardcoded Keys in PoseLib modal operator register twice per
use
Now only the KM_PRESS events are handled. KM_RELEASE events for these
are ignored...

- While checking the above, I also found that the view-manipulation
while previewing functionality was broken. This was one of the
benefits of this UI approach over a fixed screenshot-only listview.
Fixed now :)

Modified Paths:
--------------
    trunk/blender/source/blender/editors/armature/poselib.c

Modified: trunk/blender/source/blender/editors/armature/poselib.c
===================================================================
--- trunk/blender/source/blender/editors/armature/poselib.c	2011-02-06 18:38:53 UTC (rev 34674)
+++ trunk/blender/source/blender/editors/armature/poselib.c	2011-02-06 22:20:26 UTC (rev 34675)
@@ -1037,6 +1037,12 @@
 	tPoseLib_PreviewData *pld= op->customdata; 
 	int ret = OPERATOR_RUNNING_MODAL;
 	
+	/* only accept 'press' event, and ignore 'release', so that we don't get double actions */
+	if (ELEM(event->val, KM_PRESS, KM_NOTHING) == 0) {
+		//printf("PoseLib: skipping event with type '%s' and val %d\n", WM_key_event_string(event->type), event->val);
+		return ret; 
+	}
+	
 	/* backup stuff that needs to occur before every operation
 	 *	- make a copy of searchstr, so that we know if cache needs to be rebuilt
 	 */
@@ -1065,18 +1071,16 @@
 			 */
 			case PAD0: case PAD1: case PAD2: case PAD3: case PAD4:
 			case PAD5: case PAD6: case PAD7: case PAD8: case PAD9:
-			case PADPLUSKEY: case PADMINUS: case MIDDLEMOUSE:
+			case PADPLUSKEY: case PADMINUS: 
+			case MIDDLEMOUSE: case MOUSEMOVE:
 				//pld->redraw= PL_PREVIEW_REDRAWHEADER;
-				ret |= OPERATOR_PASS_THROUGH;
+				ret = OPERATOR_PASS_THROUGH;
 				break;
 				
 			/* quicky compare to original */
 			case TABKEY:
-				/* only respond to one event */
-				if (event->val == 0) {
-					pld->flag &= ~PL_PREVIEW_SHOWORIGINAL;
-					pld->redraw= PL_PREVIEW_REDRAWALL;
-				}
+				pld->flag &= ~PL_PREVIEW_SHOWORIGINAL;
+				pld->redraw= PL_PREVIEW_REDRAWALL;
 				break;
 		}
 		
@@ -1103,11 +1107,8 @@
 			
 		/* toggle between original pose and poselib pose*/
 		case TABKEY:
-			/* only respond to one event */
-			if (event->val == 0) {
-				pld->flag |= PL_PREVIEW_SHOWORIGINAL;
-				pld->redraw= PL_PREVIEW_REDRAWALL;
-			}
+			pld->flag |= PL_PREVIEW_SHOWORIGINAL;
+			pld->redraw= PL_PREVIEW_REDRAWALL;
 			break;
 		
 		/* change to previous pose (cyclic) */
@@ -1200,9 +1201,9 @@
 		/* we add pass through here, so that the operators responsible for these can still run, 
 		 * even though we still maintain control (as RUNNING_MODAL flag is still set too)
 		 */
-		case MIDDLEMOUSE:
+		case MIDDLEMOUSE: case MOUSEMOVE:
 			//pld->redraw= PL_PREVIEW_REDRAWHEADER;
-			ret |= OPERATOR_PASS_THROUGH;
+			ret = OPERATOR_PASS_THROUGH;
 			break;
 			
 		/* view manipulation, or searching */
@@ -1216,7 +1217,7 @@
 			else {
 				/* view manipulation (see above) */
 				//pld->redraw= PL_PREVIEW_REDRAWHEADER;
-				ret |= OPERATOR_PASS_THROUGH;
+				ret = OPERATOR_PASS_THROUGH;
 			}
 			break;
 			




More information about the Bf-blender-cvs mailing list