forked from overte-org/overte
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdimensions.mel
30 lines (25 loc) · 925 Bytes
/
dimensions.mel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//
// dimensions.mel
//
// Created by Anthony J. Thibault on September 5th, 2017.
// Copyright 2017 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
// Maya Mel script to determine the High Fidelity "naturalDimensions" of a model.
// get a list of all mesh objects
string $meshes[] = `ls -type mesh`;
// compute the bounding box
float $boundingBox[] = `polyEvaluate -boundingBox $meshes`;
// copy values into variables for readability
float $xmin = $boundingBox[0];
float $xmax = $boundingBox[1];
float $ymin = $boundingBox[2];
float $ymax = $boundingBox[3];
float $zmin = $boundingBox[4];
float $zmax = $boundingBox[5];
// compute dimensions, and convert from cm to meters
vector $dim = <<($xmax - $xmin) / 100.0, ($ymax - $ymin) / 100.0, ($zmax - $zmin) / 100.0>>;
// print result
print $dim;