perf: 统一材质编辑器预览直连
This commit is contained in:
parent
1c786b38d5
commit
c964c61a2e
@ -14,7 +14,7 @@ import { useToast } from '@/components/ui/Toast'
|
||||
import { Image } from '@/components/ui/Image'
|
||||
import MobileCameraFileInput from '@/components/mobile/MobileCameraFileInput'
|
||||
import { buildMaterialThumbnailPreviewUrl } from '@/lib/material-thumbnail'
|
||||
import { normalizeMaterialAssetPath } from '@/lib/material-asset-path'
|
||||
import { resolveMaterialAssetUrlForClientAccess } from '@/lib/material-asset-path'
|
||||
import type { MaterialCategoryWithMaterials } from '@/lib/3d/material-manager'
|
||||
|
||||
interface MaterialData {
|
||||
@ -418,10 +418,16 @@ function TextureField({
|
||||
const [uploading, setUploading] = useState(false)
|
||||
|
||||
const previewUrl = useMemo(() => {
|
||||
const directPreviewUrl = resolveMaterialAssetUrlForClientAccess(value)
|
||||
if (type === 'thumbnail') {
|
||||
return buildMaterialThumbnailPreviewUrl({ thumbnailUrl: value, name: label, categoryName: category }, { preferThumbnail: true })
|
||||
return directPreviewUrl
|
||||
|| buildMaterialThumbnailPreviewUrl(
|
||||
{ thumbnailUrl: value, name: label, categoryName: category },
|
||||
{ preferThumbnail: true },
|
||||
)
|
||||
}
|
||||
return normalizeMaterialAssetPath(value) || buildMaterialThumbnailPreviewUrl({ textureUrl: value, name: label, categoryName: category })
|
||||
return directPreviewUrl
|
||||
|| buildMaterialThumbnailPreviewUrl({ textureUrl: value, name: label, categoryName: category })
|
||||
}, [category, label, type, value])
|
||||
|
||||
const canPreview = type === 'thumbnail' || Boolean(value)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user