All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
userTaggedAttribute.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_USER_TAGGED_ATTRIBUTE_H
28 #define PXRUSDMAYA_USER_TAGGED_ATTRIBUTE_H
29 
30 #include "pxr/pxr.h"
31 #include "usdMaya/api.h"
32 
33 #include "pxr/base/tf/iterator.h"
34 #include "pxr/base/tf/token.h"
35 #include "pxr/base/tf/staticTokens.h"
36 
37 #include <maya/MObject.h>
38 #include <maya/MPlug.h>
39 
40 #include <map>
41 #include <string>
42 #include <vector>
43 
44 
45 PXR_NAMESPACE_OPEN_SCOPE
46 
47 
48 #define PXRUSDMAYA_ATTR_TOKENS \
49  ((USDAttrTypePrimvar, "primvar")) \
50  ((USDAttrTypeUsdRi, "usdRi"))
51 
53  UsdMayaUserTaggedAttributeTokens,
54  PXRUSDMAYA_API,
55  PXRUSDMAYA_ATTR_TOKENS);
56 
57 
61 {
62 private:
63  MPlug _plug;
64  const std::string _name;
65  const TfToken _type;
66  const TfToken _interpolation;
67  const bool _translateMayaDoubleToUsdSinglePrecision;
68 
69 public:
77  return false;
78  };
79 
80  PXRUSDMAYA_API
82  const MPlug& plug,
83  const std::string& name,
84  const TfToken& type,
85  const TfToken& interpolation,
86  const bool translateMayaDoubleToUsdSinglePrecision =
88 
90  PXRUSDMAYA_API
91  static std::vector<UsdMayaUserTaggedAttribute>
92  GetUserTaggedAttributesForNode(const MObject& mayaNode);
93 
95  PXRUSDMAYA_API
96  MPlug GetMayaPlug() const;
97 
100  PXRUSDMAYA_API
101  std::string GetMayaName() const;
102 
105  PXRUSDMAYA_API
106  std::string GetUsdName() const;
107 
110  PXRUSDMAYA_API
111  TfToken GetUsdType() const;
112 
114  PXRUSDMAYA_API
116 
131  PXRUSDMAYA_API
133 };
134 
135 
136 PXR_NAMESPACE_CLOSE_SCOPE
137 
138 
139 #endif
PXRUSDMAYA_API TfToken GetUsdInterpolation() const
Gets the interpolation for primvars.
PXRUSDMAYA_API bool GetTranslateMayaDoubleToUsdSinglePrecision() const
Gets whether the attribute type should be mapped from a double precision type in Maya to a single pre...
PXRUSDMAYA_API MPlug GetMayaPlug() const
Gets the plug for the Maya attribute to be exported.
Represents a single attribute tagged for translation between Maya and USD, and describes how it will ...
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:89
static bool GetFallbackTranslateMayaDoubleToUsdSinglePrecision()
Gets the fallback value for whether attribute types should be mapped from double precision types in M...
PXRUSDMAYA_API std::string GetMayaName() const
Gets the name of the Maya attribute that will be exported; the name will not contain the name of the ...
#define TF_DECLARE_PUBLIC_TOKENS(...)
Macro to define public tokens.
Definition: staticTokens.h:118
PXRUSDMAYA_API TfToken GetUsdType() const
Gets the type of the USD attribute to export: whether it is a regular attribute, primvar, etc.
static PXRUSDMAYA_API std::vector< UsdMayaUserTaggedAttribute > GetUserTaggedAttributesForNode(const MObject &mayaNode)
Gets all of the exported attributes for the given node.
PXRUSDMAYA_API std::string GetUsdName() const
Gets the name of the USD attribute to which the Maya attribute will be exported.