Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement the info file module to persist the editing timer value.
- Loading branch information
1 parent
215f198
commit 325accd
Showing
7 changed files
with
139 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
#include "EditingStopwatchInfoFileModule.h" | ||
|
||
#include "itextstream.h" | ||
#include "EditingStopwatch.h" | ||
#include "parser/DefTokeniser.h" | ||
|
||
namespace map | ||
{ | ||
|
||
namespace | ||
{ | ||
const char* const MAP_EDIT_TIMINGS = "MapEditTimings"; | ||
const char* const TOTAL_SECONDS_EDITED = "TotalSecondsEdited"; | ||
} | ||
|
||
std::string EditingStopwatchInfoFileModule::getName() | ||
{ | ||
return "Map Edit Stopwatch"; | ||
} | ||
|
||
void EditingStopwatchInfoFileModule::onInfoFileSaveStart() | ||
{} | ||
|
||
void EditingStopwatchInfoFileModule::onSavePrimitive(const scene::INodePtr& node, std::size_t entityNum, std::size_t primitiveNum) | ||
{} | ||
|
||
void EditingStopwatchInfoFileModule::onSaveEntity(const scene::INodePtr& node, std::size_t entityNum) | ||
{} | ||
|
||
void EditingStopwatchInfoFileModule::writeBlocks(std::ostream& stream) | ||
{ | ||
// Block output | ||
stream << "\t" << MAP_EDIT_TIMINGS << std::endl; | ||
|
||
stream << "\t{" << std::endl; | ||
|
||
unsigned long secondsEdited = EditingStopwatch::GetInstanceInternal().getTotalSecondsEdited(); | ||
|
||
// TotalSecondsEdited { 4 } | ||
stream << "\t\t" << TOTAL_SECONDS_EDITED << " { " << secondsEdited << " }" << std::endl; | ||
|
||
stream << "\t}" << std::endl; | ||
|
||
rMessage() << "Map Edit Timings written." << std::endl; | ||
} | ||
|
||
void EditingStopwatchInfoFileModule::onInfoFileSaveFinished() | ||
{} | ||
|
||
void EditingStopwatchInfoFileModule::onInfoFileLoadStart() | ||
{} | ||
|
||
bool EditingStopwatchInfoFileModule::canParseBlock(const std::string& blockName) | ||
{ | ||
return blockName == MAP_EDIT_TIMINGS; | ||
} | ||
|
||
void EditingStopwatchInfoFileModule::parseBlock(const std::string& blockName, parser::DefTokeniser& tok) | ||
{ | ||
// The opening brace | ||
tok.assertNextToken("{"); | ||
|
||
int blockLevel = 1; | ||
|
||
while (tok.hasMoreTokens() && blockLevel > 0) | ||
{ | ||
std::string token = tok.nextToken(); | ||
|
||
if (token == TOTAL_SECONDS_EDITED) | ||
{ | ||
// TotalSecondsEdited { 4 } | ||
tok.assertNextToken("{"); | ||
|
||
// Parse the name, replacing the " placeholder with a proper quote | ||
unsigned long secondsEdited = string::convert<unsigned long>(tok.nextToken()); | ||
|
||
tok.assertNextToken("}"); | ||
|
||
rMessage() << "[InfoFile]: Parsed map editing time." << std::endl; | ||
|
||
// Apply the parsed value | ||
EditingStopwatch::GetInstanceInternal().setTotalSecondsEdited(secondsEdited); | ||
} | ||
else if (token == "{") | ||
{ | ||
blockLevel++; | ||
} | ||
else if (token == "}") | ||
{ | ||
blockLevel--; | ||
} | ||
} | ||
} | ||
|
||
void EditingStopwatchInfoFileModule::applyInfoToScene(const scene::IMapRootNodePtr & root, const NodeIndexMap & nodeMap) | ||
{} | ||
|
||
void EditingStopwatchInfoFileModule::onInfoFileLoadFinished() | ||
{} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters