---------------------------------------------------------------
| 324 | |
| 325 | //--------------------------------------------------------------- |
| 326 | void ControllerExporter::exportMorphController( ExportNode* exportNode, MorphController* morphController, const String& controllerId, const String& morphSource ) |
| 327 | { |
| 328 | MorphR3* morpher = morphController->getMorph(); |
| 329 | |
| 330 | |
| 331 | FloatList listOfWeights; |
| 332 | StringList listOfTargetIds; |
| 333 | |
| 334 | String weightsId = controllerId + WEIGHTS_SOURCE_ID_SUFFIX; |
| 335 | |
| 336 | size_t channelBankCount = morpher->chanBank.size(); |
| 337 | for ( size_t i = 0; i<channelBankCount; ++i) |
| 338 | { |
| 339 | morphChannel& channel = morpher->chanBank[i]; |
| 340 | |
| 341 | if (!channel.mActive || channel.mNumPoints == 0) |
| 342 | continue; |
| 343 | |
| 344 | INode* targetINode = channel.mConnection; |
| 345 | |
| 346 | listOfWeights.push_back(ConversionFunctors::fromPercent(channel.cblock->GetFloat(morphChannel::cblock_weight_index, mDocumentExporter->getOptions().getAnimationStart()))); |
| 347 | |
| 348 | Control* weightController = channel.cblock->GetController(morphChannel::cblock_weight_index); |
| 349 | mDocumentExporter->getAnimationExporter()->addAnimatedFloat(weightController, weightsId, EMPTY_STRING, (int)i, true, &ConversionFunctors::fromPercent ); |
| 350 | |
| 351 | if ( !targetINode ) |
| 352 | { |
| 353 | MorphControllerHelperGeometry morphControllerHelperGeometry; |
| 354 | morphControllerHelperGeometry.exportNode = exportNode; |
| 355 | morphControllerHelperGeometry.controllerId = controllerId; |
| 356 | morphControllerHelperGeometry.morphController = morphController; |
| 357 | morphControllerHelperGeometry.channelBankindex = i; |
| 358 | |
| 359 | String targetId = ExportSceneGraph::getMorphControllerHelperId(morphControllerHelperGeometry); |
| 360 | listOfTargetIds.push_back(targetId); |
| 361 | } |
| 362 | else |
| 363 | { |
| 364 | ExportNode* targetExportNode = mExportSceneGraph->getExportNode(targetINode); |
| 365 | assert(targetExportNode); |
| 366 | |
| 367 | ExportNode* geometryExportNode = mDocumentExporter->getExportedObjectExportNode(ObjectIdentifier(targetExportNode->getInitialPose())); |
| 368 | assert( geometryExportNode ); |
| 369 | // listOfTargetIds.push_back(geometryExportNode); |
| 370 | listOfTargetIds.push_back(GeometriesExporter::getGeometryId(*geometryExportNode)); |
| 371 | } |
| 372 | } |
| 373 | |
| 374 | openMorph(controllerId, EMPTY_STRING, morphSource); |
| 375 | |
| 376 | //export weights source |
| 377 | String targetId = controllerId + TARGETS_SOURCE_ID_SUFFIX; |
| 378 | COLLADASW::IdRefSource targetsSource(mSW); |
| 379 | targetsSource.setId(targetId); |
| 380 | targetsSource.setArrayId(targetId + ARRAY_ID_SUFFIX); |
| 381 | targetsSource.setAccessorStride(1); |
| 382 | targetsSource.getParameterNameList().push_back("MORPH_TARGET"); |
| 383 | targetsSource.setAccessorCount((unsigned long)listOfTargetIds.size()); |
nothing calls this directly
no test coverage detected