Fixing resolve for format_7

This commit is contained in:
Luigi Rosso
2021-03-05 16:54:23 -08:00
parent 84a063a47c
commit 8244e70151
13 changed files with 43 additions and 55 deletions

View File

@ -54,7 +54,7 @@
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = "<group>"; }; 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = "<group>"; };
335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = "<group>"; }; 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = "<group>"; };
33CC10ED2044A3C60003C045 /* rive_example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "rive_example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 33CC10ED2044A3C60003C045 /* example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "example.app"; sourceTree = BUILT_PRODUCTS_DIR; };
33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = "<group>"; }; 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = "<group>"; };
33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; }; 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
@ -105,7 +105,7 @@
33CC10EE2044A3C60003C045 /* Products */ = { 33CC10EE2044A3C60003C045 /* Products */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
33CC10ED2044A3C60003C045 /* rive_example.app */, 33CC10ED2044A3C60003C045 /* example.app */,
); );
name = Products; name = Products;
sourceTree = "<group>"; sourceTree = "<group>";
@ -172,7 +172,7 @@
); );
name = Runner; name = Runner;
productName = Runner; productName = Runner;
productReference = 33CC10ED2044A3C60003C045 /* rive_example.app */; productReference = 33CC10ED2044A3C60003C045 /* example.app */;
productType = "com.apple.product-type.application"; productType = "com.apple.product-type.application";
}; };
/* End PBXNativeTarget section */ /* End PBXNativeTarget section */
@ -183,7 +183,7 @@
attributes = { attributes = {
LastSwiftUpdateCheck = 0920; LastSwiftUpdateCheck = 0920;
LastUpgradeCheck = 0930; LastUpgradeCheck = 0930;
ORGANIZATIONNAME = "The Flutter Authors"; ORGANIZATIONNAME = "";
TargetAttributes = { TargetAttributes = {
33CC10EC2044A3C60003C045 = { 33CC10EC2044A3C60003C045 = {
CreatedOnToolsVersion = 9.2; CreatedOnToolsVersion = 9.2;
@ -202,7 +202,7 @@
}; };
}; };
buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */; buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */;
compatibilityVersion = "Xcode 8.0"; compatibilityVersion = "Xcode 9.3";
developmentRegion = en; developmentRegion = en;
hasScannedForEncodings = 0; hasScannedForEncodings = 0;
knownRegions = ( knownRegions = (
@ -268,7 +268,7 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh\ntouch Flutter/ephemeral/tripwire\n"; shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire";
}; };
/* End PBXShellScriptBuildPhase section */ /* End PBXShellScriptBuildPhase section */
@ -361,10 +361,6 @@
CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter/ephemeral",
);
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
@ -491,10 +487,6 @@
CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter/ephemeral",
);
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
@ -515,10 +507,6 @@
CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter/ephemeral",
);
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",

View File

@ -15,7 +15,7 @@
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "33CC10EC2044A3C60003C045" BlueprintIdentifier = "33CC10EC2044A3C60003C045"
BuildableName = "rive_example.app" BuildableName = "example.app"
BlueprintName = "Runner" BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj"> ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference> </BuildableReference>
@ -27,23 +27,11 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"> shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "00380F9121DF178D00097171"
BuildableName = "RunnerUITests.xctest"
BlueprintName = "RunnerUITests"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion> <MacroExpansion>
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "33CC10EC2044A3C60003C045" BlueprintIdentifier = "33CC10EC2044A3C60003C045"
BuildableName = "rive_example.app" BuildableName = "example.app"
BlueprintName = "Runner" BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj"> ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference> </BuildableReference>
@ -66,7 +54,7 @@
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "33CC10EC2044A3C60003C045" BlueprintIdentifier = "33CC10EC2044A3C60003C045"
BuildableName = "rive_example.app" BuildableName = "example.app"
BlueprintName = "Runner" BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj"> ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference> </BuildableReference>
@ -75,7 +63,7 @@
</AdditionalOptions> </AdditionalOptions>
</LaunchAction> </LaunchAction>
<ProfileAction <ProfileAction
buildConfiguration = "Release" buildConfiguration = "Profile"
shouldUseLaunchSchemeArgsEnv = "YES" shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = "" savedToolIdentifier = ""
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
@ -85,7 +73,7 @@
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "33CC10EC2044A3C60003C045" BlueprintIdentifier = "33CC10EC2044A3C60003C045"
BuildableName = "rive_example.app" BuildableName = "example.app"
BlueprintName = "Runner" BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj"> ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference> </BuildableReference>

View File

