1 /* 2 Copyright (c) 2008-2009 NetAllied Systems GmbH 3 4 This file is part of COLLADAMax. 5 6 Portions of the code are: 7 Copyright (c) 2005-2007 Feeling Software Inc. 8 Copyright (c) 2005-2007 Sony Computer Entertainment America 9 10 Based on the 3dsMax COLLADASW Tools: 11 Copyright (c) 2005-2006 Autodesk Media Entertainment 12 13 Licensed under the MIT Open Source License, 14 for details please see LICENSE file or the website 15 http://www.opensource.org/licenses/mit-license.php 16 */ 17 18 #include "COLLADAMaxStableHeaders.h" 19 #include "COLLADAMaxImporterBase.h" 20 21 #include "COLLADAFWUniqueId.h" 22 #include "COLLADAFWAnimationList.h" 23 #include "COLLADAFWVisualScene.h" 24 25 26 namespace COLLADAMax 27 { 28 29 const String ImporterBase::EMPTY_STRING = ""; 30 ImporterBase(DocumentImporter * documentImporter)31 ImporterBase::ImporterBase( DocumentImporter* documentImporter) 32 : mDocumentImporter(documentImporter) 33 { 34 } 35 36 //------------------------------ ~ImporterBase()37 ImporterBase::~ImporterBase() 38 { 39 } 40 41 //------------------------------ createMaxObject(SClass_ID superClassId,Class_ID classId)42 void* ImporterBase::createMaxObject( SClass_ID superClassId, Class_ID classId ) 43 { 44 return mDocumentImporter->createMaxObject( superClassId, classId ); 45 } 46 47 //------------------------------ getMaxInterface()48 Interface* ImporterBase::getMaxInterface() 49 { 50 return mDocumentImporter->getMaxInterface(); 51 } 52 53 //------------------------------ getMaxImportInterface()54 ImpInterface* ImporterBase::getMaxImportInterface() 55 { 56 return mDocumentImporter->getMaxImportInterface(); 57 } 58 59 //------------------------------ printMessage(const String & message)60 void ImporterBase::printMessage( const String& message ) 61 { 62 mDocumentImporter->printMessage(message); 63 } 64 65 //------------------------------ getElapsedTime() const66 double ImporterBase::getElapsedTime()const 67 { 68 return mDocumentImporter->getElapsedTime(); 69 } 70 71 //------------------------------ getDummyObject()72 DummyObject* ImporterBase::getDummyObject() 73 { 74 return mDocumentImporter->getDummyObject(); 75 } 76 77 //------------------------------ addUniqueIdObjectINodePair(const COLLADAFW::UniqueId & uniqueId,INode * node)78 void ImporterBase::addUniqueIdObjectINodePair( const COLLADAFW::UniqueId& uniqueId, INode* node ) 79 { 80 mDocumentImporter->getUniqueIdObjectINodeMap().insert(std::pair<COLLADAFW::UniqueId, INode*>(uniqueId, node) ); 81 } 82 83 //------------------------------ addUniqueIdReferencingImpNodePair(const COLLADAFW::UniqueId & uniqueId,ImpNode * node)84 void ImporterBase::addUniqueIdReferencingImpNodePair( const COLLADAFW::UniqueId& uniqueId, ImpNode* node ) 85 { 86 mDocumentImporter->getUniqueIdReferencingImpNodeMap().insert(std::pair<COLLADAFW::UniqueId, ImpNode*>(uniqueId, node) ); 87 } 88 89 //------------------------------ removeUniqueIdReferencingImpNodePair(const COLLADAFW::UniqueId & uniqueId,ImpNode * node)90 void ImporterBase::removeUniqueIdReferencingImpNodePair( const COLLADAFW::UniqueId& uniqueId, ImpNode* node ) 91 { 92 DocumentImporter::UniqueIdImpNodeMultiMap& uniqueIdReferencingImpNodeMap = mDocumentImporter->getUniqueIdReferencingImpNodeMap(); 93 94 DocumentImporter::UniqueIdImpNodeMultiMap::iterator rangeBegin = uniqueIdReferencingImpNodeMap.lower_bound(uniqueId); 95 DocumentImporter::UniqueIdImpNodeMultiMap::iterator rangeEnd = uniqueIdReferencingImpNodeMap.upper_bound(uniqueId); 96 97 for (DocumentImporter::UniqueIdImpNodeMultiMap::iterator it = rangeBegin; it != rangeEnd; ++it) 98 { 99 if ( it->second == node ) 100 { 101 uniqueIdReferencingImpNodeMap.erase(it); 102 break; 103 } 104 } 105 } 106 107 //------------------------------ getObjectINodesByUniqueId(const COLLADAFW::UniqueId & uniqueId,COLLADAMax::INodeList & nodelist)108 void ImporterBase::getObjectINodesByUniqueId( const COLLADAFW::UniqueId& uniqueId, COLLADAMax::INodeList& nodelist ) 109 { 110 const DocumentImporter::UniqueIdINodeMultiMap& uniqueIdINodeMap = mDocumentImporter->getUniqueIdObjectINodeMap(); 111 112 DocumentImporter::UniqueIdINodeMultiMap::const_iterator rangeBegin = uniqueIdINodeMap.lower_bound(uniqueId); 113 DocumentImporter::UniqueIdINodeMultiMap::const_iterator rangeEnd = uniqueIdINodeMap.upper_bound(uniqueId); 114 115 for (DocumentImporter::UniqueIdINodeMultiMap::const_iterator it = rangeBegin; it != rangeEnd; ++it) 116 nodelist.push_back(it->second); 117 } 118 119 //------------------------------ getUniqueIdObjectINodesBegin() const120 DocumentImporter::UniqueIdINodeMultiMapConstIterator ImporterBase::getUniqueIdObjectINodesBegin() const 121 { 122 const DocumentImporter::UniqueIdINodeMultiMap& uniqueIdINodeMap = mDocumentImporter->getUniqueIdObjectINodeMap(); 123 return uniqueIdINodeMap.begin(); 124 } 125 126 //------------------------------ getUniqueIdObjectINodesEnd() const127 DocumentImporter::UniqueIdINodeMultiMapConstIterator ImporterBase::getUniqueIdObjectINodesEnd() const 128 { 129 const DocumentImporter::UniqueIdINodeMultiMap& uniqueIdINodeMap = mDocumentImporter->getUniqueIdObjectINodeMap(); 130 return uniqueIdINodeMap.end(); 131 } 132 133 //------------------------------ getReferencingImpNodesByUniqueId(const COLLADAFW::UniqueId & uniqueId)134 ImpNode* ImporterBase::getReferencingImpNodesByUniqueId( const COLLADAFW::UniqueId& uniqueId ) 135 { 136 const DocumentImporter::UniqueIdImpNodeMultiMap& uniqueIdReferencingImpNodeMap = mDocumentImporter->getUniqueIdReferencingImpNodeMap(); 137 138 DocumentImporter::UniqueIdImpNodeMultiMap::const_iterator it = uniqueIdReferencingImpNodeMap.find(uniqueId); 139 if ( it == uniqueIdReferencingImpNodeMap.end() ) 140 return 0; 141 else 142 return it->second; 143 } 144 145 146 //------------------------------ addUniqueIdObjectPair(const COLLADAFW::UniqueId & uniqueId,Object * object)147 void ImporterBase::addUniqueIdObjectPair( const COLLADAFW::UniqueId& uniqueId, Object* object ) 148 { 149 mDocumentImporter->getUniqueIdObjectMap()[uniqueId] = object; 150 } 151 152 153 //------------------------------ addUniqueIdINodePair(const COLLADAFW::UniqueId & uniqueId,INode * iNode)154 void ImporterBase::addUniqueIdINodePair( const COLLADAFW::UniqueId& uniqueId, INode* iNode ) 155 { 156 mDocumentImporter->getUniqueIdINodeMap()[uniqueId] = iNode; 157 } 158 159 //------------------------------ addObjectINodeUniqueIdPair(INode * iNode,const COLLADAFW::UniqueId & uniqueId)160 void ImporterBase::addObjectINodeUniqueIdPair( INode* iNode, const COLLADAFW::UniqueId& uniqueId ) 161 { 162 mDocumentImporter->getObjectINodeUniqueIdMap()[iNode] = uniqueId; 163 } 164 165 //------------------------------ addUniqueIdFWNodePair(const COLLADAFW::UniqueId & uniqueId,const COLLADAFW::Node * node)166 void ImporterBase::addUniqueIdFWNodePair( const COLLADAFW::UniqueId& uniqueId, const COLLADAFW::Node* node ) 167 { 168 mDocumentImporter->getUniqueIdFWNodeMap()[uniqueId] = node; 169 } 170 171 //------------------------------ addUniqueIdFWMaterialPair(const COLLADAFW::UniqueId & uniqueId,const COLLADAFW::Material & material)172 void ImporterBase::addUniqueIdFWMaterialPair( const COLLADAFW::UniqueId& uniqueId, const COLLADAFW::Material& material ) 173 { 174 mDocumentImporter->getUniqueIdFWMaterialMap().insert(std::pair<COLLADAFW::UniqueId, COLLADAFW::Material>(uniqueId, material)); 175 } 176 177 //------------------------------ addUniqueIdFWEffectPair(const COLLADAFW::UniqueId & uniqueId,const COLLADAFW::Effect & effect)178 void ImporterBase::addUniqueIdFWEffectPair( const COLLADAFW::UniqueId& uniqueId, const COLLADAFW::Effect& effect ) 179 { 180 mDocumentImporter->getUniqueIdFWEffectMap().insert(std::pair<COLLADAFW::UniqueId, COLLADAFW::Effect>(uniqueId, effect));; 181 } 182 183 //------------------------------ addUniqueIdFWImagePair(const COLLADAFW::UniqueId & uniqueId,const COLLADAFW::Image & Image)184 void ImporterBase::addUniqueIdFWImagePair( const COLLADAFW::UniqueId& uniqueId, const COLLADAFW::Image& Image ) 185 { 186 mDocumentImporter->getUniqueIdFWImageMap().insert(std::pair<COLLADAFW::UniqueId, COLLADAFW::Image>(uniqueId, Image));; 187 } 188 189 //------------------------------ createAndAddNodeMaterialBindingsPair(INode * node)190 DocumentImporter::NodeMaterialBindingsPair& ImporterBase::createAndAddNodeMaterialBindingsPair( INode* node ) 191 { 192 DocumentImporter::NodeMaterialBindingsPair newPair; 193 newPair.maxNode = node; 194 DocumentImporter::NodeMaterialBindingsList& list = mDocumentImporter->getNodeMaterialBindingsList(); 195 list.push_back(newPair); 196 return *list.rbegin(); 197 } 198 199 //------------------------------ addLibraryNodes(const COLLADAFW::LibraryNodes * libraryNodes)200 void ImporterBase::addLibraryNodes( const COLLADAFW::LibraryNodes* libraryNodes ) 201 { 202 mDocumentImporter->getLibraryNodesList().push_back(libraryNodes); 203 } 204 205 //------------------------------ addVisualScene(const COLLADAFW::VisualScene * visualScene)206 void ImporterBase::addVisualScene( const COLLADAFW::VisualScene* visualScene ) 207 { 208 DocumentImporter::UniqueIdVisualSceneMap& map = mDocumentImporter->getUniqueIdVisualSceneMap(); 209 map[ visualScene->getUniqueId() ] = visualScene; 210 } 211 212 //------------------------------ addClonedINodeOriginalINodePair(INode * clonedNode,INode * originalNode)213 void ImporterBase::addClonedINodeOriginalINodePair( INode* clonedNode, INode* originalNode ) 214 { 215 DocumentImporter::INodeINodePairList& inodeInodePairList = mDocumentImporter->getClonedINodeOriginalINodePairList(); 216 inodeInodePairList.push_back(std::pair<INode*, INode*>(clonedNode, originalNode)); 217 } 218 219 //------------------------------ addObjectObjectNamePair(Object * object,const String & name)220 void ImporterBase::addObjectObjectNamePair( Object* object, const String& name ) 221 { 222 DocumentImporter::ObjectObjectNameMap& objectObjectNameMap = mDocumentImporter->getObjectObjectNameMap(); 223 objectObjectNameMap.insert(std::pair<Object*, String>(object, name)); 224 } 225 226 //------------------------------ addVertexColorObjects(const COLLADAFW::UniqueId & vertexColorObjectuniqueId)227 void ImporterBase::addVertexColorObjects(const COLLADAFW::UniqueId& vertexColorObjectuniqueId) 228 { 229 DocumentImporter::UniqueIdList& vertexColorObjects = mDocumentImporter->getVertexColorObjects(); 230 vertexColorObjects.push_back(vertexColorObjectuniqueId); 231 } 232 233 //------------------------------ addMaxControllerToAnimationUniqueId(const COLLADAFW::UniqueId & animationUniqueId,Control * maxController)234 void ImporterBase::addMaxControllerToAnimationUniqueId( const COLLADAFW::UniqueId& animationUniqueId, Control* maxController ) 235 { 236 DocumentImporter::UniqueIdMaxControllerListMap& map = mDocumentImporter->getAnimationUniqueIdMaxControllerListMap(); 237 map[ animationUniqueId ].push_back( maxController ); 238 } 239 240 //------------------------------ addAnimationList(const COLLADAFW::AnimationList & animationList)241 void ImporterBase::addAnimationList( const COLLADAFW::AnimationList& animationList ) 242 { 243 DocumentImporter::UniqueIdAnimationListMap& map = mDocumentImporter->getUniqueIdAnimationListMap(); 244 map[ animationList.getUniqueId() ] = new COLLADAFW::AnimationList( animationList ); 245 } 246 247 //------------------------------ getObjectByUniqueId(const COLLADAFW::UniqueId & uniqueId)248 Object* ImporterBase::getObjectByUniqueId( const COLLADAFW::UniqueId& uniqueId ) 249 { 250 const DocumentImporter::UniqueIdObjectMap& uniqueIdObjectMap = mDocumentImporter->getUniqueIdObjectMap(); 251 DocumentImporter::UniqueIdObjectMap::const_iterator it = uniqueIdObjectMap.find(uniqueId); 252 if ( it == uniqueIdObjectMap.end() ) 253 return 0; 254 else 255 return it->second; 256 } 257 258 //------------------------------ getINodeByUniqueId(const COLLADAFW::UniqueId & uniqueId)259 INode* ImporterBase::getINodeByUniqueId( const COLLADAFW::UniqueId& uniqueId ) 260 { 261 const DocumentImporter::UniqueIdINodeMap& uniqueIdINodeMap = mDocumentImporter->getUniqueIdINodeMap(); 262 DocumentImporter::UniqueIdINodeMap::const_iterator it = uniqueIdINodeMap.find(uniqueId); 263 if ( it == uniqueIdINodeMap.end() ) 264 return 0; 265 else 266 return it->second; 267 } 268 269 //------------------------------ getUniqueIdByObjectINode(INode * iNode)270 const COLLADAFW::UniqueId& ImporterBase::getUniqueIdByObjectINode( INode* iNode ) 271 { 272 const DocumentImporter::ObjectINodeUniqueIdMap& objectINodeUniqueIdMap = mDocumentImporter->getObjectINodeUniqueIdMap(); 273 DocumentImporter::ObjectINodeUniqueIdMap::const_iterator it = objectINodeUniqueIdMap.find(iNode); 274 if ( it == objectINodeUniqueIdMap.end() ) 275 return COLLADAFW::UniqueId::INVALID; 276 else 277 return it->second; 278 } 279 280 281 //------------------------------ getFWNodeByUniqueId(const COLLADAFW::UniqueId & uniqueId)282 const COLLADAFW::Node* ImporterBase::getFWNodeByUniqueId( const COLLADAFW::UniqueId& uniqueId ) 283 { 284 const DocumentImporter::UniqueIdFWNodeMap& uniqueIdFWNodeMap = mDocumentImporter->getUniqueIdFWNodeMap(); 285 DocumentImporter::UniqueIdFWNodeMap::const_iterator it = uniqueIdFWNodeMap.find(uniqueId); 286 if ( it == uniqueIdFWNodeMap.end() ) 287 return 0; 288 else 289 return it->second; 290 } 291 292 //------------------------------ getUniqueIdFWNodeMap()293 const DocumentImporter::UniqueIdFWNodeMap& ImporterBase::getUniqueIdFWNodeMap( ) 294 { 295 return mDocumentImporter->getUniqueIdFWNodeMap(); 296 } 297 298 //------------------------------ getFWMaterialByUniqueId(const COLLADAFW::UniqueId & uniqueId)299 const COLLADAFW::Material* ImporterBase::getFWMaterialByUniqueId( const COLLADAFW::UniqueId& uniqueId ) 300 { 301 const DocumentImporter::UniqueIdFWMaterialMap& uniqueIdFWMaterialMap = mDocumentImporter->getUniqueIdFWMaterialMap(); 302 DocumentImporter::UniqueIdFWMaterialMap::const_iterator it = uniqueIdFWMaterialMap.find(uniqueId); 303 if ( it == uniqueIdFWMaterialMap.end() ) 304 return 0; 305 else 306 return &it->second; 307 } 308 309 //------------------------------ getFWEffectByUniqueId(const COLLADAFW::UniqueId & uniqueId)310 const COLLADAFW::Effect* ImporterBase::getFWEffectByUniqueId( const COLLADAFW::UniqueId& uniqueId ) 311 { 312 const DocumentImporter::UniqueIdFWEffectMap& uniqueIdFWEffectMap = mDocumentImporter->getUniqueIdFWEffectMap(); 313 DocumentImporter::UniqueIdFWEffectMap::const_iterator it = uniqueIdFWEffectMap.find(uniqueId); 314 if ( it == uniqueIdFWEffectMap.end() ) 315 return 0; 316 else 317 return &it->second; 318 } 319 320 //------------------------------ getFWEffectMapsByUniqueId(const COLLADAFW::UniqueId & uniqueId)321 const EffectMaps* ImporterBase::getFWEffectMapsByUniqueId( const COLLADAFW::UniqueId& uniqueId ) 322 { 323 const DocumentImporter::UniqueIdEffectMapsMap& uniqueIdEffectMapsMap = mDocumentImporter->getUniqueIdEffectMapsMap(); 324 DocumentImporter::UniqueIdEffectMapsMap::const_iterator it = uniqueIdEffectMapsMap.find(uniqueId); 325 if ( it == uniqueIdEffectMapsMap.end() ) 326 return 0; 327 else 328 return &it->second; 329 } 330 331 //------------------------------ getFWImageByUniqueId(const COLLADAFW::UniqueId & uniqueId)332 const COLLADAFW::Image* ImporterBase::getFWImageByUniqueId( const COLLADAFW::UniqueId& uniqueId ) 333 { 334 const DocumentImporter::UniqueIdFWImageMap& uniqueIdFWImageMap = mDocumentImporter->getUniqueIdFWImageMap(); 335 DocumentImporter::UniqueIdFWImageMap::const_iterator it = uniqueIdFWImageMap.find(uniqueId); 336 if ( it == uniqueIdFWImageMap.end() ) 337 return 0; 338 else 339 return &it->second; 340 } 341 342 //------------------------------ getNodeMaterialBindings()343 const DocumentImporter::NodeMaterialBindingsList& ImporterBase::getNodeMaterialBindings() 344 { 345 return mDocumentImporter->getNodeMaterialBindingsList(); 346 } 347 348 //------------------------------ getMaterialIdMapByGeometryUniqueId(const COLLADAFW::UniqueId & uniqueId)349 DocumentImporter::FWMaterialIdMaxMtlIdMap& ImporterBase::getMaterialIdMapByGeometryUniqueId( const COLLADAFW::UniqueId& uniqueId ) 350 { 351 return mDocumentImporter->getGeometryMaterialIdMapMap()[uniqueId]; 352 } 353 354 //------------------------------ getSetMapChannelByGeometryUniqueId(const COLLADAFW::UniqueId & uniqueId)355 DocumentImporter::SetMapChannelMap& ImporterBase::getSetMapChannelByGeometryUniqueId( const COLLADAFW::UniqueId& uniqueId ) 356 { 357 return mDocumentImporter->getGeometrySetMapChannelMap()[uniqueId]; 358 } 359 360 //------------------------------ getVisualSceneByUniqueId(const COLLADAFW::UniqueId & visualSceneUniqueId)361 const COLLADAFW::VisualScene* ImporterBase::getVisualSceneByUniqueId( const COLLADAFW::UniqueId& visualSceneUniqueId ) 362 { 363 const DocumentImporter::UniqueIdVisualSceneMap& map = mDocumentImporter->getUniqueIdVisualSceneMap(); 364 DocumentImporter::UniqueIdVisualSceneMap::const_iterator it = map.find( visualSceneUniqueId ); 365 if ( it == map.end() ) 366 { 367 return 0; 368 } 369 else 370 { 371 return it->second; 372 } 373 } 374 375 //------------------------------ getClonedINodeOriginalINodePairList()376 const DocumentImporter::INodeINodePairList& ImporterBase::getClonedINodeOriginalINodePairList() 377 { 378 return mDocumentImporter->getClonedINodeOriginalINodePairList(); 379 } 380 381 //------------------------------ getObjectNameByObject(Object * object) const382 const String& ImporterBase::getObjectNameByObject( Object* object ) const 383 { 384 const DocumentImporter::ObjectObjectNameMap& objectObjectNameMap = mDocumentImporter->getObjectObjectNameMap(); 385 DocumentImporter::ObjectObjectNameMap::const_iterator it = objectObjectNameMap.find(object); 386 if ( it == objectObjectNameMap.end() ) 387 return EMPTY_STRING; 388 else 389 return it->second; 390 } 391 392 //------------------------------ getMaxControllerListByAnimationUniqueId(const COLLADAFW::UniqueId & animationUniqueId) const393 const DocumentImporter::MaxControllerList& ImporterBase::getMaxControllerListByAnimationUniqueId( const COLLADAFW::UniqueId& animationUniqueId ) const 394 { 395 DocumentImporter::UniqueIdMaxControllerListMap& map = mDocumentImporter->getAnimationUniqueIdMaxControllerListMap(); 396 return map[ animationUniqueId ]; 397 } 398 399 //------------------------------ getAnimationListByUniqueId(const COLLADAFW::UniqueId & animationListUniqueId) const400 const COLLADAFW::AnimationList* ImporterBase::getAnimationListByUniqueId( const COLLADAFW::UniqueId& animationListUniqueId ) const 401 { 402 const DocumentImporter::UniqueIdAnimationListMap& map = mDocumentImporter->getUniqueIdAnimationListMap(); 403 DocumentImporter::UniqueIdAnimationListMap::const_iterator it = map.find( animationListUniqueId ); 404 if ( it == map.end() ) 405 { 406 return 0; 407 } 408 else 409 { 410 return it->second; 411 } 412 } 413 414 //------------------------------ addUniqueIdControllerPair(const COLLADAFW::UniqueId & controllerData,const COLLADAFW::Controller * controller)415 void ImporterBase::addUniqueIdControllerPair( const COLLADAFW::UniqueId& controllerData, const COLLADAFW::Controller* controller ) 416 { 417 mDocumentImporter->getUniqueIdControllerMap().insert(std::make_pair(controllerData, controller)); 418 } 419 420 //------------------------------ addMorphController(const COLLADAFW::MorphController * morphController)421 void ImporterBase::addMorphController( const COLLADAFW::MorphController* morphController ) 422 { 423 mDocumentImporter->getUniqueIdMorphControllerMap().insert(std::make_pair(morphController->getUniqueId(), morphController)); 424 } 425 426 //------------------------------ getMorphControllerByUniqueId(const COLLADAFW::UniqueId & morphControllerUniqueId) const427 const COLLADAFW::MorphController* ImporterBase::getMorphControllerByUniqueId( const COLLADAFW::UniqueId& morphControllerUniqueId ) const 428 { 429 const DocumentImporter::UniqueIdMorphControllerMap& map = mDocumentImporter->getUniqueIdMorphControllerMap(); 430 DocumentImporter::UniqueIdMorphControllerMap::const_iterator it = map.find( morphControllerUniqueId ); 431 if ( it == map.end() ) 432 { 433 return 0; 434 } 435 else 436 { 437 return it->second; 438 } 439 } 440 441 //------------------------------ addSkinController(const COLLADAFW::SkinController * skinController)442 void ImporterBase::addSkinController( const COLLADAFW::SkinController* skinController ) 443 { 444 mDocumentImporter->getUniqueIdSkinControllerMap().insert(std::make_pair(skinController->getUniqueId(), skinController)); 445 } 446 447 //------------------------------ getSkinControllerByUniqueId(const COLLADAFW::UniqueId & skinControllerUniqueId) const448 const COLLADAFW::SkinController* ImporterBase::getSkinControllerByUniqueId( const COLLADAFW::UniqueId& skinControllerUniqueId ) const 449 { 450 const DocumentImporter::UniqueIdSkinControllerMap& map = mDocumentImporter->getUniqueIdSkinControllerMap(); 451 DocumentImporter::UniqueIdSkinControllerMap::const_iterator it = map.find( skinControllerUniqueId ); 452 if ( it == map.end() ) 453 { 454 return 0; 455 } 456 else 457 { 458 return it->second; 459 } 460 } 461 462 463 //------------------------------ getAnimationList(const COLLADAFW::Animatable * animatable)464 const COLLADAFW::AnimationList* ImporterBase::getAnimationList( const COLLADAFW::Animatable* animatable ) 465 { 466 if ( !animatable ) 467 { 468 return 0; 469 } 470 471 const COLLADAFW::UniqueId& referencedAnimationListUniqueId = animatable->getAnimationList(); 472 473 if ( !referencedAnimationListUniqueId.isValid() ) 474 { 475 return 0; 476 } 477 478 return getAnimationListByUniqueId( referencedAnimationListUniqueId ); 479 } 480 481 //------------------------------ getVertexColorObjects()482 const DocumentImporter::UniqueIdList& ImporterBase::getVertexColorObjects() 483 { 484 return mDocumentImporter->getVertexColorObjects(); 485 } 486 487 //--------------------------------------------------------------- Matrix4ToMaxMatrix3(Matrix3 & copy,const COLLADABU::Math::Matrix4 & original)488 void ImporterBase::Matrix4ToMaxMatrix3 ( Matrix3 & copy, const COLLADABU::Math::Matrix4& original ) 489 { 490 Point4 column; 491 column[ 0 ] = (float)original.getElement(0,0); 492 column[ 1 ] = (float)original.getElement(0,1); 493 column[ 2 ] = (float)original.getElement(0,2); 494 column[ 3 ] = convertSpaceUnit((float)original.getElement(0,3)); 495 copy.SetColumn(0, column); 496 497 column[ 0 ] = (float)original.getElement(1,0); 498 column[ 1 ] = (float)original.getElement(1,1); 499 column[ 2 ] = (float)original.getElement(1,2); 500 column[ 3 ] = convertSpaceUnit((float)original.getElement(1,3)); 501 copy.SetColumn(1, column); 502 503 column[ 0 ] = (float)original.getElement(2,0); 504 column[ 1 ] = (float)original.getElement(2,1); 505 column[ 2 ] = (float)original.getElement(2,2); 506 column[ 3 ] = convertSpaceUnit((float)original.getElement(2,3)); 507 copy.SetColumn(2, column); 508 } 509 510 //------------------------------ convertSpaceUnit(float originalValue)511 float ImporterBase::convertSpaceUnit( float originalValue ) 512 { 513 return mDocumentImporter->convertSpaceUnit(originalValue); 514 } 515 516 //------------------------------ getSkyLightParametersByUniqueId(const COLLADAFW::UniqueId & uniqueId)517 const SkyLightParameters* ImporterBase::getSkyLightParametersByUniqueId( const COLLADAFW::UniqueId& uniqueId ) 518 { 519 const DocumentImporter::UniqueIdSkyLightMap& map = mDocumentImporter->getUniqueIdSkyLightMap(); 520 DocumentImporter::UniqueIdSkyLightMap::const_iterator it = map.find( uniqueId ); 521 if ( it == map.end() ) 522 { 523 return 0; 524 } 525 else 526 { 527 return &it->second; 528 } 529 } 530 531 //------------------------------ addUniqueIdSkyLightParametersPair(const COLLADAFW::UniqueId & lightUniqueId,const SkyLightParameters & skyLightParameters)532 void ImporterBase::addUniqueIdSkyLightParametersPair( const COLLADAFW::UniqueId& lightUniqueId, const SkyLightParameters& skyLightParameters ) 533 { 534 mDocumentImporter->getUniqueIdSkyLightMap()[lightUniqueId] = skyLightParameters; 535 } 536 537 //------------------------------ addUniqueIdEffectBumpMapParametersPair(const COLLADAFW::UniqueId & effectUniqueId,const BumpMap & bumpParameters)538 void ImporterBase::addUniqueIdEffectBumpMapParametersPair( const COLLADAFW::UniqueId& effectUniqueId, const BumpMap& bumpParameters ) 539 { 540 mDocumentImporter->addUniqueIdEffectBumpMapParametersPair(effectUniqueId, bumpParameters); 541 } 542 543 } // namespace COLLADAMax 544