All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
meshUtil.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 
26 
27 #ifndef PXRUSDMAYA_MESH_UTIL_H
28 #define PXRUSDMAYA_MESH_UTIL_H
29 
30 #include "usdMaya/api.h"
31 
32 #include "pxr/pxr.h"
33 #include "pxr/base/gf/vec3f.h"
34 #include "pxr/base/tf/staticTokens.h"
35 #include "pxr/base/tf/token.h"
36 #include "pxr/base/vt/array.h"
37 
38 #include <maya/MFnMesh.h>
39 #include <maya/MString.h>
40 
41 PXR_NAMESPACE_OPEN_SCOPE
42 
43 class UsdGeomMesh;
44 
45 #define PXRUSDMAYA_MESH_COLOR_SET_TOKENS \
46  ((DisplayColorColorSetName, "displayColor")) \
47  ((DisplayOpacityColorSetName, "displayOpacity"))
48 
49 TF_DECLARE_PUBLIC_TOKENS(UsdMayaMeshColorSetTokens,
50  PXRUSDMAYA_API,
51  PXRUSDMAYA_MESH_COLOR_SET_TOKENS);
52 
54 namespace UsdMayaMeshUtil
55 {
58  PXRUSDMAYA_API
59  bool GetEmitNormalsTag(const MFnMesh &mesh, bool* value);
60 
64  PXRUSDMAYA_API
65  void SetEmitNormalsTag(MFnMesh &meshFn, const bool emitNormals);
66 
68  PXRUSDMAYA_API
69  bool GetMeshNormals(
70  const MObject& mesh,
71  VtArray<GfVec3f>* normalsArray,
72  TfToken* interpolation);
73 
77  PXRUSDMAYA_API
78  TfToken GetSubdivScheme(const MFnMesh &mesh);
79 
83  PXRUSDMAYA_API
84  TfToken GetSubdivInterpBoundary(const MFnMesh &mesh);
85 
90  PXRUSDMAYA_API
91  TfToken GetSubdivFVLinearInterpolation(const MFnMesh& mesh);
92 
93 } // namespace UsdMayaMeshUtil
94 
95 
96 PXR_NAMESPACE_CLOSE_SCOPE
97 
98 #endif
PXRUSDMAYA_API TfToken GetSubdivScheme(const MFnMesh &mesh)
Gets the subdivision scheme tagged for the Maya mesh by consulting the adaptor for UsdGeomMesh...
PXRUSDMAYA_API bool GetEmitNormalsTag(const MFnMesh &mesh, bool *value)
Gets the internal emit-normals tag on the Maya mesh, placing it in value.
PXRUSDMAYA_API TfToken GetSubdivInterpBoundary(const MFnMesh &mesh)
Gets the subdivision interpolate boundary tagged for the Maya mesh by consulting the adaptor for UsdG...
PXRUSDMAYA_API bool GetMeshNormals(const MObject &mesh, VtArray< GfVec3f > *normalsArray, TfToken *interpolation)
Helper method for getting Maya mesh normals as a VtVec3fArray.
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:89
#define TF_DECLARE_PUBLIC_TOKENS(...)
Macro to define public tokens.
Definition: staticTokens.h:118
PXRUSDMAYA_API void SetEmitNormalsTag(MFnMesh &meshFn, const bool emitNormals)
Sets the internal emit-normals tag on the Maya mesh.
Encodes a mesh surface whose definition and feature-set will converge with that of OpenSubdiv...
Definition: mesh.h:86
PXRUSDMAYA_API TfToken GetSubdivFVLinearInterpolation(const MFnMesh &mesh)
Gets the subdivision face-varying linear interpolation tagged for the Maya mesh by consulting the ada...