Refactor clientSide scene (#3859)
* refactor clientSide scene * start consolidate threejs segment funcitons * rename stuff * first pass of integrating threejs segment create and update into one * reduce create segment complexity * add color back in * use input * fix comment * feedback changes
This commit is contained in:
@ -204,6 +204,7 @@ export const ModelingMachineProvider = ({
|
||||
pathToNodeString,
|
||||
},
|
||||
})
|
||||
// overlay timeout
|
||||
}, 800) as unknown as number
|
||||
return {
|
||||
...context.segmentHoverMap,
|
||||
|
@ -10,10 +10,10 @@ import {
|
||||
transformSecondarySketchLinesTagFirst,
|
||||
getTransformInfos,
|
||||
PathToNodeMap,
|
||||
TransformInfo,
|
||||
} from '../../lang/std/sketchcombos'
|
||||
import { kclManager } from 'lib/singletons'
|
||||
import { err } from 'lib/trap'
|
||||
import { TransformInfo } from 'lang/std/stdTypes'
|
||||
|
||||
export function equalAngleInfo({
|
||||
selectionRanges,
|
||||
|
@ -10,8 +10,8 @@ import {
|
||||
transformSecondarySketchLinesTagFirst,
|
||||
getTransformInfos,
|
||||
PathToNodeMap,
|
||||
TransformInfo,
|
||||
} from '../../lang/std/sketchcombos'
|
||||
import { TransformInfo } from 'lang/std/stdTypes'
|
||||
import { kclManager } from 'lib/singletons'
|
||||
import { err } from 'lib/trap'
|
||||
|
||||
|
@ -9,8 +9,8 @@ import {
|
||||
PathToNodeMap,
|
||||
getTransformInfos,
|
||||
transformAstSketchLines,
|
||||
TransformInfo,
|
||||
} from '../../lang/std/sketchcombos'
|
||||
import { TransformInfo } from 'lang/std/stdTypes'
|
||||
import { kclManager } from 'lib/singletons'
|
||||
import { err } from 'lib/trap'
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { toolTips } from 'lang/langHelpers'
|
||||
import { Selections } from 'lib/selections'
|
||||
import { BinaryPart, Program, Expr, VariableDeclarator } from '../../lang/wasm'
|
||||
import { Program, Expr, VariableDeclarator } from '../../lang/wasm'
|
||||
import {
|
||||
getNodePathFromSourceRange,
|
||||
getNodeFromPath,
|
||||
@ -11,8 +11,9 @@ import {
|
||||
transformSecondarySketchLinesTagFirst,
|
||||
getTransformInfos,
|
||||
PathToNodeMap,
|
||||
TransformInfo,
|
||||
isExprBinaryPart,
|
||||
} from '../../lang/std/sketchcombos'
|
||||
import { TransformInfo } from 'lang/std/stdTypes'
|
||||
import { GetInfoModal, createInfoModal } from '../SetHorVertDistanceModal'
|
||||
import { createVariableDeclaration } from '../../lang/modifyAst'
|
||||
import { removeDoubleNegatives } from '../AvailableVarsHelpers'
|
||||
@ -178,11 +179,9 @@ export async function applyConstraintIntersect({
|
||||
}
|
||||
}
|
||||
// transform again but forcing certain values
|
||||
const finalValue = removeDoubleNegatives(
|
||||
valueNode as BinaryPart,
|
||||
sign,
|
||||
variableName
|
||||
)
|
||||
if (!isExprBinaryPart(valueNode))
|
||||
return Promise.reject('Invalid valueNode, is not a BinaryPart')
|
||||
const finalValue = removeDoubleNegatives(valueNode, sign, variableName)
|
||||
const transform2 = transformSecondarySketchLinesTagFirst({
|
||||
ast: kclManager.ast,
|
||||
selectionRanges: forcedSelectionRanges,
|
||||
|
@ -9,8 +9,8 @@ import {
|
||||
PathToNodeMap,
|
||||
getRemoveConstraintsTransforms,
|
||||
transformAstSketchLines,
|
||||
TransformInfo,
|
||||
} from '../../lang/std/sketchcombos'
|
||||
import { TransformInfo } from 'lang/std/stdTypes'
|
||||
import { kclManager } from 'lib/singletons'
|
||||
import { err } from 'lib/trap'
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { toolTips } from 'lang/langHelpers'
|
||||
import { Selections } from 'lib/selections'
|
||||
import { BinaryPart, Program, Expr } from '../../lang/wasm'
|
||||
import { Program, Expr } from '../../lang/wasm'
|
||||
import {
|
||||
getNodePathFromSourceRange,
|
||||
getNodeFromPath,
|
||||
@ -9,8 +9,9 @@ import {
|
||||
getTransformInfos,
|
||||
transformAstSketchLines,
|
||||
PathToNodeMap,
|
||||
TransformInfo,
|
||||
isExprBinaryPart,
|
||||
} from '../../lang/std/sketchcombos'
|
||||
import { TransformInfo } from 'lang/std/stdTypes'
|
||||
import {
|
||||
SetAngleLengthModal,
|
||||
createSetAngleLengthModal,
|
||||
@ -121,11 +122,9 @@ export async function applyConstraintAbsDistance({
|
||||
value: forceVal,
|
||||
valueName: constraint === 'yAbs' ? 'yDis' : 'xDis',
|
||||
})
|
||||
let finalValue = removeDoubleNegatives(
|
||||
valueNode as BinaryPart,
|
||||
sign,
|
||||
variableName
|
||||
)
|
||||
if (!isExprBinaryPart(valueNode))
|
||||
return Promise.reject('Invalid valueNode, is not a BinaryPart')
|
||||
let finalValue = removeDoubleNegatives(valueNode, sign, variableName)
|
||||
|
||||
const transform2 = transformAstSketchLines({
|
||||
ast: structuredClone(kclManager.ast),
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { toolTips } from 'lang/langHelpers'
|
||||
import { Selections } from 'lib/selections'
|
||||
import { BinaryPart, Program, Expr, VariableDeclarator } from '../../lang/wasm'
|
||||
import { Program, Expr, VariableDeclarator } from '../../lang/wasm'
|
||||
import {
|
||||
getNodePathFromSourceRange,
|
||||
getNodeFromPath,
|
||||
@ -10,8 +10,9 @@ import {
|
||||
transformSecondarySketchLinesTagFirst,
|
||||
getTransformInfos,
|
||||
PathToNodeMap,
|
||||
TransformInfo,
|
||||
isExprBinaryPart,
|
||||
} from '../../lang/std/sketchcombos'
|
||||
import { TransformInfo } from 'lang/std/stdTypes'
|
||||
import { GetInfoModal, createInfoModal } from '../SetHorVertDistanceModal'
|
||||
import { createVariableDeclaration } from '../../lang/modifyAst'
|
||||
import { removeDoubleNegatives } from '../AvailableVarsHelpers'
|
||||
@ -133,11 +134,9 @@ export async function applyConstraintAngleBetween({
|
||||
}
|
||||
}
|
||||
|
||||
const finalValue = removeDoubleNegatives(
|
||||
valueNode as BinaryPart,
|
||||
sign,
|
||||
variableName
|
||||
)
|
||||
if (!isExprBinaryPart(valueNode))
|
||||
return Promise.reject('Invalid valueNode, is not a BinaryPart')
|
||||
const finalValue = removeDoubleNegatives(valueNode, sign, variableName)
|
||||
// transform again but forcing certain values
|
||||
const transformed2 = transformSecondarySketchLinesTagFirst({
|
||||
ast: kclManager.ast,
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { toolTips } from 'lang/langHelpers'
|
||||
import { BinaryPart, Program, Expr, VariableDeclarator } from '../../lang/wasm'
|
||||
import { Program, Expr, VariableDeclarator } from '../../lang/wasm'
|
||||
import {
|
||||
getNodePathFromSourceRange,
|
||||
getNodeFromPath,
|
||||
@ -9,8 +9,9 @@ import {
|
||||
transformSecondarySketchLinesTagFirst,
|
||||
getTransformInfos,
|
||||
PathToNodeMap,
|
||||
TransformInfo,
|
||||
isExprBinaryPart,
|
||||
} from '../../lang/std/sketchcombos'
|
||||
import { TransformInfo } from 'lang/std/stdTypes'
|
||||
import { GetInfoModal, createInfoModal } from '../SetHorVertDistanceModal'
|
||||
import { createLiteral, createVariableDeclaration } from '../../lang/modifyAst'
|
||||
import { removeDoubleNegatives } from '../AvailableVarsHelpers'
|
||||
@ -139,9 +140,11 @@ export async function applyConstraintHorzVertDistance({
|
||||
pathToNodeMap,
|
||||
}
|
||||
} else {
|
||||
if (!isExprBinaryPart(valueNode))
|
||||
return Promise.reject('Invalid valueNode, is not a BinaryPart')
|
||||
let finalValue = isAlign
|
||||
? createLiteral(0)
|
||||
: removeDoubleNegatives(valueNode as BinaryPart, sign, variableName)
|
||||
: removeDoubleNegatives(valueNode, sign, variableName)
|
||||
// transform again but forcing certain values
|
||||
const transformed = transformSecondarySketchLinesTagFirst({
|
||||
ast: kclManager.ast,
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { toolTips } from 'lang/langHelpers'
|
||||
import { Selections } from 'lib/selections'
|
||||
import { BinaryPart, Program, Expr } from '../../lang/wasm'
|
||||
import { Program, Expr } from '../../lang/wasm'
|
||||
import {
|
||||
getNodePathFromSourceRange,
|
||||
getNodeFromPath,
|
||||
@ -8,9 +8,10 @@ import {
|
||||
import {
|
||||
PathToNodeMap,
|
||||
getTransformInfos,
|
||||
isExprBinaryPart,
|
||||
transformAstSketchLines,
|
||||
TransformInfo,
|
||||
} from '../../lang/std/sketchcombos'
|
||||
import { TransformInfo } from 'lang/std/stdTypes'
|
||||
import {
|
||||
SetAngleLengthModal,
|
||||
createSetAngleLengthModal,
|
||||
@ -125,12 +126,9 @@ export async function applyConstraintAngleLength({
|
||||
valueName: angleOrLength === 'setAngle' ? 'angle' : 'length',
|
||||
shouldCreateVariable: true,
|
||||
})
|
||||
|
||||
let finalValue = removeDoubleNegatives(
|
||||
valueNode as BinaryPart,
|
||||
sign,
|
||||
variableName
|
||||
)
|
||||
if (!isExprBinaryPart(valueNode))
|
||||
return Promise.reject('Invalid valueNode, is not a BinaryPart')
|
||||
let finalValue = removeDoubleNegatives(valueNode, sign, variableName)
|
||||
if (
|
||||
isReferencingYAxisAngle ||
|
||||
(isReferencingXAxisAngle && calcIdentifier.name !== 'ZERO')
|
||||
|
Reference in New Issue
Block a user