readComponentsBlock method
Implementation
void readComponentsBlock(StreamReader block) {
int componentCount = block.readUint16Length();
_components = List<ActorComponent?>.filled(componentCount + 1, null);
_components[0] = _root;
// Guaranteed from the exporter to be in index order.
_nodeCount = 1;
for (int componentIndex = 1, end = componentCount + 1;
componentIndex < end;
componentIndex++) {
StreamReader? nodeBlock = block.readNextBlock(blockTypesMap);
if (nodeBlock == null) {
break;
}
ActorComponent? component;
switch (nodeBlock.blockType) {
case BlockTypes.actorNode:
component = ActorNode.read(this, nodeBlock, null);
break;
case BlockTypes.actorBone:
component = ActorBone.read(this, nodeBlock, null);
break;
case BlockTypes.actorRootBone:
component = ActorRootBone.read(this, nodeBlock, null);
break;
case BlockTypes.actorImage:
component = ActorImage.read(this, nodeBlock, actor.makeImageNode());
if ((component as ActorImage).textureIndex > actor.maxTextureIndex) {
actor.maxTextureIndex = component.textureIndex;
}
break;
case BlockTypes.actorEvent:
component = ActorEvent.read(this, nodeBlock, null);
break;
case BlockTypes.actorNodeSolo:
component = ActorNodeSolo.read(this, nodeBlock, null);
break;
case BlockTypes.actorJellyBone:
component = ActorJellyBone.read(this, nodeBlock, null);
break;
case BlockTypes.jellyComponent:
component = JellyComponent.read(this, nodeBlock, null);
break;
case BlockTypes.actorIKConstraint:
component = ActorIKConstraint.read(this, nodeBlock, null);
break;
case BlockTypes.actorDistanceConstraint:
component = ActorDistanceConstraint.read(this, nodeBlock, null);
break;
case BlockTypes.actorTranslationConstraint:
component = ActorTranslationConstraint.read(this, nodeBlock, null);
break;
case BlockTypes.actorScaleConstraint:
component = ActorScaleConstraint.read(this, nodeBlock, null);
break;
case BlockTypes.actorRotationConstraint:
component = ActorRotationConstraint.read(this, nodeBlock, null);
break;
case BlockTypes.actorTransformConstraint:
component = ActorTransformConstraint.read(this, nodeBlock, null);
break;
case BlockTypes.actorShape:
component =
ActorShape.read(this, nodeBlock, actor.makeShapeNode(null));
break;
case BlockTypes.actorPath:
component = ActorPath.read(this, nodeBlock, actor.makePathNode());
break;
case BlockTypes.colorFill:
component = ColorFill.read(this, nodeBlock, actor.makeColorFill());
break;
case BlockTypes.colorStroke:
component =
ColorStroke.read(this, nodeBlock, actor.makeColorStroke());
break;
case BlockTypes.gradientFill:
component =
GradientFill.read(this, nodeBlock, actor.makeGradientFill());
break;
case BlockTypes.gradientStroke:
component =
GradientStroke.read(this, nodeBlock, actor.makeGradientStroke());
break;
case BlockTypes.radialGradientFill:
component =
RadialGradientFill.read(this, nodeBlock, actor.makeRadialFill());
break;
case BlockTypes.radialGradientStroke:
component = RadialGradientStroke.read(
this, nodeBlock, actor.makeRadialStroke());
break;
case BlockTypes.actorEllipse:
component = ActorEllipse.read(this, nodeBlock, actor.makeEllipse());
break;
case BlockTypes.actorRectangle:
component =
ActorRectangle.read(this, nodeBlock, actor.makeRectangle());
break;
case BlockTypes.actorTriangle:
component = ActorTriangle.read(this, nodeBlock, actor.makeTriangle());
break;
case BlockTypes.actorStar:
component = ActorStar.read(this, nodeBlock, actor.makeStar());
break;
case BlockTypes.actorPolygon:
component = ActorPolygon.read(this, nodeBlock, actor.makePolygon());
break;
case BlockTypes.actorSkin:
component = ActorComponent.read(this, nodeBlock, ActorSkin());
break;
case BlockTypes.actorLayerEffectRenderer:
component = ActorDrawable.read(
this, nodeBlock, actor.makeLayerEffectRenderer());
break;
case BlockTypes.actorMask:
component = ActorMask.read(this, nodeBlock, ActorMask());
break;
case BlockTypes.actorBlur:
component = ActorBlur.read(this, nodeBlock, null);
break;
case BlockTypes.actorDropShadow:
component = ActorShadow.read(this, nodeBlock, actor.makeDropShadow());
break;
case BlockTypes.actorInnerShadow:
component =
ActorShadow.read(this, nodeBlock, actor.makeInnerShadow());
break;
default:
break;
}
if (component is ActorDrawable) {
_drawableNodeCount++;
}
if (component is ActorNode) {
_nodeCount++;
}
_components[componentIndex] = component;
if (component != null) {
component.idx = componentIndex;
}
}
_nodes = List<ActorNode?>.filled(_nodeCount, null);
_nodes[0] = _root;
}