add option to force loading gltf and check for bool when setting camera

This commit is contained in:
Nick Fisher
2023-10-03 21:27:14 +08:00
parent eeac96a396
commit ba95e5e398

View File

@@ -299,11 +299,11 @@ class FilamentControllerFFI extends FilamentController {
}
@override
Future<FilamentEntity> loadGltf(
String path, String relativeResourcePath, { bool force=false}) async {
if(Platform.isWindows && !force) {
throw Exception("loadGltf has a race condition on Windows which is likely to crash your program. If you really want to try, pass force=true to loadGltf");
Future<FilamentEntity> loadGltf(String path, String relativeResourcePath,
{bool force = false}) async {
if (Platform.isWindows && !force) {
throw Exception(
"loadGltf has a race condition on Windows which is likely to crash your program. If you really want to try, pass force=true to loadGltf");
}
if (_viewer == null || _resizing) {
throw Exception("No viewer available, ignoring");
@@ -628,7 +628,7 @@ class FilamentControllerFFI extends FilamentController {
}
var result = _lib.set_camera(
_viewer!, asset, name?.toNativeUtf8()?.cast<Char>() ?? nullptr);
if (result != 1) {
if (!result) {
throw Exception("Failed to set camera");
}
}