throw Exception if createInstance is called on an instance and pass through isInstance/keepData flags
This commit is contained in:
@@ -134,6 +134,10 @@ class FFIAsset extends ThermionAsset {
|
|||||||
@override
|
@override
|
||||||
Future<FFIAsset> createInstance(
|
Future<FFIAsset> createInstance(
|
||||||
{covariant List<MaterialInstance>? materialInstances = null}) async {
|
{covariant List<MaterialInstance>? materialInstances = null}) async {
|
||||||
|
if(!isInstance) {
|
||||||
|
throw Exception(
|
||||||
|
"createInstance cannot be called on an instance. Make sure you are all calling the method on the original asset");
|
||||||
|
}
|
||||||
if (!keepData) {
|
if (!keepData) {
|
||||||
throw Exception(
|
throw Exception(
|
||||||
"keepData must have been specified as true when this asset was created");
|
"keepData must have been specified as true when this asset was created");
|
||||||
@@ -167,7 +171,7 @@ class FFIAsset extends ThermionAsset {
|
|||||||
if (created == nullptr) {
|
if (created == nullptr) {
|
||||||
throw Exception("Failed to create instance");
|
throw Exception("Failed to create instance");
|
||||||
}
|
}
|
||||||
return FFIAsset(created, app, animationManager);
|
return FFIAsset(created, app, animationManager, isInstance: true, keepData: keepData);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
|
|||||||
Reference in New Issue
Block a user