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

View file

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

View file

@ -1,6 +1,6 @@
import type {StateCreator} 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 type {MutableRefObject} from 'react'
import type {OrbitControls} from '@react-three/drei'
@ -116,53 +116,25 @@ export interface AbstractSerializedEditable<T extends EditableType> {
}
export interface SerializedEditableGroup
extends AbstractSerializedEditable<'group'> {
_properties: {
transform: number[]
}
}
extends AbstractSerializedEditable<'group'> {}
export interface SerializedEditableMesh
extends AbstractSerializedEditable<'mesh'> {
_properties: {
transform: number[]
}
}
extends AbstractSerializedEditable<'mesh'> {}
export interface SerializedEditableSpotLight
extends AbstractSerializedEditable<'spotLight'> {
_properties: {
transform: number[]
}
}
extends AbstractSerializedEditable<'spotLight'> {}
export interface SerializedEditableDirectionalLight
extends AbstractSerializedEditable<'directionalLight'> {
_properties: {
transform: number[]
}
}
extends AbstractSerializedEditable<'directionalLight'> {}
export interface SerializedEditablePointLight
extends AbstractSerializedEditable<'pointLight'> {
_properties: {
transform: number[]
}
}
extends AbstractSerializedEditable<'pointLight'> {}
export interface SerializedEditablePerspectiveCamera
extends AbstractSerializedEditable<'perspectiveCamera'> {
_properties: {
transform: number[]
}
}
extends AbstractSerializedEditable<'perspectiveCamera'> {}
export interface SerializedEditableOrthographicCamera
extends AbstractSerializedEditable<'orthographicCamera'> {
_properties: {
transform: number[]
}
}
extends AbstractSerializedEditable<'orthographicCamera'> {}
export type SerializedEditable =
| SerializedEditableGroup
@ -219,8 +191,6 @@ export type EditorStore = {
) => void
addEditable: <T extends EditableType>(type: T, uniqueName: string) => void
removeEditable: (uniqueName: string) => void
setEditableTransform: (uniqueName: string, transform: Matrix4) => void
setSelected: (name: string | null) => void
setSelectedHdr: (hdr: string | null) => void
setTransformControlsMode: (mode: TransformControlsMode) => 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) => {
set({selectedHdr: hdr})
},