-----------------------------------
| 433 | |
| 434 | // ----------------------------------- |
| 435 | void BaseImporter::addExtraDataAttribute ( const ExtraTreeElement* extraTreeElement ) |
| 436 | { |
| 437 | FILE* file = getDocumentImporter ()->getFile (); |
| 438 | |
| 439 | // Get the child attributes. |
| 440 | const std::map<String, ExtraTreeElement*>& children = extraTreeElement->getChildren (); |
| 441 | size_t numChildren = children.size (); |
| 442 | |
| 443 | // Create the flags. |
| 444 | std::vector<MayaDM::AttributeFlag> attributeFlags; |
| 445 | if ( extraTreeElement->getValue ().empty () ) |
| 446 | { |
| 447 | // Create a compound attribute for the knot element. |
| 448 | attributeFlags.push_back ( MayaDM::AttributeFlag ( ATTRIBUTE_ATTRIBUTE_TYPE, ATTRIBUTE_TYPE_COMPOUND, false ) ); |
| 449 | attributeFlags.push_back ( MayaDM::AttributeFlag ( ATTRIBUTE_NUMBER_OF_CHILDREN, COLLADABU::Utils::toString ( numChildren ), false ) ); |
| 450 | } |
| 451 | else |
| 452 | { |
| 453 | // Create a normal attribute for the current leaf element. |
| 454 | attributeFlags.push_back ( MayaDM::AttributeFlag ( ATTRIBUTE_DATA_TYPE, ATTRIBUTE_TYPE_STRING ) ); |
| 455 | } |
| 456 | |
| 457 | // Get the parent element if it exist and set it into the current tree element. |
| 458 | const ExtraTreeElement* parentExtraElement = extraTreeElement->getParent (); |
| 459 | if ( parentExtraElement ) |
| 460 | attributeFlags.push_back ( MayaDM::AttributeFlag ( ATTRIBUTE_PARENT, parentExtraElement->getName (), false ) ); |
| 461 | |
| 462 | // Add the current extra tree element. |
| 463 | attributeFlags.push_back ( MayaDM::AttributeFlag ( ATTRIBUTE_HIDDEN, "true", false ) ); |
| 464 | MayaDM::addAttr ( file, extraTreeElement->getName (), attributeFlags ); |
| 465 | |
| 466 | // Recursive call. |
| 467 | std::map<String, ExtraTreeElement*>::const_iterator it = children.begin (); |
| 468 | while ( it != children.end () ) |
| 469 | { |
| 470 | addExtraDataAttribute ( it->second ); |
| 471 | ++it; |
| 472 | } |
| 473 | } |
| 474 | |
| 475 | // ----------------------------------- |
| 476 | void BaseImporter::setExtraDataAttributes ( |
nothing calls this directly
no test coverage detected