import { useContext } from "react"; import { Transition } from "@headlessui/react"; import { faArrowRightArrowLeft, faCube, faTrash, } from "@fortawesome/pro-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { AppUiContext } from "../../contexts/AppUiContext"; import { Button, H4, H5, H6, InputVector } from "~/components"; import { XYZ } from "../../datastructures/common"; import { ACTION_TYPES } from "../../reducers/appUiReducer/types"; import { QueueNames } from "../../Queue/QueueNames"; import Queue from "~/pages/PageEnigma/Queue/Queue"; import { toTimelineActions } from "../../Queue/toTimelineActions"; export const ControlPanelSceneObject = () => { const [appUiState, dispatchAppUiState] = useContext(AppUiContext); const position = appUiState?.currentSceneObject.objectVectors.position; const rotation = appUiState?.currentSceneObject.objectVectors.rotation; const scalar = appUiState?.currentSceneObject.objectVectors.scale; const handlePositionChange = (xyz: XYZ) => { if (appUiState) dispatchAppUiState({ type: ACTION_TYPES.UPDATE_CONTROLPANELS_SCENEOBJECT, payload: { currentSceneObject: { objectVectors: { position: { ...xyz }, rotation: appUiState.currentSceneObject.objectVectors.rotation, scale: appUiState.currentSceneObject.objectVectors.scale, }, }, }, }); }; const handleRotationChange = (xyz: XYZ) => { if (appUiState) dispatchAppUiState({ type: ACTION_TYPES.UPDATE_CONTROLPANELS_SCENEOBJECT, payload: { currentSceneObject: { objectVectors: { position: appUiState.currentSceneObject.objectVectors.position, rotation: { ...xyz }, scale: appUiState.currentSceneObject.objectVectors.scale, }, }, }, }); }; const handleScalarChange = (xyz: XYZ) => { if (appUiState) dispatchAppUiState({ type: ACTION_TYPES.UPDATE_CONTROLPANELS_SCENEOBJECT, payload: { currentSceneObject: { objectVectors: { position: appUiState.currentSceneObject.objectVectors.position, rotation: appUiState.currentSceneObject.objectVectors.rotation, scale: { ...xyz }, }, }, }, }); }; const handleOnAddKeyFrame = () => { if (appUiState) { console.log(`${appUiState.currentSceneObject.objectVectors.position.x}`) console.log(`${appUiState.currentSceneObject.objectVectors.position.y}`) console.log(`${appUiState.currentSceneObject.objectVectors.position.z}`) console.log(`${appUiState.currentSceneObject.objectVectors.rotation.x}`) console.log(`${appUiState.currentSceneObject.objectVectors.rotation.y}`) console.log(`${appUiState.currentSceneObject.objectVectors.rotation.z}`) console.log(`${appUiState.currentSceneObject.objectVectors.scale.x}`) console.log(`${appUiState.currentSceneObject.objectVectors.scale.y}`) console.log(`${appUiState.currentSceneObject.objectVectors.scale.z}`) Queue.publish({queueName:QueueNames.TO_TIMELINE, action: toTimelineActions.ADD_KEYFRAME, data: { position: appUiState.currentSceneObject.objectVectors.position, rotation: appUiState.currentSceneObject.objectVectors.rotation, scale:appUiState.currentSceneObject.objectVectors.scale } }) } } return (

Object Name

Swap Object

Position
Rotation
Scale
); };