Skip to content

Commit

Permalink
Improved UX for selecting scene generation during Ingestion (#584)
Browse files Browse the repository at this point in the history
(new) dropdown for more intuitive selection of voyager scene options
(new) tooltip describing conditions for auto-generation of scenes
(fix) front-end always generating scenes for master models
  • Loading branch information
EMaslowskiQ authored Apr 11, 2024
1 parent 5ebfd78 commit 28a9a8c
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function SceneGenerateWorkflowControl(props: SceneGenerateWorkflowControlProps):
/>
<span>
<Typography style={{ fontSize: '0.8rem' }}>Generate Voyager Scene</Typography>
<em style={{ fontSize: '0.7rem', fontWeight: 300 }}>To enable, <b>Units</b> must be set to mm, cm, m, in, ft, or yd, <b>Purpose</b> must be set to Master, and <b>Model File Type</b> must be set to obj, ply, stl, x3d, wrl, dae, or fbx</em>
<em style={{ fontSize: '0.7rem', fontWeight: 300 }}>(X) To enable, <b>Units</b> must be set to mm, cm, m, in, ft, or yd, <b>Purpose</b> must be set to Master, and <b>Model File Type</b> must be set to obj, ply, stl, x3d, wrl, dae, or fbx</em>
</span>
</Box>
);
Expand Down
32 changes: 26 additions & 6 deletions client/src/pages/Ingestion/components/Metadata/Model/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* This component renders the metadata fields specific to model asset.
*/
import { Box, makeStyles, Typography, Table, TableBody, TableCell, TableContainer, TableRow, Paper, Select, MenuItem } from '@material-ui/core';
import { Box, makeStyles, Typography, Table, TableBody, TableCell, TableContainer, TableRow, Paper, Select, MenuItem, Tooltip } from '@material-ui/core';
import React, { useState, useEffect } from 'react';
import { AssetIdentifiers, DateInputField, ReadOnlyRow, TextArea } from '../../../../../components';
import { StateIdentifier, StateRelatedObject, useSubjectStore, useMetadataStore, useVocabularyStore, useRepositoryStore, FieldErrors } from '../../../../../store';
Expand All @@ -23,7 +23,7 @@ import { apolloClient } from '../../../../../graphql/index';
import { useStyles as useTableStyles } from '../../../../Repository/components/DetailsView/DetailsTab/CaptureDataDetails';
import { errorFieldStyling } from '../Photogrammetry';
import SubtitleControl from '../Control/SubtitleControl';
import SceneGenerateWorkflowControl from '../Control/SceneGenerateWorkflowControl';
// import SceneGenerateWorkflowControl from '../Control/SceneGenerateWorkflowControl';
import { enableSceneGenerateCheck } from '../../../../../store/utils';
import clsx from 'clsx';
import lodash from 'lodash';
Expand Down Expand Up @@ -222,8 +222,9 @@ function Model(props: ModelProps): React.ReactElement {
};

const setSceneGenerate = ({ target }): void => {
const { name, checked } = target;
updateMetadataField(metadataIndex, name, !checked, MetadataType.model);
const { name, value } = target;
console.log(`skipSceneGenerate: ${value} | eval:${(value==='false')} | model:${model.skipSceneGenerate}`);
updateMetadataField(metadataIndex, name, (value==='false'), MetadataType.model);
};

const setIdField = ({ target }): void => {
Expand Down Expand Up @@ -374,13 +375,13 @@ function Model(props: ModelProps): React.ReactElement {
hasError={fieldErrors?.model.subtitles ?? false}
/>
</Box>
<Box style={{ marginBottom: 10 }}>
{/* <Box style={{ marginBottom: 10 }}>
<SceneGenerateWorkflowControl
selected={model.skipSceneGenerate}
disabled={sceneGenerateDisabled}
setCheckboxField={setSceneGenerate}
/>
</Box>
</Box> */}
</>
)}
<Box className={classes.modelDetailsContainer}>
Expand Down Expand Up @@ -469,6 +470,25 @@ function Model(props: ModelProps): React.ReactElement {
</Select>
</TableCell>
</TableRow>
<TableRow className={tableClasses.tableRow}>
<TableCell className={tableClasses.tableCell}><Typography className={tableClasses.labelText}>Generate Voyager Scene</Typography></TableCell>
<TableCell className={tableClasses.tableCell}>
<Tooltip title={<span style={{ fontSize: '0.75rem', fontWeight: 300 }}>To enable, <u><b>Units</b></u> must be set to mm, cm, m, in, ft, or yd, <u><b>Purpose</b></u> must be set to Master, and <u><b>Model File Type</b></u> must be set to obj, ply, stl, x3d, wrl, dae, or fbx</span>}>
<Select
value={String(!model.skipSceneGenerate)}
name='skipSceneGenerate'
onChange={setSceneGenerate}
disableUnderline
disabled={sceneGenerateDisabled}
className={clsx(tableClasses.select, tableClasses.datasetFieldSelect)}
SelectDisplayProps={{ style: { paddingLeft: '10px', borderRadius: '5px' } }}
>
<MenuItem value='true'>True</MenuItem>
<MenuItem value='false'>False</MenuItem>
</Select>
</Tooltip>
</TableCell>
</TableRow>
</TableBody>
</Table>
</TableContainer>
Expand Down
13 changes: 9 additions & 4 deletions client/src/pages/Ingestion/hooks/useIngest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ function useIngest(): UseIngest {
}));

const item: StateItem = getSelectedItem() || { id: '', entireSubject: false, selected: false, subtitle: '', idProject: -1, projectName: '' };
// console.log('item',item);

const isDefaultItem = item.id === defaultItem.id;

Expand Down Expand Up @@ -107,7 +108,7 @@ function useIngest(): UseIngest {

const metadatasList = metadatas.length === 0 ? getMetadatas() : metadatas;
lodash.forEach(metadatasList, metadata => {
// console.log('ingestionStart metadata', metadata);
// console.log('ingestionStart metadata',metadata);
const { file, photogrammetry, model, scene, other, sceneAttachment } = metadata;
const { photogrammetry: isPhotogrammetry, model: isModel, scene: isScene, attachment: isAttachment, other: isOther } = getAssetType(file.type);

Expand Down Expand Up @@ -186,7 +187,8 @@ function useIngest(): UseIngest {
sourceObjects,
derivedObjects,
updateNotes,
subtitles
subtitles,
skipSceneGenerate
} = model;

let {
Expand All @@ -198,6 +200,7 @@ function useIngest(): UseIngest {
} else if (typeof dateCreated === 'object') {
dateCreated = nonNullValue<string>('dateCreated', dateCreated.toISOString());
}
// console.log('model',model);

const ingestIdentifiers: IngestIdentifierInput[] = getIngestIdentifiers(identifiers);
const selectedSubtitle = subtitles.find(subtitle => subtitle.selected);
Expand All @@ -214,8 +217,10 @@ function useIngest(): UseIngest {
directory,
systemCreated,
sourceObjects,
derivedObjects
derivedObjects,
skipSceneGenerate
};
// console.log('modelData', modelData);

const idAsset: number | undefined = idToIdAssetMap.get(file.id);
if (idAsset) {
Expand Down Expand Up @@ -306,7 +311,7 @@ function useIngest(): UseIngest {
other: ingestOther,
sceneAttachment: ingestSceneAttachment
};
// console.log(`** IngestDataInput`, input);
console.log('** IngestDataInput',input);

const ingestDataMutation: FetchResult<IngestDataMutation> = await apolloClient.mutate({
mutation: IngestDataDocument,
Expand Down

0 comments on commit 28a9a8c

Please sign in to comment.