Skip to content

Commit

Permalink
Quick Fix in dev (#1020)
Browse files Browse the repository at this point in the history
  • Loading branch information
HunterBarclay authored Jul 9, 2024
2 parents 20c64a0 + 79820de commit 1cd2755
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 54 deletions.
2 changes: 1 addition & 1 deletion fission/src/Synthesis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import World from "@/systems/World.ts"
import { AddRobotsModal, AddFieldsModal, SpawningModal } from "@/modals/spawning/SpawningModals.tsx"
import ImportMirabufModal from "@/modals/mirabuf/ImportMirabufModal.tsx"
import ImportLocalMirabufModal from "@/modals/mirabuf/ImportLocalMirabufModal.tsx"
import APS, { ENDPOINT_SYNTHESIS_CHALLENGE } from "./aps/APS.ts"
import APS from "./aps/APS.ts"
import ResetAllInputsModal from "./ui/modals/configuring/ResetAllInputsModal.tsx"
import Skybox from './ui/components/Skybox.tsx';

Expand Down
4 changes: 4 additions & 0 deletions fission/src/mirabuf/MirabufSceneObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ class MirabufSceneObject extends SceneObject {

return mesh
}

public GetRootNodeId(): Jolt.BodyID | undefined {
return this._mechanism.GetBodyByNodeId(this._mechanism.rootBody)
}
}

export async function CreateMirabuf(assembly: mirabuf.Assembly): Promise<MirabufSceneObject | null | undefined> {
Expand Down
3 changes: 1 addition & 2 deletions fission/src/systems/scene/SceneRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { TransformControls } from "three/examples/jsm/controls/TransformControls
import SceneObject from "./SceneObject"
import WorldSystem from "../WorldSystem"
import { OrbitControls } from "three/examples/jsm/controls/OrbitControls.js"
import MirabufSceneObject from "@/mirabuf/MirabufSceneObject"

import vertexShader from '@/shaders/vertex.glsl';
import fragmentShader from '@/shaders/fragment.glsl';
Expand Down Expand Up @@ -155,7 +154,7 @@ class SceneRenderer extends WorldSystem {
this.RemoveAllSceneObjects()
}

public RegisterSceneObject<T extends MirabufSceneObject>(obj: T): number {
public RegisterSceneObject<T extends SceneObject>(obj: T): number {
const id = nextSceneObjectId++
obj.id = id
this._sceneObjects.set(id, obj)
Expand Down
49 changes: 1 addition & 48 deletions fission/src/ui/components/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,37 +32,11 @@ type DropdownProps = {

const Dropdown: React.FC<DropdownProps> = ({
label,
className,
options,
onSelect,
}) => {
const [expanded, setExpanded] = useState(false)
const [optionList, setOptionList] = useState(options)

type DropdownOptionProps = {
value: string
children?: ReactNode
className?: string
}

const DropdownOption: React.FC<DropdownOptionProps> = ({
children,
value,
className,
}) => (
<span
onClick={() => {
const newOptions = options.filter(item => item !== value)
newOptions.unshift(value)
setOptionList(newOptions)
if (onSelect) onSelect(value)
}}
className={`block relative duration-100 hover:backdrop-brightness-90 w-full h-full px-2 py-2 ${className}`}
style={{ maxWidth: '249px', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', paddingRight: '25px'}}
>
{children}
</span>
)
const [optionList, _setOptionList] = useState(options)

return (
<>
Expand Down Expand Up @@ -151,25 +125,4 @@ const Popup = styled("div")`
width: 100%;
`

// <div
// onClick={() => setExpanded(!expanded)}
// className={`relative flex flex-col gap-2 select-none cursor-pointer bg-gradient-to-r from-interactive-element-left to-interactive-element-right w-full rounded-md ${className}`}
// >
// <DropdownOption value={optionList[0]}>
// {optionList[0]}
// {optionList.length > 1 && (
// <div className="absolute right-2 top-1/2 -translate-y-1/2 flex flex-col h-1/2 content-center items-center">
// <FaChevronUp className="h-1/2" />
// <FaChevronDown className="h-1/2" />
// </div>
// )}
// </DropdownOption>
// {expanded &&
// optionList.slice(1).map(o => (
// <DropdownOption key={o} value={o}>
// {o}
// </DropdownOption>
// ))}
// </div>

export default Dropdown
2 changes: 1 addition & 1 deletion fission/src/ui/components/MainHUD.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { motion } from "framer-motion"
import logo from "@/assets/autodesk_logo.png"
import { ToastType, useToastContext } from "@/ui/ToastContext"
import { Random } from "@/util/Random"
import APS, { APS_USER_INFO_UPDATE_EVENT, ENDPOINT_SYNTHESIS_CHALLENGE } from "@/aps/APS"
import APS, { APS_USER_INFO_UPDATE_EVENT } from "@/aps/APS"
import { UserIcon } from "./UserIcon"
import World from "@/systems/World"
import JOLT from "@/util/loading/JoltSyncLoader"
Expand Down
3 changes: 1 addition & 2 deletions fission/src/ui/components/TransformGizmo.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import MirabufInstance from "@/mirabuf/MirabufInstance"
import World from "@/systems/World"
import * as THREE from "three"

Expand All @@ -15,7 +14,7 @@ class TransformGizmo {
World.SceneRenderer.UpdateTransformGizmoMode(value, this.mesh)
}

constructor(TransformMode: "translate" | "rotate" | "scale", object?: MirabufInstance) {
constructor(TransformMode: "translate" | "rotate" | "scale") {
this.mode = TransformMode
;(this.mesh = new THREE.Mesh(new THREE.SphereGeometry(5))), new THREE.MeshBasicMaterial({ color: 0xff0000 })
// add implementation in JIRA issue #1733 to wrap Mirabuf in Mesh which translates changes
Expand Down

0 comments on commit 1cd2755

Please sign in to comment.