public copy()

in packages/sdk/src/asset/material.ts [257:302]


	public copy(from: Partial<AssetLike>): this {
		if (!from) {
			return this;
		}

		// Pause change detection while we copy the values into the actor.
		const wasObserving = this.internal.observing;
		this.internal.observing = false;

		super.copy(from);
		if (from.material) {
			if (from.material.color) {
				this.color.copy(from.material.color);
			}
			if (from.material.mainTextureOffset) {
				this.mainTextureOffset.copy(from.material.mainTextureOffset);
			}
			if (from.material.mainTextureScale) {
				this.mainTextureScale.copy(from.material.mainTextureScale);
			}
			if (from.material.mainTextureId) {
				this.mainTextureId = from.material.mainTextureId;
			}
			if (from.material.emissiveColor) {
				this.emissiveColor.copy(from.material.emissiveColor);
			}
			if (from.material.emissiveTextureOffset) {
				this.emissiveTextureOffset.copy(from.material.emissiveTextureOffset);
			}
			if (from.material.emissiveTextureScale) {
				this.emissiveTextureScale.copy(from.material.emissiveTextureScale);
			}
			if (from.material.emissiveTextureId) {
				this.emissiveTextureId = from.material.emissiveTextureId;
			}
			if (from.material.alphaMode) {
				this.alphaMode = from.material.alphaMode;
			}
			if (from.material.alphaCutoff) {
				this.alphaCutoff = from.material.alphaCutoff;
			}
		}

		this.internal.observing = wasObserving;
		return this;
	}