@ -5,10 +5,10 @@
// 'flutter create' template. // 'flutter create' template.
// The application's name. By default this is also the title of the Flutter window. // The application's name. By default this is also the title of the Flutter window.
PRODUCT_NAME = rive_example PRODUCT_NAME = example
// The application's bundle identifier // The application's bundle identifier
PRODUCT_BUNDLE_IDENTIFIER = com.example.riveExample PRODUCT_BUNDLE_IDENTIFIER = com.example.example
// The copyright displayed in application information // The copyright displayed in application information
PRODUCT_COPYRIGHT = Copyright © 2020 com.example. All rights reserved. PRODUCT_COPYRIGHT = Copyright © 2021 com.example. All rights reserved.

View File

@ -44,7 +44,7 @@ abstract class CoreContext {
// ignore: one_member_abstracts // ignore: one_member_abstracts
abstract class ImportStackObject { abstract class ImportStackObject {
void resolve(); bool resolve();
} }
/// Stack to help the RiveFile locate latest ImportStackObject created of a /// Stack to help the RiveFile locate latest ImportStackObject created of a
@ -59,17 +59,27 @@ class ImportStack {
return null; return null;
} }
void makeLatest(int coreType, ImportStackObject importObject) { bool makeLatest(int coreType, ImportStackObject importObject) {
var latest = _latests[coreType];
if (latest != null) {
if (!latest.resolve()) {
return false;
}
}
if (importObject != null) { if (importObject != null) {
_latests[coreType] = importObject; _latests[coreType] = importObject;
} else { } else {
_latests.remove(coreType); _latests.remove(coreType);
} }
return true;
} }
void resolve() { bool resolve() {
for (final object in _latests.values) { for (final object in _latests.values) {
object.resolve(); if (!object.resolve()) {
return false;
}
} }
return true;
} }
} }

View File

@ -18,7 +18,7 @@ class ArtboardImporter extends ImportStackObject {
void addStateMachine(StateMachine animation) => addAnimation(animation); void addStateMachine(StateMachine animation) => addAnimation(animation);
@override @override
void resolve() { bool resolve() {
for (final object in artboard.objects.skip(1)) { for (final object in artboard.objects.skip(1)) {
if (object is Component && object.parentId == null) { if (object is Component && object.parentId == null) {
object.parent = artboard; object.parent = artboard;
@ -34,5 +34,6 @@ class ArtboardImporter extends ImportStackObject {
object.onAdded(); object.onAdded();
} }
artboard.clean(); artboard.clean();
return true;
} }
} }

View File

@ -13,5 +13,5 @@ class KeyedObjectImporter extends ImportStackObject {
} }
@override @override
void resolve() {} bool resolve() => true;
} }

View File

@ -16,5 +16,5 @@ class KeyedPropertyImporter extends ImportStackObject {
} }
@override @override
void resolve() {} bool resolve() => true;
} }

View File

@ -12,5 +12,5 @@ class LayerStateImporter extends ImportStackObject {
} }
@override @override
void resolve() {} bool resolve() => true;
} }

View File

@ -16,9 +16,10 @@ class LinearAnimationImporter extends ImportStackObject {
} }
@override @override
void resolve() { bool resolve() {
for (final keyedObject in keyedObjects) { for (final keyedObject in keyedObjects) {
keyedObject?.objectId ??= linearAnimation.artboard.id; keyedObject?.objectId ??= linearAnimation.artboard.id;
} }
return true;
} }
} }

View File

@ -12,6 +12,5 @@ class StateMachineImporter extends ImportStackObject {
} }
@override @override
void resolve() { bool resolve() => true;
}
} }

View File

@ -16,7 +16,7 @@ class StateMachineLayerImporter extends ImportStackObject {
} }
@override @override
void resolve() { bool resolve() {
for (final state in importedStates) { for (final state in importedStates) {
for (final transition in state.transitions) { for (final transition in state.transitions) {
// At import time the stateToId is an index relative to the entire layer // At import time the stateToId is an index relative to the entire layer
@ -34,5 +34,6 @@ class StateMachineLayerImporter extends ImportStackObject {
// transition.stateTo = importedStates[transition.stateToId]; // transition.stateTo = importedStates[transition.stateToId];
} }
} }
return true;
} }
} }

View File

@ -11,5 +11,5 @@ class StateTransitionImporter extends ImportStackObject {
} }
@override @override
void resolve() {} bool resolve() => true;
} }

View File

@ -118,7 +118,9 @@ class RiveFile {
break; break;
} }
importStack.makeLatest(stackType, stackObject); if (!importStack.makeLatest(stackType, stackObject)) {
return false;
}
if (object?.import(importStack) ?? true) { if (object?.import(importStack) ?? true) {
switch (object.coreType) { switch (object.coreType) {
@ -132,9 +134,7 @@ class RiveFile {
} }
} }
} }
importStack.resolve(); return importStack.resolve();
return true;
} }
} }