| 476 | } |
| 477 | |
| 478 | UIWidget* UISceneNode::loadLayoutFromFile( const std::string& layoutPath, Node* parent, |
| 479 | const Uint32& marker ) { |
| 480 | if ( FileSystem::fileExists( layoutPath ) ) { |
| 481 | pugi::xml_document doc; |
| 482 | pugi::xml_parse_result result = |
| 483 | doc.load_file( layoutPath.c_str(), pugi::parse_default | pugi::parse_ws_pcdata ); |
| 484 | |
| 485 | if ( result ) { |
| 486 | return loadLayoutNodes( doc.first_child(), NULL != parent ? parent : this, marker ); |
| 487 | } else { |
| 488 | Log::error( "Couldn't load UI Layout: %s", layoutPath.c_str() ); |
| 489 | Log::error( "Error description: %s", result.description() ); |
| 490 | Log::error( "Error offset: %d", result.offset ); |
| 491 | std::string data; |
| 492 | FileSystem::fileGet( layoutPath, data ); |
| 493 | Log::error( "Error context: %s", getErrorContext( result.offset, data ) ); |
| 494 | } |
| 495 | } else if ( PackManager::instance()->isFallbackToPacksActive() ) { |
| 496 | std::string path( layoutPath ); |
| 497 | Pack* pack = PackManager::instance()->exists( path ); |
| 498 | |
| 499 | if ( NULL != pack ) { |
| 500 | return loadLayoutFromPack( pack, path, parent ); |
| 501 | } |
| 502 | } |
| 503 | |
| 504 | return NULL; |
| 505 | } |
| 506 | |
| 507 | UIWidget* UISceneNode::loadLayoutFromString( const char* layoutString, Node* parent, |
| 508 | const Uint32& marker ) { |