Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix assets location #2311

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -91,12 +91,12 @@ import { Dictionary, Indexed, Keyed } from '@/types/common'
import { PingType } from '@/types/ping'
import { sleep } from '@/utils/helper_functions'

const models: Record<string, string> = import.meta.glob('/public/assets/vehicles/models/**', { eager: true })
const models: Record<string, string> = import.meta.glob('/src/assets/vehicles/models/**', { eager: true })

function get_model(vehicle_name: string, frame_name: string): undefined | string {
const release_path = `assets/vehicles/models/${vehicle_name}/${frame_name}.glb`
if (models[`/public/${release_path}`]) {
return `/assets/vehicles/models/${vehicle_name}/${frame_name}.glb`
const release_path = `/src/assets/vehicles/models/${vehicle_name}/${frame_name}.glb`
if (models[release_path]) {
return release_path
}
return undefined
}
Expand Down Expand Up @@ -349,8 +349,8 @@ export default Vue.extend({
const file = new File([await cropped_image.toBlob(mimeType)], 'viewer.png', { type: mimeType })
saveAs(file)
},
async reloadAnnotations() {
const json = await models[`./${this.vehicle_folder}/${this.frame_name}.json`]
reloadAnnotations() {
const json = models[`/src/assets/vehicles/models/${this.vehicle_folder}/${this.frame_name}.json`]
if (json) {
this.annotations = json.annotations ?? {}
}
Expand Down
9 changes: 3 additions & 6 deletions core/frontend/src/components/wizard/Wizard.vue
Expand Up @@ -280,14 +280,11 @@ import RequireInternet from './RequireInternet.vue'
const WIZARD_VERSION = 4
const models: Record<string, string> = import.meta.glob('/public/assets/vehicles/models/**', { eager: true })
const models: Record<string, string> = import.meta.glob('/src/assets/vehicles/models/**', { eager: true })
function get_model(vehicle_name: string, frame_name: string): undefined | string {
const release_path = `assets/vehicles/models/${vehicle_name}/${frame_name}.glb`
if (models[`/public/${release_path}`]) {
return `/assets/vehicles/models/${vehicle_name}/${frame_name}.glb`
}
return undefined
const release_path = `/src/assets/vehicles/models/${vehicle_name}/${frame_name}.glb`
return models?.[release_path] ? release_path : undefined
}
enum ApplyStatus {
Expand Down