update example project
This commit is contained in:
@@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_filament/flutter_filament.dart';
|
import 'package:flutter_filament/flutter_filament.dart';
|
||||||
import 'package:flutter_filament_example/main.dart';
|
import 'package:flutter_filament_example/main.dart';
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
|
import 'package:animation_tools_dart/animation_tools_dart.dart';
|
||||||
import 'package:vector_math/vector_math_64.dart' as v;
|
import 'package:vector_math/vector_math_64.dart' as v;
|
||||||
|
|
||||||
class AssetSubmenu extends StatefulWidget {
|
class AssetSubmenu extends StatefulWidget {
|
||||||
@@ -96,20 +96,38 @@ class _AssetSubmenuState extends State<AssetSubmenu> {
|
|||||||
child: const Text("Show morph target names for Cylinder")),
|
child: const Text("Show morph target names for Cylinder")),
|
||||||
MenuItemButton(
|
MenuItemButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
widget.controller.setMorphTargetWeights(
|
var cylinder = await widget.controller.getChildEntity(
|
||||||
widget.controller.scene.listEntities().last,
|
widget.controller.scene.listEntities().last, "Cylinder");
|
||||||
"Cylinder",
|
widget.controller
|
||||||
List.filled(4, 1.0));
|
.setMorphTargetWeights(cylinder, List.filled(4, 1.0));
|
||||||
},
|
},
|
||||||
child: const Text("set Cylinder morph weights to 1")),
|
child: const Text("set Cylinder morph weights to 1")),
|
||||||
MenuItemButton(
|
MenuItemButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
widget.controller.setMorphTargetWeights(
|
var cylinder = await widget.controller.getChildEntity(
|
||||||
widget.controller.scene.listEntities().last,
|
widget.controller.scene.listEntities().last, "Cylinder");
|
||||||
"Cylinder",
|
widget.controller
|
||||||
List.filled(4, 0.0));
|
.setMorphTargetWeights(cylinder, List.filled(4, 0.0));
|
||||||
},
|
},
|
||||||
child: const Text("Set Cylinder morph weights to 0")),
|
child: const Text("Set Cylinder morph weights to 0")),
|
||||||
|
MenuItemButton(
|
||||||
|
onPressed: () async {
|
||||||
|
var morphTargets = await widget.controller.getMorphTargetNames(
|
||||||
|
widget.controller.scene.listEntities().last, "Cylinder");
|
||||||
|
|
||||||
|
var morphData = MorphAnimationData(
|
||||||
|
List.generate(
|
||||||
|
60,
|
||||||
|
(frameNum) =>
|
||||||
|
List.generate(4, (morphIndex) => frameNum / 60)),
|
||||||
|
morphTargets);
|
||||||
|
await widget.controller.setMorphAnimationData(
|
||||||
|
widget.controller.scene.listEntities().last, morphData,
|
||||||
|
targetMeshNames: [
|
||||||
|
"Cylinder",
|
||||||
|
]);
|
||||||
|
},
|
||||||
|
child: const Text("create manual morph animation for Cylinder")),
|
||||||
MenuItemButton(
|
MenuItemButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
widget.controller.setPosition(
|
widget.controller.setPosition(
|
||||||
|
|||||||
Reference in New Issue
Block a user