Refactor: Improve type handling and robustness for foliage mask indices and keys in terrain brush stamps.
This commit is contained in:
@@ -9685,10 +9685,14 @@ export class ViewportHost {
|
|||||||
|
|
||||||
private mergeTerrainBrushStampIndices(
|
private mergeTerrainBrushStampIndices(
|
||||||
stroke: ActiveTerrainBrushStroke,
|
stroke: ActiveTerrainBrushStroke,
|
||||||
result: Pick<
|
result: {
|
||||||
ReturnType<typeof applyTerrainBrushStampInPlace>,
|
heightSampleIndices: readonly number[];
|
||||||
"heightSampleIndices" | "paintWeightIndices" | "foliageMaskValueIndices"
|
paintWeightIndices: readonly number[];
|
||||||
>
|
foliageMaskValueIndices?: ReturnType<
|
||||||
|
typeof applyTerrainBrushStampInPlace
|
||||||
|
>["foliageMaskValueIndices"];
|
||||||
|
foliageMaskValueKeys?: readonly string[];
|
||||||
|
}
|
||||||
) {
|
) {
|
||||||
for (const sampleIndex of result.heightSampleIndices) {
|
for (const sampleIndex of result.heightSampleIndices) {
|
||||||
stroke.heightSampleIndices.add(sampleIndex);
|
stroke.heightSampleIndices.add(sampleIndex);
|
||||||
@@ -9698,7 +9702,7 @@ export class ViewportHost {
|
|||||||
stroke.paintWeightIndices.add(paintWeightIndex);
|
stroke.paintWeightIndices.add(paintWeightIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const foliageMaskValueIndex of result.foliageMaskValueIndices) {
|
for (const foliageMaskValueIndex of result.foliageMaskValueIndices ?? []) {
|
||||||
stroke.foliageMaskValueKeys.add(
|
stroke.foliageMaskValueKeys.add(
|
||||||
createTerrainFoliageMaskValueKey(
|
createTerrainFoliageMaskValueKey(
|
||||||
foliageMaskValueIndex.layerId,
|
foliageMaskValueIndex.layerId,
|
||||||
@@ -9706,6 +9710,10 @@ export class ViewportHost {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (const foliageMaskValueKey of result.foliageMaskValueKeys ?? []) {
|
||||||
|
stroke.foliageMaskValueKeys.add(foliageMaskValueKey);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private beginTerrainBrushStroke(event: PointerEvent): boolean {
|
private beginTerrainBrushStroke(event: PointerEvent): boolean {
|
||||||
|
|||||||
Reference in New Issue
Block a user