-----------------------------------
| 1513 | |
| 1514 | // ----------------------------------- |
| 1515 | void VisualSceneImporter::writeNodeInstances () |
| 1516 | { |
| 1517 | // A pointer to the current maya ascii file. |
| 1518 | FILE* file = getDocumentImporter ()->getFile (); |
| 1519 | |
| 1520 | // Go through the transform instances and copy / move the instantiated nodes. |
| 1521 | UniqueIdUniqueIdsMap::iterator it = mTransformInstancesMap.begin (); |
| 1522 | while ( it != mTransformInstancesMap.end() ) |
| 1523 | { |
| 1524 | const COLLADAFW::UniqueId& instanceNodeId = it->first; |
| 1525 | BaseImporter::UniqueIdVec& parentNodes = it->second; |
| 1526 | if ( parentNodes.size () == 0 ) |
| 1527 | { |
| 1528 | std::cerr << "There has to be a parent node for the current transform node! Can't import!" << std::endl; |
| 1529 | continue; |
| 1530 | } |
| 1531 | |
| 1532 | // Get the maya child node and read the path. |
| 1533 | MayaNodesList* childTransformNodes = findMayaTransformNodes ( instanceNodeId ); |
| 1534 | if ( childTransformNodes == 0 || childTransformNodes->size () == 0 ) |
| 1535 | { |
| 1536 | std::cerr << "The referenced transform node doesn't exist!" << std::endl; |
| 1537 | return; |
| 1538 | } |
| 1539 | // The first node is always the reference node for the other instances. |
| 1540 | MayaNode* mayaChildNode = (*childTransformNodes) [0]; |
| 1541 | const COLLADAFW::UniqueId& childTransformId = mayaChildNode->getUniqueId (); |
| 1542 | String childNodeName = mayaChildNode->getName (); |
| 1543 | String childNodePath = mayaChildNode->getNodePath (); |
| 1544 | |
| 1545 | // Go through the instances. |
| 1546 | size_t numInstances = parentNodes.size (); |
| 1547 | for ( size_t i=0; i<numInstances; ++i ) |
| 1548 | { |
| 1549 | const COLLADAFW::UniqueId& parentTransformId = parentNodes [i]; |
| 1550 | |
| 1551 | // Get the maya parent nodes and read the path. |
| 1552 | MayaNodesList* parentTransformNodes = findMayaTransformNodes ( parentTransformId ); |
| 1553 | if ( parentTransformNodes == 0 ) |
| 1554 | { |
| 1555 | std::cerr << "The referenced transform node doesn't exist!" << std::endl; |
| 1556 | return; |
| 1557 | } |
| 1558 | // Multiple parent instances... |
| 1559 | MayaNode* mayaParentNode = (*parentTransformNodes) [0]; |
| 1560 | String parentNodeName = mayaParentNode->getName (); |
| 1561 | String parentNodePath = mayaParentNode->getNodePath (); |
| 1562 | |
| 1563 | // This flag is set, if the node is not from the visual scene, |
| 1564 | // but from the library nodes. We don't have to create a new instance, |
| 1565 | // instead of this we have to move the node! |
| 1566 | // bool isCorrectPositioned = mayaChildNode->getIsCorrectPositioned (); |
| 1567 | // if ( !isCorrectPositioned ) |
| 1568 | // { |
| 1569 | // // parent -shape -noConnections -relative "|node1|node2" "|rootNode"; |
| 1570 | // MayaDM::parent ( file, childNodePath, parentNodePath, false, false, true, true ); |
| 1571 | // mayaChildNode->setIsCorrectPositioned ( true ); |
| 1572 | // mayaChildNode->setParent ( mayaParentNode ); |
nothing calls this directly
no test coverage detected