Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
option for instancing in model-transform service (#8083)
Browse files Browse the repository at this point in the history
  • Loading branch information
dinomut1 authored Jun 14, 2023
1 parent 5dbca96 commit 825fc2a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ export default function GLTFTransformProperties({
]}
/>
</InputGroup>
<InputGroup name="Instance" label={t('editor:properties.model.transform.instance')}>
<BooleanInput
value={transformParms.instance.value}
onChange={onChangeTransformParm(transformParms.instance)}
/>
</InputGroup>
<InputGroup name="Remove Duplicates" label={t('editor:properties.model.transform.removeDuplicates')}>
<BooleanInput value={transformParms.dedup.value} onChange={onChangeTransformParm(transformParms.dedup)} />
</InputGroup>
Expand Down
3 changes: 2 additions & 1 deletion packages/engine/src/assets/classes/ModelTransform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export type ResourceTransforms = {
export type ModelTransformParameters = ExtractedImageTransformParameters & {
dst: string
resourceUri: string

instance: boolean
dedup: boolean
prune: boolean
reorder: boolean
Expand All @@ -97,6 +97,7 @@ export const DefaultModelTransformParameters: ModelTransformParameters = {
dst: '',
resourceUri: '',
modelFormat: 'gltf',
instance: true,
dedup: true,
prune: true,
reorder: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,15 +344,9 @@ export async function transformModel(app: Application, args: ModelTransformArgum
unInstanceSingletons(document)
await split(document)
await combineMaterials(document)
await myInstance(document)

if (args.parms.dedup) {
await document.transform(dedup())
}

if (args.parms.prune) {
await document.transform(prune())
}
args.parms.instance && (await myInstance(document))
args.parms.dedup && (await document.transform(dedup()))
args.parms.prune && (await document.transform(prune()))

/* Separate Instanced Geometry */
const instancedNodes = root
Expand Down

0 comments on commit 825fc2a

Please sign in to comment.