AL_USDMaya  0.29.4
USD to Maya Bridge
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
TransformTranslator.h
1 //
2 // Copyright 2017 Animal Logic
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.//
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 #pragma once
17 
18 #include "../../Api.h"
19 
20 #include <AL/usdmaya/ForwardDeclares.h>
21 #include "AL/usdmaya/TransformOperation.h"
22 #include "AL/usdmaya/fileio/translators/DagNodeTranslator.h"
23 
24 #include "pxr/usd/usd/attribute.h"
25 #include "pxr/usd/usdGeom/xform.h"
26 #include "pxr/usd/usdGeom/xformCommonAPI.h"
27 
28 #include <vector>
29 
30 namespace AL {
31 namespace usdmaya {
32 namespace fileio {
33 namespace translators {
34 
35 //----------------------------------------------------------------------------------------------------------------------
38 //----------------------------------------------------------------------------------------------------------------------
40  : public DagNodeTranslator
41 {
42 public:
43 
46  AL_USDMAYA_PUBLIC
47  static MStatus registerType();
48 
55  AL_USDMAYA_PUBLIC
56  MObject createNode(const UsdPrim& from, MObject parent, const char* nodeType, const ImporterParams& params) override;
57 
63  AL_USDMAYA_PUBLIC
64  MStatus copyAttributes(const UsdPrim& from, MObject to, const ImporterParams& params);
65 
71  AL_USDMAYA_PUBLIC
72  static MStatus copyAttributes(const MObject& from, UsdPrim& to, const ExporterParams& params);
73 
78  AL_USDMAYA_PUBLIC
79  static void copyAttributeValue(const MPlug& attr, UsdAttribute& usdAttr, const UsdTimeCode& timeCode);
80 
87  AL_USDMAYA_PUBLIC
88  static bool getAnimationVariables(TransformOperation operation, MObject& attribute, double& conversionFactor);
89 
90 private:
91  static MStatus processMetaData(const UsdPrim& from, MObject& to, const ImporterParams& params);
92 
93  static MObject m_inheritsTransform;
94  static MObject m_scale;
95  static MObject m_shear;
96  static MObject m_rotation;
97  static MObject m_rotationX;
98  static MObject m_rotationY;
99  static MObject m_rotationZ;
100  static MObject m_rotateOrder;
101  static MObject m_rotateAxis;
102  static MObject m_rotateAxisX;
103  static MObject m_rotateAxisY;
104  static MObject m_rotateAxisZ;
105  static MObject m_translation;
106  static MObject m_scalePivot;
107  static MObject m_rotatePivot;
108  static MObject m_scalePivotTranslate;
109  static MObject m_rotatePivotTranslate;
110  static MObject m_selectHandle;
111  static MObject m_transMinusRotatePivot;
112  static MObject m_visibility;
113 };
114 
115 //----------------------------------------------------------------------------------------------------------------------
116 } // translators
117 } // fileio
118 } // usdmaya
119 } // AL
120 //----------------------------------------------------------------------------------------------------------------------
A class to transfer dag node data between Usd <–> Maya.
Definition: DagNodeTranslator.h:33
static AL_USDMAYA_PUBLIC bool getAnimationVariables(TransformOperation operation, MObject &attribute, double &conversionFactor)
retrieve the corresponding maya attribute for the transform operation.
parameters for the exporter. These parameters are constructed by any command or file translator that ...
Definition: ExportParams.h:35
parameters for the importer
Definition: ImportParams.h:40
static AL_USDMAYA_PUBLIC void copyAttributeValue(const MPlug &attr, UsdAttribute &usdAttr, const UsdTimeCode &timeCode)
copy the attribute value from the plug specified, at the given time, and store the data on the usdAtt...
A utility class to transfer transform nodes between Maya and USD.
Definition: TransformTranslator.h:39
static AL_USDMAYA_PUBLIC MStatus registerType()
static type registration
TransformOperation
An enum describing the type of transformation found in a UsdGeomXformOp.
Definition: TransformOperation.h:36
AL_USDMAYA_PUBLIC MObject createNode(const UsdPrim &from, MObject parent, const char *nodeType, const ImporterParams &params) override
Creates a new maya node of the given type and set attributes based on input prim. ...
AL_USDMAYA_PUBLIC MStatus copyAttributes(const UsdPrim &from, MObject to, const ImporterParams &params)
helper method to copy attributes from the UsdPrim to the Maya node