-----------------------------------
| 1408 | |
| 1409 | // ----------------------------------- |
| 1410 | bool VisualSceneImporter::readControllerInstances ( const COLLADAFW::Node* node ) |
| 1411 | { |
| 1412 | // Get the unique id of the current node. |
| 1413 | const COLLADAFW::UniqueId& transformId = node->getUniqueId (); |
| 1414 | |
| 1415 | // Get the maya transform node and set the transform matrix. |
| 1416 | // We will need it again, if we import a skin controller. |
| 1417 | MayaNodesList* mayaNodesList = findMayaTransformNodes ( transformId ); |
| 1418 | if ( mayaNodesList != 0 ) |
| 1419 | { |
| 1420 | COLLADABU::Math::Matrix4 transformMatrix = node->getTransformationMatrix (); |
| 1421 | for ( size_t j=0; j<mayaNodesList->size (); ++j ) |
| 1422 | { |
| 1423 | MayaNode* mayaNode = (*mayaNodesList) [j]; |
| 1424 | mayaNode->setTransformationMatrix ( transformMatrix ); |
| 1425 | } |
| 1426 | } |
| 1427 | |
| 1428 | // Go through the instances and save the ids to the current node. |
| 1429 | const COLLADAFW::InstanceControllerArray& controllerInstances = node->getInstanceControllers (); |
| 1430 | size_t numInstances = controllerInstances.getCount (); |
| 1431 | for ( size_t i=0; i<numInstances; ++i ) |
| 1432 | { |
| 1433 | const COLLADAFW::InstanceController* instanceController = controllerInstances [i]; |
| 1434 | const COLLADAFW::UniqueId& controllerId = instanceController->getInstanciatedObjectId (); |
| 1435 | |
| 1436 | // Save for every controller a list of transform nodes, which refer to it. |
| 1437 | mControllerTransformIdsMap[controllerId].push_back ( transformId ); |
| 1438 | |
| 1439 | // Get the geometryId of the geometry, which is controlled from the current controller object. |
| 1440 | ControllerImporter* controllerImporter = getDocumentImporter ()->getControllerImporter (); |
| 1441 | const COLLADAFW::UniqueId* sourceId = controllerImporter->getControllerSourceId ( controllerId ); |
| 1442 | if ( sourceId == NULL ) |
| 1443 | { |
| 1444 | std::cerr << "No geometry for the current controller!" << std::endl; |
| 1445 | return false; |
| 1446 | } |
| 1447 | |
| 1448 | // Read the shading engines. Store the information, that the material instance is |
| 1449 | // referenced from a controller object. We need this information if we do the |
| 1450 | // connections between the geometries and the shadingEngines. |
| 1451 | readMaterialInstances ( transformId, instanceController, &controllerId ); |
| 1452 | } |
| 1453 | |
| 1454 | return true; |
| 1455 | } |
| 1456 | |
| 1457 | // ----------------------------------- |
| 1458 | template<COLLADAFW::ClassId classId> |
nothing calls this directly
no test coverage detected