Tib*_*aru 6 import assets android-studio arcore sceneform
当我尝试导入场景形式资产并在弹出的窗口上按完成时,没有任何反应。没有生成 .sfa、.sfb 文件。在 build.gradle 文件中也没有生成任何内容。我不得不提一下,我导入了之前在同一个项目中的场景资产,一切正常,但现在(一段时间后)当我再次尝试时它不起作用。
来自https://developers.google.com/sceneform/develop/
考虑到 1.15 和 1.17.1 相同,还有这些问题
看起来它不再在开发中,他们不会修复它。这是 android studio 3.6 及更高版本的问题。
没有解决方案,您可以回滚到 Android studio 3.5,或者您可以使用快速解决方法。
在您的应用程序中创建一个新的 sampledata 目录。
右键单击顶级应用程序级目录 > 新建 > 示例数据目录
将您的 3D 资产及其依赖项(obj、mtl、fbx、png)放入 sampledata 目录中。
将 classpath 'com.google.ar.sceneform:plugin:1.15.0' 添加到您的项目级别 gradle。确保您在存储库中有 google()。
// Top-level build file where you can add configuration options. common to all sub-projects/modules
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.1"
classpath 'com.google.ar.sceneform:plugin:1.15.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
Run Code Online (Sandbox Code Playgroud)
sceneform 需要特定版本的 NDK 和 Java。并且您需要应用插件和依赖项,因为它不会在最新版本的 android studio 中自动添加。应用插件:'com.android.application' 应用插件:'com.google.ar.sceneform.plugin'
android {
...
defaultConfig {
...
ndk {
/*
* Sceneform is available for the following ABIs: arm64-v8a, armv7a,
* x86_64 and x86. This sample app enables arm64-v8a to run on
* devices and x86 to run on the emulator. Your application should
* list the ABIs most appropriate to minimize APK size (arm64-v8a recommended).
*/
abiFilters 'arm64-v8a', 'x86'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
buildTypes {
...
}
}
dependencies {
...
implementation 'com.google.ar.sceneform:core:1.15.0'
}
< sceneform.asset code - 7th step >
Run Code Online (Sandbox Code Playgroud)
我已将来自Poly 的Mars 3D 资产添加到我的示例数据中。目录结构看起来像
将原始数据目录添加到资源中。
右键单击 res > 新建 > 文件夹 > 原始资源文件夹。
将此添加到应用程序级 gradle 文件的末尾。
sceneform.asset('sampledata/mars.obj', // 'Source Asset Path' specified during import.
'default', // 'Material Path' specified during import.
'sampledata/mars.sfa', // '.sfa Output Path' specified during import.
'src/main/res/raw/mars')
Run Code Online (Sandbox Code Playgroud)
同步文件,它现在应该可以工作了。
Sceneform 已弃用对 SFB 和 SFB Sceneform Android Studio 插件的支持(可以使用 glTF) -发行说明
该文档仅适用于 sceneform 1.15.0——不包括 glTF 工作流程。您可以查看此演示以使用 glTF。
小智 0
Sceneform 1.16 和 1.17仅支持 gltf:
As part of the 1.16.0 release, support for SFA and SFB assets was removed in favor of adding glTF support
Run Code Online (Sandbox Code Playgroud)
Android Studio 3.6 和 Sceneform Tools 中还有一个 bug,导致 Android Studio 崩溃(将 AS 降级到 3.5 会有所帮助)。如果您想使用 .fbx,您应该降级到 Sceneform 1.15 或者您可以使用 Sceneform 1.17 和 gltf 格式
| 归档时间: |
|
| 查看次数: |
3767 次 |
| 最近记录: |