read method

ActorPath read(
  1. ActorArtboard artboard,
  2. StreamReader reader,
  3. ActorPath component
)
override

Implementation

static ActorPath read(
    ActorArtboard artboard, StreamReader reader, ActorPath component) {
  component ??= ActorPath();
  ActorNode.read(artboard, reader, component);
  ActorSkinnable.read(artboard, reader, component);

  component._isHidden = !reader.readBool("isVisible");
  component._isClosed = reader.readBool("isClosed");

  reader.openArray("points");
  int pointCount = reader.readUint16Length();
  component._points = List<PathPoint>(pointCount);
  for (int i = 0; i < pointCount; i++) {
    reader.openObject("point");
    PathPoint point;
    PointType type = pointTypeLookup[reader.readUint8("pointType")];
    switch (type) {
      case PointType.straight:
        {
          point = StraightPathPoint();
          break;
        }
      default:
        {
          point = CubicPathPoint(type);
          break;
        }
    }
    if (point == null) {
      throw UnsupportedError("Invalid point type " + type.toString());
    } else {
      point.read(reader, component.isConnectedToBones);
    }
    reader.closeObject();

    component._points[i] = point;
  }
  reader.closeArray();
  return component;
}