Skip to content

Line2NodeMaterial: Fix clone() losing worldUnits, dashed, and linewidth#33236

Merged
Mugen87 merged 1 commit into
mrdoob:devfrom
cyphercodes:fix-line2nodematerial-clone
Mar 25, 2026
Merged

Line2NodeMaterial: Fix clone() losing worldUnits, dashed, and linewidth#33236
Mugen87 merged 1 commit into
mrdoob:devfrom
cyphercodes:fix-line2nodematerial-clone

Conversation

@cyphercodes

Copy link
Copy Markdown
Contributor

Problem
When calling clone() on a Line2NodeMaterial, the backing fields _useWorldUnits, _useDash, and _useAlphaToCoverage are not copied to the new instance. This causes the cloned material to lose its configuration.

Solution
Override the copy() method to properly copy all Line2NodeMaterial-specific properties, including the backing fields that were missing.

Changes

  • Added copy() method that copies:
    • Backing fields: _useWorldUnits, _useDash, _useAlphaToCoverage
    • Other properties: vertexColors, dashOffset, lineColorNode, offsetNode, dashScaleNode, dashSizeNode, gapSizeNode

Fixes #33235

Override copy() to ensure _useWorldUnits, _useDash, and _useAlphaToCoverage
are copied when cloning. Also copies other Line2NodeMaterial-specific
properties: vertexColors, dashOffset, lineColorNode, offsetNode,
dashScaleNode, dashSizeNode, and gapSizeNode.

Fixes mrdoob#33235
@github-actions

Copy link
Copy Markdown

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 359.97
85.45
359.97
85.45
+0 B
+0 B
WebGPU 632.85
175.49
633.22
175.54
+368 B
+58 B
WebGPU Nodes 630.97
175.19
631.34
175.25
+368 B
+59 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 492.18
120.03
492.18
120.03
+0 B
+0 B
WebGPU 705.25
190.44
705.25
190.44
+0 B
+0 B
WebGPU Nodes 654.47
177.68
654.47
177.68
+0 B
+0 B

@Mugen87 Mugen87 added this to the r184 milestone Mar 25, 2026
@Mugen87 Mugen87 merged commit d31df14 into mrdoob:dev Mar 25, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Line2NodeMaterial.clone() loses worldUnits, dashed, and linewidth

2 participants