From 02d5f6c9c4fc389c61e2e3eabee40a0c31798d7b Mon Sep 17 00:00:00 2001 From: Aria Minaei Date: Tue, 29 Jun 2021 15:08:02 +0200 Subject: [PATCH] Chore: Removed some unused code --- .../src/components/ProxyManager.tsx | 4 -- packages/plugin-r3f/src/components/UI.tsx | 7 --- packages/plugin-r3f/src/store.ts | 60 +++---------------- 3 files changed, 8 insertions(+), 63 deletions(-) diff --git a/packages/plugin-r3f/src/components/ProxyManager.tsx b/packages/plugin-r3f/src/components/ProxyManager.tsx index c2858f2..504789c 100644 --- a/packages/plugin-r3f/src/components/ProxyManager.tsx +++ b/packages/plugin-r3f/src/components/ProxyManager.tsx @@ -36,7 +36,6 @@ const ProxyManager: VFC = ({orbitControlsRef}) => { transformControlsMode, transformControlsSpace, viewportShading, - setEditableTransform, sheetObjects, ] = useEditorStore( (state) => [ @@ -44,7 +43,6 @@ const ProxyManager: VFC = ({orbitControlsRef}) => { state.transformControlsMode, state.transformControlsSpace, state.viewportShading, - state.setEditableTransform, state.sheetObjects, ], shallow, @@ -251,8 +249,6 @@ const ProxyManager: VFC = ({orbitControlsRef}) => { }, }) }) - - setEditableTransform(selected, obj.matrix.clone()) }} onDraggingChange={(event) => (isBeingEdited.current = event.value)} /> diff --git a/packages/plugin-r3f/src/components/UI.tsx b/packages/plugin-r3f/src/components/UI.tsx index 9eea2a6..1bcf4c6 100644 --- a/packages/plugin-r3f/src/components/UI.tsx +++ b/packages/plugin-r3f/src/components/UI.tsx @@ -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(), - ) } } }} diff --git a/packages/plugin-r3f/src/store.ts b/packages/plugin-r3f/src/store.ts index bff889b..cd2f549 100644 --- a/packages/plugin-r3f/src/store.ts +++ b/packages/plugin-r3f/src/store.ts @@ -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 { } 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: (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 = (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}) },