Skip to content

Commit

Permalink
added dimensions to validation report (google#3247)
Browse files Browse the repository at this point in the history
  • Loading branch information
elalish authored Mar 4, 2022
1 parent d712c98 commit 7efd5a7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {customElement, html, internalProperty, LitElement, property, query} from
import {validationStyles} from '../../../styles.css.js';
import {State} from '../../../types.js';
import {ConnectedLitElement} from '../../connected_lit_element/connected_lit_element';
import {getModel} from '../../model_viewer_preview/reducer.js';
import {getModel, getModelViewer} from '../../model_viewer_preview/reducer.js';

import {resolveExternalResource, validateGltf} from './validation_utils.js';

Expand Down Expand Up @@ -81,6 +81,9 @@ export class ValidationModal extends LitElement {
<li>${this.report.info!.materialCount} materials</li>
<li>${this.report.info!.totalVertexCount} vertices</li>
<li>${this.report.info!.totalTriangleCount} triangles</li>
<li>${this.report.info!.width!.toPrecision(3)} x-width (meters)</li>
<li>${this.report.info!.height!.toPrecision(3)} y-height (meters)</li>
<li>${this.report.info!.length!.toPrecision(3)} z-length (meters)</li>
</ul>
</li>
</ul>
Expand Down Expand Up @@ -158,6 +161,14 @@ export class Validation extends ConnectedLitElement {

await this.awaitLoad(gltfUrl);
this.countJoints(originalGltf);

const dimensions = getModelViewer().getDimensions();
this.report.info = {
...this.report?.info,
width: dimensions.x,
length: dimensions.z,
height: dimensions.y
};
}
}

Expand Down Expand Up @@ -194,7 +205,7 @@ export class Validation extends ConnectedLitElement {
}
}
}
this.report.info = {...this.report?.info, totalJointCount: jointSet.size }
this.report.info = {...this.report?.info, totalJointCount: jointSet.size};
}

onOpen() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ export type Report = {
totalVertexCount?: number;
totalTriangleCount?: number;
totalJointCount?: number;
width?: number;
length?: number;
height?: number;
};
validatorVersion?: string;
issues?: {
Expand Down

0 comments on commit 7efd5a7

Please sign in to comment.