throw exception on setMaterialColor failure

This commit is contained in:
Nick Fisher
2023-08-23 15:04:49 +08:00
parent 8bc2807592
commit b3a305b4b3

View File

@@ -401,9 +401,9 @@ class FilamentController {
await _channel.invokeMethod("setTexture", [_assetManager, asset]); await _channel.invokeMethod("setTexture", [_assetManager, asset]);
} }
void setMaterialColor(FilamentEntity asset, String meshName, Future setMaterialColor(FilamentEntity asset, String meshName,
int materialIndex, Color color) async { int materialIndex, Color color) async {
await _channel.invokeMethod("setMaterialColor", [ var result = await _channel.invokeMethod("setMaterialColor", [
_assetManager, _assetManager,
asset, asset,
meshName, meshName,
@@ -415,6 +415,9 @@ class FilamentController {
color.alpha.toDouble() / 255.0 color.alpha.toDouble() / 255.0
] ]
]); ]);
if (!result) {
throw Exception("Failed to set material color");
}
} }
void transformToUnitCube(FilamentEntity asset) async { void transformToUnitCube(FilamentEntity asset) async {