deepCopy method

Sp3dObj deepCopy()

Deep copy the object.

Implementation

Sp3dObj deepCopy() {
  List<Sp3dV3D> v = [];
  for (var i in vertices) {
    v.add(i.deepCopy());
  }
  List<Sp3dFragment> frgs = [];
  for (var i in fragments) {
    frgs.add(i.deepCopy());
  }
  List<Sp3dMaterial> mtrs = [];
  for (var i in materials) {
    mtrs.add(i.deepCopy());
  }
  List<Uint8List> imgs = [];
  for (Uint8List i in images) {
    imgs.add(Uint8List.fromList(List<int>.from(i)));
  }
  return Sp3dObj(v, frgs, mtrs, imgs,
      id: id,
      name: name,
      author: author,
      physics: physics != null ? physics!.deepCopy() : null,
      option: option != null ? {...option!} : null,
      layerNum: layerNum,
      drawMode: drawMode);
}