[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24424] trunk/blender: - fix Cocoa window setOrder function to maintain focus on a blender window (e.g.

Damien Plisson damien.plisson at yahoo.fr
Mon Nov 9 18:06:49 CET 2009


Revision: 24424
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24424
Author:   damien78
Date:     2009-11-09 18:06:48 +0100 (Mon, 09 Nov 2009)

Log Message:
-----------
- fix Cocoa window setOrder function to maintain focus on a blender window (e.g. ensure the blender window gets the focus when the user presses ESC to move back the render window)

- QuickTime export fixes.
Note that QuickTime export still crashes because it tries to open a "codec settings" dialog from the rendering background thread (and not the main/UI thread).
One quick fix may be to move the movie export initialization out of the render thread back into the operator function.
But a cleaner way would be to get rid of such a carbon/win32 dialog and place the codec settings inside blender interface
(additional fields in the output panel as it is currently the case for other file formats ?).

Modified Paths:
--------------
    trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm
    trunk/blender/source/blender/quicktime/apple/quicktime_export.c
    trunk/blender/source/blender/quicktime/quicktime_export.h

Modified: trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm	2009-11-09 16:00:12 UTC (rev 24423)
+++ trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm	2009-11-09 17:06:48 UTC (rev 24424)
@@ -684,10 +684,18 @@
 {
 	GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::setOrder(): window invalid")
     if (order == GHOST_kWindowOrderTop) {
-		[m_window orderFront:nil];
+		[m_window makeKeyAndOrderFront:nil];
     }
     else {
+		NSArray *windowsList;
+		
 		[m_window orderBack:nil];
+		
+		//Check for other blender opened windows and make the frontmost key
+		windowsList = [NSApp orderedWindows];
+		if ([windowsList count]) {
+			[[windowsList objectAtIndex:0] makeKeyAndOrderFront:nil];
+		}
     }
     return GHOST_kSuccess;
 }

Modified: trunk/blender/source/blender/quicktime/apple/quicktime_export.c
===================================================================
--- trunk/blender/source/blender/quicktime/apple/quicktime_export.c	2009-11-09 16:00:12 UTC (rev 24423)
+++ trunk/blender/source/blender/quicktime/apple/quicktime_export.c	2009-11-09 17:06:48 UTC (rev 24424)
@@ -317,7 +317,7 @@
 							k32ARGBPixelFormat,
 							trackFrame,
 							NULL, NULL, 0,
-							(unsigned char *)qtexport->ibuf->rect,
+							(Ptr)qtexport->ibuf->rect,
 							rectx * 4 );
 	CheckError (err, "NewGWorldFromPtr error");
 
@@ -438,7 +438,7 @@
 }
 
 
-void start_qt(struct RenderData *rd, int rectx, int recty) {
+void start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty) {
 	OSErr err = noErr;
 
 	char name[2048];
@@ -460,7 +460,7 @@
 
 	qtdata = MEM_callocN(sizeof(QuicktimeComponentData), "QuicktimeCodecDataExt");
 
-	if(rd->qtcodecdata == NULL && rd->qtcodecdata->cdParms == NULL) {
+	if(rd->qtcodecdata == NULL || rd->qtcodecdata->cdParms == NULL) {
 		get_qtcodec_settings(rd);
 	} else {
 		qtdata->theComponent = OpenDefaultComponent(StandardCompressionType, StandardCompressionSubType);
@@ -484,7 +484,7 @@
 			/* do something? */
 		}
 		close(myFile);
-		err = FSPathMakeRef(theFullPath, &myRef, 0);
+		err = FSPathMakeRef((const UInt8 *)theFullPath, &myRef, 0);
 		CheckError(err, "FsPathMakeRef error");
 		err = FSGetCatalogInfo(&myRef, kFSCatInfoNone, NULL, NULL, &qtexport->theSpec, NULL);
 		CheckError(err, "FsGetCatalogInfoRef error");
@@ -574,10 +574,13 @@
 	if( (rd->frs_sec == 24 || rd->frs_sec == 30 || rd->frs_sec == 60) &&
 		(qtdata->gTemporalSettings.frameRate == 1571553 ||
 		 qtdata->gTemporalSettings.frameRate == 1964113 ||
-		 qtdata->gTemporalSettings.frameRate == 3928227)) {;} else
-	qtdata->gTemporalSettings.frameRate = 
-		(rd->frs_sec << 16) / rd->frs_sec_base ;
-
+		 qtdata->gTemporalSettings.frameRate == 3928227)) {;} 
+	else {
+		if (rd->frs_sec_base > 0)
+			qtdata->gTemporalSettings.frameRate = 
+			(rd->frs_sec << 16) / rd->frs_sec_base ;
+	}
+	
 	err = SCSetInfo(qtdata->theComponent, scTemporalSettingsType,	&qtdata->gTemporalSettings);
 	CheckError( err, "SCSetInfo error" );
 
@@ -634,7 +637,7 @@
 
 	check_renderbutton_framerate(rd);
 
-	// put up the dialog box
+	// put up the dialog box - it needs to be called from the main thread
 	err = SCRequestSequenceSettings(qtdata->theComponent);
  
 	if (err == scUserCancelled) {

Modified: trunk/blender/source/blender/quicktime/quicktime_export.h
===================================================================
--- trunk/blender/source/blender/quicktime/quicktime_export.h	2009-11-09 16:00:12 UTC (rev 24423)
+++ trunk/blender/source/blender/quicktime/quicktime_export.h	2009-11-09 17:06:48 UTC (rev 24424)
@@ -36,7 +36,7 @@
 // quicktime movie output functions
 struct RenderData;
 
-void start_qt(struct RenderData *rd, int rectx, int recty);	//for movie handle (BKE writeavi.c now)
+void start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty);	//for movie handle (BKE writeavi.c now)
 void append_qt(struct RenderData *rd, int frame, int *pixels, int rectx, int recty);
 void end_qt(void);
 





More information about the Bf-blender-cvs mailing list