fix(item): duplicated items keep their painted slot materials

Duplicating an item drops to the catalog placement flow, which rebuilds the
draft from the asset + transform and never carried node.slots — so the copy
lost every painted slot override. Thread slots through the draft create path:
useDraftNode.create seeds it onto the draft and commit() forwards it to the
final node, the placement coordinator passes it to its lazy wall/ceiling
draft creates, and the item move tool supplies node.slots for both the floor
(direct create) and wall/ceiling (coordinator) duplicate paths.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Wassim SAMAD
2026-06-19 11:17:30 -04:00
co-authored by Claude Opus 4.8
parent bf9246cd36
commit 115a142d83
3 changed files with 28 additions and 4 deletions
+4 -1
View File
@@ -115,6 +115,9 @@ export function MoveItemTool({ node }: { node: ItemNode }) {
const cursor = usePlacementCoordinator({
asset: node.asset,
draftNode,
// Carry painted slot overrides onto the duplicate's draft (wall/ceiling
// items create their draft lazily inside the coordinator).
slots: node.slots,
// Duplicates start fresh in floor mode; wall/ceiling draft is created lazily by ensureDraft.
initialState: isNew
? {
@@ -135,7 +138,7 @@ export function MoveItemTool({ node }: { node: ItemNode }) {
// items are created lazily on surface entry.
gridPosition.copy(new Vector3(...node.position))
if (!node.asset.attachTo) {
draftNode.create(gridPosition, node.asset, node.rotation, node.scale)
draftNode.create(gridPosition, node.asset, node.rotation, node.scale, node.slots)
}
} else {
draftNode.adopt(node)