MCPcopy Create free account
hub / github.com/KhronosGroup/OpenCOLLADA / exportSkinController

Method exportSkinController

COLLADAMax/src/COLLADAMaxXRefFile.cpp:142–322  ·  view source on GitHub ↗

---------------------------------------------------------------

Source from the content-addressed store, hash-verified

140
141 //---------------------------------------------------------------
142 void ControllerExporter::exportSkinController( ExportNode* exportNode, SkinController* skinController, const String& controllerId, const String& skinSource )
143 {
144 ISkin* skin = skinController->getSkin();
145
146 if ( !skin )
147 return;
148
149 openSkin(controllerId, skinSource);
150
151 INode* iNode = exportNode->getINode();
152
153 Matrix3 bindShapeTransformationMatrix;
154 skin->GetSkinInitTM(iNode, bindShapeTransformationMatrix, true);
155 double bindShapeTransformationArray[4][4];
156 VisualSceneExporter::matrix3ToDouble4x4(bindShapeTransformationArray, bindShapeTransformationMatrix);
157
158 addBindShapeTransform(bindShapeTransformationArray);
159
160 int jointCount = skin->GetNumBones();
161 INodeList boneINodes;
162
163
164 // Export joints source
165 String jointsId = controllerId + JOINTS_SOURCE_ID_SUFFIX;
166 COLLADASW::NameSource jointSource(mSW);
167 jointSource.setId(jointsId);
168 jointSource.setArrayId(jointsId + ARRAY_ID_SUFFIX);
169 jointSource.setAccessorStride(1);
170 jointSource.getParameterNameList().push_back("JOINT");
171 jointSource.setAccessorCount(jointCount);
172 jointSource.prepareToAppendValues();
173
174 for (int i = 0; i < jointCount; ++i)
175 {
176 // there should not be any null bone.
177 // the ISkin::GetBone, not GetBoneFlat, function is called here.
178 INode* boneNode = skin->GetBone(i);
179 assert(boneNode);
180 boneINodes.push_back(boneNode);
181
182 ExportNode* jointExportNode = mExportSceneGraph->getExportNode(boneNode);
183 assert(jointExportNode);
184
185 if ( !jointExportNode->hasSid() )
186 jointExportNode->setSid(mExportSceneGraph->createJointSid());
187
188 jointExportNode->setIsJoint();
189
190 jointSource.appendValues(jointExportNode->getSid());
191 }
192 jointSource.finish();
193
194 determineReferencedJoints(exportNode, skinController);
195
196 //export inverse bind matrix source
197 String inverseBindMatrixId = controllerId + BIND_POSES_SOURCE_ID_SUFFIX;
198 COLLADASW::Float4x4Source inverseBindMatrixSource(mSW);
199 inverseBindMatrixSource.setId(inverseBindMatrixId);

Callers

nothing calls this directly

Calls 15

getINodeMethod · 0.80
setArrayIdMethod · 0.80
setAccessorStrideMethod · 0.80
setAccessorCountMethod · 0.80
getExportNodeMethod · 0.80
hasSidMethod · 0.80
createJointSidMethod · 0.80
setIsJointMethod · 0.80
getInputListMethod · 0.80
InputClass · 0.50

Tested by

no test coverage detected