Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #332 from mycheckgithub/HotFix-Animation

Fix to have relative clips
  • Loading branch information...
commit 0496c150e55b01b4cc8c3ca65f6d2a6be0862c73 2 parents 02840d9 + b2a7b82
@RemiArnaud RemiArnaud authored
View
6 COLLADAMaya/include/COLLADAMayaDocumentExporter.h
@@ -137,6 +137,8 @@ namespace COLLADAMaya
/** Tolerance value in double to compare values. */
double mDigitTolerance;
+ std::vector<MIntArray> ParamClipVec;
+
public:
/**
@@ -303,6 +305,10 @@ namespace COLLADAMaya
*/
void endExport();
+ void saveParamClip();
+
+ void restoreParamClip();
+
// /**
// * Exports the user defined extra data of the node.
// * @param MObject& node The dependency node which holds the extra data
View
58 COLLADAMaya/src/COLLADAMayaDocumentExporter.cpp
@@ -45,6 +45,11 @@
#include <maya/MFnAttribute.h>
+#include <maya/MFnDependencyNode.h>
+#include <maya/MFnCharacter.h>
+#include <maya/MFnClip.h>
+#include <maya/MItDependencyNodes.h>
+
namespace COLLADAMaya
{
@@ -80,6 +85,7 @@ namespace COLLADAMaya
DocumentExporter::~DocumentExporter()
{
releaseLibraries(); // The libraries should already have been released
+ ParamClipVec.clear();
}
//---------------------------------------------------------------
@@ -135,6 +141,53 @@ namespace COLLADAMaya
delete mCameraExporter;
}
+ void DocumentExporter::restoreParamClip()
+ {
+ MItDependencyNodes clipItr(MFn::kClip);
+ MFnClip clipFn;
+ for (int i1 = 0; !clipItr.isDone(); clipItr.next(), i1++)
+ {
+ if (!clipFn.setObject(clipItr.item())) continue;
+ clipFn.setAbsoluteChannelSettings(ParamClipVec.at(i1));
+ }
+ }
+
+ void DocumentExporter::saveParamClip()
+ {
+ int length = 0;
+
+ MItDependencyNodes CharacterItr(MFn::kCharacter);
+ for (int i1 = 0; !CharacterItr.isDone(); CharacterItr.next(), i1++)
+ {
+ MFnCharacter character;
+ if (!character.setObject(CharacterItr.item())) continue;
+
+ MPlugArray array;
+ character.getMemberPlugs(array);
+
+ length = array.length();
+ }
+
+ MIntArray arrayChannelAttribute(length, 0);
+
+
+ MItDependencyNodes clipItr(MFn::kClip);
+ MFnClip clipFn;
+ for (int i1 = 0; !clipItr.isDone(); clipItr.next(), i1++)
+ {
+
+ if (!clipFn.setObject(clipItr.item())) continue;
+
+ // save original param
+ MIntArray arrayOriginalChannelAttribute(length);
+ clipFn.getAbsoluteChannelSettings(arrayOriginalChannelAttribute);
+ ParamClipVec.push_back(arrayOriginalChannelAttribute);
+
+ // set relativeClip on
+ clipFn.setAbsoluteChannelSettings(arrayChannelAttribute);
+ }
+ }
+
//---------------------------------------------------------------
void DocumentExporter::exportCurrentScene ( bool selectionOnly )
@@ -187,6 +240,9 @@ namespace COLLADAMaya
// Export the physics scene
bool physicsSceneExported = mPhysicsSceneExporter->exportPhysicsScenes();
+
+ saveParamClip();
+
// Export the visual scene
bool visualSceneExported = mVisualSceneExporter->exportVisualScenes();
@@ -199,6 +255,8 @@ namespace COLLADAMaya
mAnimationClipExporter->exportAnimationClips(animationClips);
}
+ restoreParamClip();
+
// Export the scene
exportScene(visualSceneExported, physicsSceneExported);
Please sign in to comment.
Something went wrong with that request. Please try again.