Skip to content

Commit

Permalink
Increased to Build 14
Browse files Browse the repository at this point in the history
- Cleanup
- Added `ITSAppUsesNonExemptEncryption` to `Info.plist`.
- Renamed `getLensProfileIdentifiersFromDirectory` to `newLensProfileIdentifiersFromDirectory` to keep Xcode happy.
  • Loading branch information
latenitefilms committed Aug 3, 2023
1 parent 05e1f3a commit 1dca6a9
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 31 deletions.
2 changes: 1 addition & 1 deletion Source/Configuration/Shared.xcconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
HARDCODED_DEVELOPER_ID=Developer ID Application: LateNite Films Pty Ltd
HARDCODED_COPYRIGHT=Copyright © LateNite Films Pty Ltd 2022-2023. All Rights Reserved.
HARDCODED_VERSION=1.1.0
HARDCODED_BUILD=13
HARDCODED_BUILD=14
2 changes: 1 addition & 1 deletion Source/Frameworks/gyroflow/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,7 @@ pub extern "C" fn processFrame(
//---------------------------------------------------------
let incoming_fov_overview = fov_overview != 0;
if incoming_fov_overview != params.fov_overview {
log::error!("[Gyroflow Toolbox Rust] FOV Changed!");
//log::error!("[Gyroflow Toolbox Rust] FOV Changed!");
params.fov_overview = incoming_fov_overview;
params_changed = true;
}
Expand Down
118 changes: 89 additions & 29 deletions Source/Gyroflow/Plugin/GyroflowPlugIn.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ - (nullable instancetype)initWithAPIManager:(id<PROAPIAccessing>)newApiManager;
//---------------------------------------------------------
// Build cache of all the Lens Profile Names:
//---------------------------------------------------------
lensProfilesLookup = [self getLensProfileIdentifiersFromDirectory:lensProfilesPath];
lensProfilesLookup = [self newLensProfileIdentifiersFromDirectory:lensProfilesPath];

//NSLog(@"[Gyroflow Toolbox Renderer] lensProfilesLookup: %@", lensProfilesLookup);

Expand Down Expand Up @@ -2326,12 +2326,20 @@ - (void)buttonOpenUserGuide {
//---------------------------------------------------------
- (void)buttonLoadPresetLensProfileIsImporting:(BOOL)isImporting {

//NSLog(@"[Gyroflow Toolbox Renderer] buttonLoadPresetLensProfileIsImporting Triggered!");
//NSLog(@"[Gyroflow Toolbox Renderer] isImporting: %@", [NSNumber numberWithBool:isImporting]);

//---------------------------------------------------------
// Load the Custom Parameter Action API:
//---------------------------------------------------------
id<FxCustomParameterActionAPI_v4> actionAPI = [_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];
if (actionAPI == nil) {
[self showAlertWithMessage:@"An error has occurred." info:@"Unable to retrieve 'FxCustomParameterActionAPI_v4'. This shouldn't happen, so it's probably a bug."];
//---------------------------------------------------------
// Show Error Message:
//---------------------------------------------------------
NSString *errorMessage = @"Unable to retrieve 'FxCustomParameterActionAPI_v4'. This shouldn't happen, so it's probably a bug.";
NSLog(@"[Gyroflow Toolbox Renderer] %@", errorMessage);
[self showAlertWithMessage:@"An error has occurred." info:errorMessage];
return;
}

Expand All @@ -2350,7 +2358,12 @@ - (void)buttonLoadPresetLensProfileIsImporting:(BOOL)isImporting {
//---------------------------------------------------------
[actionAPI endAction:self];

[self showAlertWithMessage:@"An error has occurred." info:@"Unable to retrieve 'FxParameterRetrievalAPI_v6'.\n\nThis shouldn't happen, so it's probably a bug."];
//---------------------------------------------------------
// Show Error Message:
//---------------------------------------------------------
NSString *errorMessage = @"Unable to retrieve 'FxParameterRetrievalAPI_v6'.\n\nThis shouldn't happen, so it's probably a bug.";
NSLog(@"[Gyroflow Toolbox Renderer] %@", errorMessage);
[self showAlertWithMessage:@"An error has occurred." info:errorMessage];
return;
}

Expand All @@ -2360,6 +2373,11 @@ - (void)buttonLoadPresetLensProfileIsImporting:(BOOL)isImporting {
id<FxParameterSettingAPI_v5> paramSetAPI = [_apiManager apiForProtocol:@protocol(FxParameterSettingAPI_v5)];
if (paramSetAPI == nil)
{
//---------------------------------------------------------
// Stop Action API:
//---------------------------------------------------------
[actionAPI endAction:self];

//---------------------------------------------------------
// Show Error Message:
//---------------------------------------------------------
Expand All @@ -2374,32 +2392,48 @@ - (void)buttonLoadPresetLensProfileIsImporting:(BOOL)isImporting {
//---------------------------------------------------------
NSString *gyroflowProjectData = nil;
[paramGetAPI getStringParameterValue:&gyroflowProjectData fromParameter:kCB_GyroflowProjectData];

//NSLog(@"[Gyroflow Toolbox Renderer] gyroflowProjectData: %@", gyroflowProjectData);

if (gyroflowProjectData == nil) {
[self showAlertWithMessage:@"Failed to get Gyroflow Project" info:@"Please ensure you have a Gyroflow Project already loaded."];
//---------------------------------------------------------
// Stop Action API:
//---------------------------------------------------------
[actionAPI endAction:self];

//---------------------------------------------------------
// Show Error Message:
//---------------------------------------------------------
NSString *errorMessage = @"Please ensure you have a Gyroflow Project already loaded.";
NSLog(@"[Gyroflow Toolbox Renderer] %@", errorMessage);
[self showAlertWithMessage:@"Failed to get Gyroflow Project" info:errorMessage];
return;
}

//---------------------------------------------------------
// Get the Lens Identifier from the Gyroflow Project:
//---------------------------------------------------------
NSString *loadedLensIdentifierInGyroflowProjectString = nil;
const char* loadedLensIdentifierInGyroflowProject = getLensIdentifier([gyroflowProjectData UTF8String]);
NSString *loadedLensIdentifierInGyroflowProjectString = [NSString stringWithUTF8String:loadedLensIdentifierInGyroflowProject];
loadedLensIdentifierInGyroflowProjectString = [NSString stringWithUTF8String:loadedLensIdentifierInGyroflowProject];

//---------------------------------------------------------
// Get the Lens Profiles path:
//---------------------------------------------------------
NSBundle *mainBundle = [NSBundle mainBundle];
NSString *lensProfilesPath = [mainBundle pathForResource:@"Lens Profiles" ofType:nil inDirectory:nil];
NSURL *lensProfilesURL = [NSURL fileURLWithPath:lensProfilesPath];
NSBundle *mainBundle = [NSBundle mainBundle];
NSString *lensProfilesPath = [mainBundle pathForResource:@"Lens Profiles" ofType:nil inDirectory:nil];
NSURL *lensProfilesURL = [NSURL fileURLWithPath:lensProfilesPath];

//---------------------------------------------------------
// Try match the Lens Identifier with a JSON file:
//---------------------------------------------------------
if (loadedLensIdentifierInGyroflowProjectString) {
if (loadedLensIdentifierInGyroflowProjectString != nil) {

//NSLog(@"[Gyroflow Toolbox Renderer] Try to match the Lens Identifier with a JSON file");

NSString *path = lensProfilesLookup[loadedLensIdentifierInGyroflowProjectString];
//NSLog(@"[Gyroflow Toolbox Renderer] path: %@", path);
if (path) {
//NSLog(@"[Gyroflow Toolbox Renderer] lensProfilesLookup path: %@", path);

if (path != nil) {
lensProfilesURL = [NSURL fileURLWithPath:path];
} else {
NSLog(@"[Gyroflow Toolbox Renderer] WARNING - Failed to find matching identifier: %@", loadedLensIdentifierInGyroflowProjectString);
Expand All @@ -2409,22 +2443,27 @@ - (void)buttonLoadPresetLensProfileIsImporting:(BOOL)isImporting {
//---------------------------------------------------------
// Limit the file type to Gyroflow supported media files:
//---------------------------------------------------------
UTType *gyroflow = [UTType typeWithFilenameExtension:@"gyroflow"];
UTType *json = [UTType typeWithFilenameExtension:@"json"];

UTType *gyroflow = [UTType typeWithFilenameExtension:@"gyroflow"];
UTType *json = [UTType typeWithFilenameExtension:@"json"];
NSArray *allowedContentTypes = [NSArray arrayWithObjects:gyroflow, json, nil];

//---------------------------------------------------------
// Setup an NSOpenPanel:
//---------------------------------------------------------
NSOpenPanel* panel = [NSOpenPanel openPanel];
[panel setMessage:@"Please select the Preset or Lens Profile:"];
[panel setPrompt:@"Open File"];
[panel setCanChooseDirectories:NO];
[panel setCanCreateDirectories:YES];
[panel setCanChooseFiles:YES];
[panel setAllowsMultipleSelection:NO];
[panel setDirectoryURL:lensProfilesURL];
[panel setAppearance:[NSAppearance appearanceNamed:NSAppearanceNameVibrantDark]];
[panel setAllowedContentTypes:allowedContentTypes];
[panel setExtensionHidden:NO];
[panel setCanSelectHiddenExtension:YES];
[panel setAppearance:[NSAppearance appearanceNamed:NSAppearanceNameVibrantDark]];

//NSLog(@"[Gyroflow Toolbox Renderer] Preparing to open panel!");

//---------------------------------------------------------
// Open the panel:
Expand All @@ -2440,7 +2479,17 @@ - (void)buttonLoadPresetLensProfileIsImporting:(BOOL)isImporting {
// Start accessing security scoped resource:
//---------------------------------------------------------
if (![url startAccessingSecurityScopedResource]) {
[self showAlertWithMessage:@"An error has occurred." info:@"Failed to startAccessingSecurityScopedResource. This shouldn't happen."];
//---------------------------------------------------------
// Stop Action API:
//---------------------------------------------------------
[actionAPI endAction:self];

//---------------------------------------------------------
// Show error message:
//---------------------------------------------------------
NSString *errorMessage = @"Failed to startAccessingSecurityScopedResource during Load Preset/Lens Profile. This shouldn't happen.";
NSLog(@"[Gyroflow Toolbox Renderer] %@", errorMessage);
[self showAlertWithMessage:@"An error has occurred." info:errorMessage];
return;
}

Expand Down Expand Up @@ -2482,8 +2531,17 @@ - (void)buttonLoadPresetLensProfileIsImporting:(BOOL)isImporting {
// Abort is failed:
//---------------------------------------------------------
if (loadResultString == nil || [loadResultString isEqualToString:@"FAIL"]) {
[self showAlertWithMessage:@"An error has occurred" info:@"Failed to load a Lens Profile or Preset."];
//---------------------------------------------------------
// Stop Action API:
//---------------------------------------------------------
[actionAPI endAction:self];

//---------------------------------------------------------
// Show error message:
//---------------------------------------------------------
NSString *errorMessage = @"Failed to load a Lens Profile or Preset.";
NSLog(@"[Gyroflow Toolbox Renderer] %@", errorMessage);
[self showAlertWithMessage:@"An error has occurred" info:errorMessage];
return;
}

Expand All @@ -2500,8 +2558,8 @@ - (void)buttonLoadPresetLensProfileIsImporting:(BOOL)isImporting {
//---------------------------------------------------------
// Show success message:
//---------------------------------------------------------
NSString *message; //= @"The selected Lens Profile has been successfully applied.";
NSString *message = nil;

if (isImporting) {
if (isJSON) {
message = @"The Gyroflow Project, and the selected Preset has been successfully imported into Final Cut Pro.\n\nYou can now adjust the parameters as required via the Video Inspector.";
Expand Down Expand Up @@ -3119,10 +3177,12 @@ - (void)buttonReloadGyroflowProject {
//---------------------------------------------------------
if (bookmarkError == nil) {
if ([decodedMediaBookmarkURL startAccessingSecurityScopedResource]) {
NSLog(@"[Gyroflow Toolbox Renderer] Can access media: %@", [decodedMediaBookmarkURL path]);
} else {
NSLog(@"[Gyroflow Toolbox Renderer] Cannot access media: %@", [decodedMediaBookmarkURL path]);
//NSLog(@"[Gyroflow Toolbox Renderer] Can access media: %@", [decodedMediaBookmarkURL path]);
}
//else
//{
//NSLog(@"[Gyroflow Toolbox Renderer] Cannot access media: %@", [decodedMediaBookmarkURL path]);
//}
}
}

Expand Down Expand Up @@ -3457,7 +3517,7 @@ - (BOOL)importDroppedClip:(NSString*)fcpxmlString {
BRAWToolboxXMLReader *reader = [[[BRAWToolboxXMLReader alloc] init] autorelease];
NSDictionary *result = [reader readXML:fcpxmlString];

if (!result) {
if (![result isKindOfClass:[NSDictionary class]]) {
[self showAlertWithMessage:@"An error has occurred" info:@"Failed to get the media path from the BRAW Toolbox Clip."];
return NO;
}
Expand Down Expand Up @@ -3658,7 +3718,7 @@ - (BOOL)canReadGyroflowPreferencesFile {

[url stopAccessingSecurityScopedResource];

if (preferences == nil) {
if (![preferences isKindOfClass:[NSDictionary class]]) {
NSLog(@"[Gyroflow Toolbox Renderer] Gyroflow Preferences Dictionary is nil.");
return NO;
}
Expand Down Expand Up @@ -3716,7 +3776,7 @@ - (void)readLastProjectFromGyroflowPreferencesFile {

[url stopAccessingSecurityScopedResource];

if (preferences == nil) {
if (![preferences isKindOfClass:[NSDictionary class]]) {
NSString *errorMessage = @"Failed to read the Gyroflow's Preferences file.";
NSLog(@"[Gyroflow Toolbox Renderer] %@", errorMessage);
[self showAlertWithMessage:@"An error has occurred" info:errorMessage];
Expand Down Expand Up @@ -4763,7 +4823,7 @@ - (void)importBRAWToolboxClipWithPath:(NSString*)path bookmarkDataString:(NSStri
//---------------------------------------------------------
// Get Lens Profile Names from Directory:
//---------------------------------------------------------
- (NSDictionary *)getLensProfileIdentifiersFromDirectory:(NSString *)directoryPath {
- (NSDictionary *)newLensProfileIdentifiersFromDirectory:(NSString *)directoryPath {
NSFileManager *fileManager = [NSFileManager defaultManager];
NSMutableArray *jsonFilePaths = [NSMutableArray array];
NSDictionary *result = [NSMutableDictionary dictionary];
Expand Down Expand Up @@ -4791,13 +4851,13 @@ - (NSDictionary *)getLensProfileIdentifiersFromDirectory:(NSString *)directoryPa
if (data) {
NSError *error = nil;
NSDictionary *jsonObject = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error];
if (error == nil && jsonObject[@"identifier"]) {
if (error == nil && [jsonObject isKindOfClass:[NSDictionary class]] && jsonObject[@"identifier"]) {
[(NSMutableDictionary *)result setObject:filePath forKey:jsonObject[@"identifier"]];
}
}
}

return result;
return [result copy];
}

//---------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions Source/Gyroflow/Wrapper Application/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,7 @@
</dict>
</dict>
</array>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
</dict>
</plist>

0 comments on commit 1dca6a9

Please sign in to comment.