replace calls to private Filament code with public API for morph target/animation names & cameras

This commit is contained in:
Nick Fisher
2022-04-16 23:04:33 +08:00
parent 53ab72bcff
commit 72fc692305
3 changed files with 79 additions and 107 deletions

View File

@@ -79,7 +79,7 @@ class _MyAppState extends State<MyApp> {
}),
ElevatedButton(
onPressed: () =>
_filamentController.playAnimation(0, loop:_loop),
_filamentController.playAnimation(0, loop: _loop),
child: const Text('play animation')),
Checkbox(
onChanged: (_) => setState(() {
@@ -98,7 +98,7 @@ class _MyAppState extends State<MyApp> {
child: const Text('zoom out')),
ElevatedButton(
onPressed: () {
_filamentController.setCamera("Camera");
_filamentController.setCamera("Camera_Orientation");
},
child: const Text('set camera')),
ElevatedButton(
@@ -121,7 +121,7 @@ class _MyAppState extends State<MyApp> {
builder: (innerCtx) => ElevatedButton(
onPressed: () async {
final names = await _filamentController
.getTargetNames("Cube.001");
.getTargetNames("Cube");
await showDialog(
builder: (ctx) {
@@ -145,6 +145,34 @@ class _MyAppState extends State<MyApp> {
context: innerCtx);
},
child: const Text('get target names'))),
Builder(
builder: (innerCtx) => ElevatedButton(
onPressed: () async {
final names =
await _filamentController.getAnimationNames();
await showDialog(
builder: (ctx) {
return Container(
color: Colors.white,
height: 200,
width: 200,
child: Column(
mainAxisSize: MainAxisSize.min,
children: names
.map((name) => Text(name))
.cast<Widget>()
.toList() +
<Widget>[
ElevatedButton(
onPressed: () =>
Navigator.of(ctx).pop(),
child: Text("Close"))
]));
},
context: innerCtx);
},
child: const Text('get animation names'))),
ElevatedButton(
onPressed: () async {
await _filamentController.panStart(1, 1);
@@ -211,8 +239,8 @@ class _MyAppState extends State<MyApp> {
// .values
// .toList(),
// )
// ElevatedButton(
// child: const Text('init'),
// onPressed: () async {
// await _filamentController.initialize();
// }),
// ElevatedButton(
// child: const Text('init'),
// onPressed: () async {
// await _filamentController.initialize();
// }),