Skip to content

Commit

Permalink
Prevent getting back to non-wireframe after operator (#549)
Browse files Browse the repository at this point in the history
  • Loading branch information
arjxn-py authored Oct 26, 2024
1 parent 1d0575c commit cf2e817
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/base/src/3dview/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,15 @@ export function buildShape(options: {
clippingPlanes: THREE.Plane[];
selected: boolean;
isSolid: boolean;
isWireframe: boolean;
objColor?: THREE.Color | string | number;
}): {
meshGroup: THREE.Group;
mainMesh: THREE.Mesh<THREE.BufferGeometry, THREE.MeshStandardMaterial>;
edgesMeshes: LineSegments2[];
} | null {
const { objName, data, isSolid, clippingPlanes, objColor } = options;
const { objName, data, isSolid, isWireframe, clippingPlanes, objColor } =
options;
const { faceList, edgeList, jcObject } = data;

const vertices: Array<number> = [];
Expand Down Expand Up @@ -158,7 +160,7 @@ export function buildShape(options: {
// it's too bad Three.js does not easily allow setting uniforms independently per-mesh
const material = new THREE.MeshStandardMaterial({
color: new THREE.Color(color),
wireframe: false,
wireframe: isWireframe,
flatShading: false,
clippingPlanes,
metalness: 0.5,
Expand Down
2 changes: 2 additions & 0 deletions packages/base/src/3dview/mainview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,7 @@ export class MainView extends React.Component<IProps, IStates> {
const selected = selectedNames.includes(objName);
const obj = this._model.sharedModel.getObjectByName(objName);
const objColor = obj?.parameters?.Color;
const isWireframe = this.state.wireframe;

// TODO Have a more generic way to spot non-solid objects
const isSolid = !(
Expand All @@ -719,6 +720,7 @@ export class MainView extends React.Component<IProps, IStates> {
clippingPlanes: this._clippingPlanes,
selected,
isSolid,
isWireframe,
objColor
});

Expand Down

0 comments on commit cf2e817

Please sign in to comment.