Integrate foliage mask value tracking into ViewportHost logic
This commit is contained in:
@@ -9879,11 +9879,16 @@ export class ViewportHost {
|
|||||||
let dirtyBounds = this.activeTerrainBrushStroke.dirtyBounds;
|
let dirtyBounds = this.activeTerrainBrushStroke.dirtyBounds;
|
||||||
const heightSampleIndices = new Set(activeStroke.heightSampleIndices);
|
const heightSampleIndices = new Set(activeStroke.heightSampleIndices);
|
||||||
const paintWeightIndices = new Set(activeStroke.paintWeightIndices);
|
const paintWeightIndices = new Set(activeStroke.paintWeightIndices);
|
||||||
|
const foliageMaskValueKeys = new Set(activeStroke.foliageMaskValueKeys);
|
||||||
const mergeStampIndices = (
|
const mergeStampIndices = (
|
||||||
result: Pick<
|
result: {
|
||||||
ReturnType<typeof applyTerrainBrushStampInPlace>,
|
heightSampleIndices: readonly number[];
|
||||||
"heightSampleIndices" | "paintWeightIndices"
|
paintWeightIndices: readonly number[];
|
||||||
>
|
foliageMaskValueIndices?: ReturnType<
|
||||||
|
typeof applyTerrainBrushStampInPlace
|
||||||
|
>["foliageMaskValueIndices"];
|
||||||
|
foliageMaskValueKeys?: readonly string[];
|
||||||
|
}
|
||||||
) => {
|
) => {
|
||||||
for (const sampleIndex of result.heightSampleIndices) {
|
for (const sampleIndex of result.heightSampleIndices) {
|
||||||
heightSampleIndices.add(sampleIndex);
|
heightSampleIndices.add(sampleIndex);
|
||||||
@@ -9892,6 +9897,19 @@ export class ViewportHost {
|
|||||||
for (const paintWeightIndex of result.paintWeightIndices) {
|
for (const paintWeightIndex of result.paintWeightIndices) {
|
||||||
paintWeightIndices.add(paintWeightIndex);
|
paintWeightIndices.add(paintWeightIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (const foliageMaskValueIndex of result.foliageMaskValueIndices ?? []) {
|
||||||
|
foliageMaskValueKeys.add(
|
||||||
|
createTerrainFoliageMaskValueKey(
|
||||||
|
foliageMaskValueIndex.layerId,
|
||||||
|
foliageMaskValueIndex.index
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const foliageMaskValueKey of result.foliageMaskValueKeys ?? []) {
|
||||||
|
foliageMaskValueKeys.add(foliageMaskValueKey);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!cancelled) {
|
if (!cancelled) {
|
||||||
@@ -9945,7 +9963,9 @@ export class ViewportHost {
|
|||||||
!cancelled &&
|
!cancelled &&
|
||||||
dirtyBounds !== null &&
|
dirtyBounds !== null &&
|
||||||
changed &&
|
changed &&
|
||||||
(heightSampleIndices.size > 0 || paintWeightIndices.size > 0);
|
(heightSampleIndices.size > 0 ||
|
||||||
|
paintWeightIndices.size > 0 ||
|
||||||
|
foliageMaskValueKeys.size > 0);
|
||||||
const toolState = this.activeTerrainBrushStroke.toolState;
|
const toolState = this.activeTerrainBrushStroke.toolState;
|
||||||
this.activeTerrainBrushStroke = null;
|
this.activeTerrainBrushStroke = null;
|
||||||
this.terrainBrushPreviewGroup.visible = false;
|
this.terrainBrushPreviewGroup.visible = false;
|
||||||
@@ -9959,7 +9979,10 @@ export class ViewportHost {
|
|||||||
before: activeStroke.baseTerrain,
|
before: activeStroke.baseTerrain,
|
||||||
after: finalPreviewTerrain,
|
after: finalPreviewTerrain,
|
||||||
heightSampleIndices,
|
heightSampleIndices,
|
||||||
paintWeightIndices
|
paintWeightIndices,
|
||||||
|
foliageMaskValueIndices: [...foliageMaskValueKeys].map(
|
||||||
|
parseTerrainFoliageMaskValueKey
|
||||||
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
const committed =
|
const committed =
|
||||||
|
|||||||
Reference in New Issue
Block a user