Skip to content

ClipStyler: style not found when using createFromClipping, internal class reference mismatchΒ #720

@HeyVico

Description

@HeyVico

Describe the bug πŸ“

When registering a style via clipStyler.styles.set() and then calling createFromClipping(), the internally created ClipEdges object throws:

Error: ClipStyler: "SectionFill" style not found.
at ClipEdges.getStyleMeshes
at ClipEdges.updateMeshes
Reproduction:

const clipStyler = components.get(OBCF.ClipStyler);
clipStyler.world = world;

clipStyler.styles.set("SectionFill", {
fillsMaterial: new THREE.MeshBasicMaterial({ color: 0x000000, side: THREE.DoubleSide }),
});

// Style IS in the map:
console.log(clipStyler.styles.has("SectionFill")); // true

const planeKey = clipper.list.keys().next().value;
const clipEdges = clipStyler.createFromClipping(planeKey, {
items: { All: { style: "SectionFill" } },
});
// Throws: ClipStyler: "SectionFill" style not found.

Reproduction ▢️

No response

Steps to reproduce πŸ”’

const clipStyler = components.get(OBCF.ClipStyler);
clipStyler.world = world;

clipStyler.styles.set("SectionFill", {
fillsMaterial: new THREE.MeshBasicMaterial({ color: 0x000000, side: THREE.DoubleSide }),
});

// Style IS in the map:
console.log(clipStyler.styles.has("SectionFill")); // true

const planeKey = clipper.list.keys().next().value;
const clipEdges = clipStyler.createFromClipping(planeKey, {
items: { All: { style: "SectionFill" } },
});
// Throws: ClipStyler: "SectionFill" style not found.

System Info πŸ’»

@thatopen/components: 3.4.0
@thatopen/components-front: 3.4.0
@thatopen/fragments: 3.4.1
three: 0.183.2
Bundler: Vite 6.4.2

Used Package Manager πŸ“¦

npm

Error Trace/Logs πŸ“ƒ

createFromClipping should find styles registered via clipStyler.styles.set() on the same components instance.
In the bundled source (@thatopen/components-front/dist/index.js), ClipEdges.getStyleMeshes looks up the style via:
// line ~66058
const i = this._components.get(Sh).styles.get(t);

Validations βœ…

  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Make sure this is a repository issue and not a framework-specific issue. For example, if it's a THREE.js related bug, it should likely be reported to mrdoob/threejs instead.
  • Check that this is a concrete bug. For Q&A join our Community.
  • The provided reproduction is a minimal reproducible example of the bug.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions