Chore: Removed some unused code

This commit is contained in:
Aria Minaei 2021-06-29 15:08:02 +02:00
parent 040317f53b
commit 02d5f6c9c4
3 changed files with 8 additions and 63 deletions

View file

@ -36,7 +36,6 @@ const ProxyManager: VFC<ProxyManagerProps> = ({orbitControlsRef}) => {
transformControlsMode, transformControlsMode,
transformControlsSpace, transformControlsSpace,
viewportShading, viewportShading,
setEditableTransform,
sheetObjects, sheetObjects,
] = useEditorStore( ] = useEditorStore(
(state) => [ (state) => [
@ -44,7 +43,6 @@ const ProxyManager: VFC<ProxyManagerProps> = ({orbitControlsRef}) => {
state.transformControlsMode, state.transformControlsMode,
state.transformControlsSpace, state.transformControlsSpace,
state.viewportShading, state.viewportShading,
state.setEditableTransform,
state.sheetObjects, state.sheetObjects,
], ],
shallow, shallow,
@ -251,8 +249,6 @@ const ProxyManager: VFC<ProxyManagerProps> = ({orbitControlsRef}) => {
}, },
}) })
}) })
setEditableTransform(selected, obj.matrix.clone())
}} }}
onDraggingChange={(event) => (isBeingEdited.current = event.value)} onDraggingChange={(event) => (isBeingEdited.current = event.value)}
/> />

View file

@ -22,7 +22,6 @@ const UI: VFC = () => {
setTransformControlsSpace, setTransformControlsSpace,
setViewportShading, setViewportShading,
setEditorOpen, setEditorOpen,
setEditableTransform,
] = useEditorStore( ] = useEditorStore(
(state) => [ (state) => [
state.transformControlsMode, state.transformControlsMode,
@ -33,7 +32,6 @@ const UI: VFC = () => {
state.setTransformControlsSpace, state.setTransformControlsSpace,
state.setViewportShading, state.setViewportShading,
state.setEditorOpen, state.setEditorOpen,
state.setEditableTransform,
], ],
shallow, shallow,
) )
@ -117,11 +115,6 @@ const UI: VFC = () => {
proxyObject.position.copy(position) proxyObject.position.copy(position)
proxyObject.updateMatrix() proxyObject.updateMatrix()
setEditableTransform(
selected,
proxyObject.matrix.clone(),
)
} }
} }
}} }}

View file

@ -1,6 +1,6 @@
import type {StateCreator} from 'zustand' import type {StateCreator} from 'zustand'
import create from 'zustand' import create from 'zustand'
import type {Matrix4, Object3D, Scene, WebGLRenderer} from 'three' import type {Object3D, Scene, WebGLRenderer} from 'three'
import {DefaultLoadingManager, Group} from 'three' import {DefaultLoadingManager, Group} from 'three'
import type {MutableRefObject} from 'react' import type {MutableRefObject} from 'react'
import type {OrbitControls} from '@react-three/drei' import type {OrbitControls} from '@react-three/drei'
@ -116,53 +116,25 @@ export interface AbstractSerializedEditable<T extends EditableType> {
} }
export interface SerializedEditableGroup export interface SerializedEditableGroup
extends AbstractSerializedEditable<'group'> { extends AbstractSerializedEditable<'group'> {}
_properties: {
transform: number[]
}
}
export interface SerializedEditableMesh export interface SerializedEditableMesh
extends AbstractSerializedEditable<'mesh'> { extends AbstractSerializedEditable<'mesh'> {}
_properties: {
transform: number[]
}
}
export interface SerializedEditableSpotLight export interface SerializedEditableSpotLight
extends AbstractSerializedEditable<'spotLight'> { extends AbstractSerializedEditable<'spotLight'> {}
_properties: {
transform: number[]
}
}
export interface SerializedEditableDirectionalLight export interface SerializedEditableDirectionalLight
extends AbstractSerializedEditable<'directionalLight'> { extends AbstractSerializedEditable<'directionalLight'> {}
_properties: {
transform: number[]
}
}
export interface SerializedEditablePointLight export interface SerializedEditablePointLight
extends AbstractSerializedEditable<'pointLight'> { extends AbstractSerializedEditable<'pointLight'> {}
_properties: {
transform: number[]
}
}
export interface SerializedEditablePerspectiveCamera export interface SerializedEditablePerspectiveCamera
extends AbstractSerializedEditable<'perspectiveCamera'> { extends AbstractSerializedEditable<'perspectiveCamera'> {}
_properties: {
transform: number[]
}
}
export interface SerializedEditableOrthographicCamera export interface SerializedEditableOrthographicCamera
extends AbstractSerializedEditable<'orthographicCamera'> { extends AbstractSerializedEditable<'orthographicCamera'> {}
_properties: {
transform: number[]
}
}
export type SerializedEditable = export type SerializedEditable =
| SerializedEditableGroup | SerializedEditableGroup
@ -219,8 +191,6 @@ export type EditorStore = {
) => void ) => void
addEditable: <T extends EditableType>(type: T, uniqueName: string) => void addEditable: <T extends EditableType>(type: T, uniqueName: string) => void
removeEditable: (uniqueName: string) => void removeEditable: (uniqueName: string) => void
setEditableTransform: (uniqueName: string, transform: Matrix4) => void
setSelected: (name: string | null) => void
setSelectedHdr: (hdr: string | null) => void setSelectedHdr: (hdr: string | null) => void
setTransformControlsMode: (mode: TransformControlsMode) => void setTransformControlsMode: (mode: TransformControlsMode) => void
setTransformControlsSpace: (mode: TransformControlsSpace) => void setTransformControlsSpace: (mode: TransformControlsSpace) => void
@ -385,20 +355,6 @@ const config: StateCreator<EditorStore> = (set, get) => {
}, },
})) }))
}, },
setEditableTransform: (uniqueName, transform) => {
set((state) => ({
editables: {
...state.editables,
[uniqueName]: {
...state.editables[uniqueName],
properties: {transform},
},
},
}))
},
setSelected: (name) => {
set({selected: name})
},
setSelectedHdr: (hdr) => { setSelectedHdr: (hdr) => {
set({selectedHdr: hdr}) set({selectedHdr: hdr})
}, },