Re: Showing a modal dialog using -runModalForWindow in an effect
site_archiver@lists.apple.com Delivered-To: pro-apps-dev@lists.apple.com I made one further change to my code, below: if (!sWindowHasBeenShown && (pthread_main_np() != 0)) steve On Jun 5, 2008, at 9:36 AM, Paul Schneider wrote: Hi all, - Paul On May 31, 2008, at 1:15 AM, Micah Sharp wrote: Paul, Darrin? When is a good time to do this? Maybe at first render? Micah - (BOOL)frameSetup:(FxRenderInfo)renderInfo hardware:(BOOL*)canRenderHardware software:(BOOL*)canRenderSoftware { static BOOL sWindowHasBeenShown = NO; if (!sWindowHasBeenShown) { sWindowHasBeenShown = YES; [controller showWindowModally]; } *canRenderSoftware = NO; *canRenderHardware = YES; return YES; } On May 30, 2008, at 5:26 PM, Micah Sharp wrote: Micah I'm currently using [NSApplication sharedApplication]. Has anyone done this, or something like this? I'd appreciate any advice or sample code regarding showing a modal dialog when an effect starts. Thanks. Matt Rhodes Zaxwerks, Inc. _______________________________________________ Do not post admin requests to the list. They will be ignored. Pro-apps-dev mailing list (Pro-apps-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/pro-apps-dev/site_archiver%40lists.ap... The biggest issue that I've found with trying to display a window in - frameSetup: is that it's usually called in other than the main thread, where playing with UI is a Bad Thing. I also tried displaying a window via NSThread's -performSelectorOnMainThread: (with wait=YES), but that just locks up FC since it appears that the main thread is already blocked waiting for the render thread to complete. It prevents a crash caused by displaying a window, but also I pretty much never see the window since the renders aren't happening in the main thread. As for [NSApplication sharedApplication], it looks like it's working since I've been able to get a modal window to display for the case where I just double-click on the effect in the list. Unfortunately, we don't have a good entry point for "the user has just added your effect to a timeline". Final Cut will call -initWithAPIManager when the app starts up and we are loading the FxPlugs. So if you want to postpone your dialog until the user applies your effect, this isn't a good choice. However, I know that some developers display splash screens or registration dialogs at this time, and it seems to work. I'm not sure if they are using Carbon or Cocoa (I would expect some use one, some the other). You could delay your dialog until first render, as Micah suggests. It's possible to add an effect to Final Cut without causing a render, though (if you drag the effect to a section of the timeline that isn't being displayed in the canvas, or if you have caps lock on). So it's possible that the user could add your filter, then start playback and unexpectedly see your dialog when the playhead moves into your segment. Matt, are you crashing in Motion or Final Cut? Or both? Final Cut is a carbon app with some cocoa hosting. I would expect [NSApplication sharedApplication] to work in Final Cut, but it's possible that we haven't set that machinery up yet when we first load the FxPlugs. On Fri, May 30, 2008 at 6:11 PM, Steve Christensen <punster@mac.com> wrote: I wouldn't suggest displaying a window in -initWithAPIManager: since that can get called rather early in the startup process when the host app may not be ready to deal with an unexpected window. A better place would be in -frameSetup:hardware:software: since by then the world is set up and the user has just selected your effect. I tried this in a little test plugin and it seemed to work just fine: TestFxPlugWindowController* controller = [[TestFxPlugWindowController alloc] initWithWindowNibName:@"TestFxPlug"]; We don't do it at startup, but we do insert an Options button that brings up a carbon dialog. Not sure if that is helpful, but we've seen no problems. On Fri, May 30, 2008 at 4:59 PM, Matt Rhodes <matt@zaxwerks.com> wrote: Hey Team. We have the need to show a modal dialog box when our effect is first displayed. Is there a recommended place to do this? We're currently doing this in -initWithApiManager I'm trying to use -runModalForWindow for the modal dialog. I grab an NSWindow in a .xib (.nib) file and can display it with -runModalForWindow. I'm getting some random crashes after showing the dialog. The problem seems to be that as an effect I don't really have an NSApplication to hang onto and -runModalForWindow requires it. This email sent to site_archiver@lists.apple.com
participants (1)
-
Steve Christensen