first version of the track-saver
This commit is contained in:
parent
896abe5c0a
commit
63d7e1f67c
@ -734,7 +734,7 @@ void TrackView::editToggleInterpolationType()
|
|||||||
SyncEditData::Command *cmd = syncData->getSetKeyFrameCommand(editTrack, int(lower->first), newKey);
|
SyncEditData::Command *cmd = syncData->getSetKeyFrameCommand(editTrack, int(lower->first), newKey);
|
||||||
syncData->exec(cmd);
|
syncData->exec(cmd);
|
||||||
|
|
||||||
invalidateRange(editTrack, editTrack, lower->first, upper->first);
|
invalidateRange(editTrack, editTrack, int(lower->first), int(upper->first));
|
||||||
}
|
}
|
||||||
else MessageBeep(0);
|
else MessageBeep(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -170,13 +170,38 @@ std::string ClientDevice::getTrackFileName(std::string trackName)
|
|||||||
return fileName;
|
return fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool saveTrack(const sync::Track &track, std::string fileName)
|
||||||
|
{
|
||||||
|
FILE *fp = fopen(fileName.c_str(), "wb");
|
||||||
|
if (NULL == fp) return false;
|
||||||
|
|
||||||
|
size_t keyFrameCount = track.getKeyFrameCount();
|
||||||
|
fwrite(&keyFrameCount, sizeof(size_t), 1, fp);
|
||||||
|
|
||||||
|
sync::Track::KeyFrameContainer::const_iterator it;
|
||||||
|
for (it = track.keyFrames.begin(); it != track.keyFrames.end(); ++it)
|
||||||
|
{
|
||||||
|
size_t row = it->first;
|
||||||
|
float value = it->second.value;
|
||||||
|
char interpolationType = char(it->second.interpolationType);
|
||||||
|
|
||||||
|
// write key
|
||||||
|
fwrite(&row, sizeof(size_t), 1, fp);
|
||||||
|
fwrite(&value, sizeof(float), 1, fp);
|
||||||
|
fwrite(&interpolationType, sizeof(char), 1, fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(fp);
|
||||||
|
fp = NULL;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void ClientDevice::saveTracks()
|
void ClientDevice::saveTracks()
|
||||||
{
|
{
|
||||||
sync::Data::TrackContainer::iterator iter;
|
sync::Data::TrackContainer::iterator iter;
|
||||||
for (iter = syncData.tracks.begin(); iter != syncData.tracks.end(); ++iter)
|
for (iter = syncData.tracks.begin(); iter != syncData.tracks.end(); ++iter)
|
||||||
{
|
{
|
||||||
std::string fileName = getTrackFileName(iter->first);
|
saveTrack(syncData.getTrack(iter->second), getTrackFileName(iter->first));
|
||||||
printf("\"%s\"\n", fileName.c_str());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -103,7 +103,7 @@ void Track::setKeyFrame(size_t row, const KeyFrame &keyFrame)
|
|||||||
keyFrames[row] = keyFrame;
|
keyFrames[row] = keyFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t Track::getFrameCount() const
|
size_t Track::getKeyFrameCount() const
|
||||||
{
|
{
|
||||||
if (keyFrames.empty()) return 0;
|
if (keyFrames.empty()) return 0;
|
||||||
KeyFrameContainer::const_iterator iter = keyFrames.end();
|
KeyFrameContainer::const_iterator iter = keyFrames.end();
|
||||||
|
|||||||
@ -38,7 +38,7 @@ namespace sync
|
|||||||
|
|
||||||
bool isKeyFrame(size_t row) const;
|
bool isKeyFrame(size_t row) const;
|
||||||
const KeyFrame *getKeyFrame(size_t row) const;
|
const KeyFrame *getKeyFrame(size_t row) const;
|
||||||
size_t getFrameCount() const;
|
size_t getKeyFrameCount() const;
|
||||||
|
|
||||||
void deleteKeyFrame(size_t row);
|
void deleteKeyFrame(size_t row);
|
||||||
void setKeyFrame(size_t row, const KeyFrame &keyFrame);
|
void setKeyFrame(size_t row, const KeyFrame &keyFrame);
|
||||||
|
|||||||
@ -40,7 +40,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE"
|
||||||
MinimalRebuild="true"
|
MinimalRebuild="true"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
RuntimeLibrary="3"
|
RuntimeLibrary="3"
|
||||||
@ -102,7 +102,7 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE"
|
||||||
RuntimeLibrary="2"
|
RuntimeLibrary="2"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
@ -162,7 +162,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE"
|
||||||
MinimalRebuild="true"
|
MinimalRebuild="true"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
RuntimeLibrary="3"
|
RuntimeLibrary="3"
|
||||||
@ -225,7 +225,7 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE"
|
||||||
RuntimeLibrary="2"
|
RuntimeLibrary="2"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
@ -345,6 +345,10 @@
|
|||||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||||
>
|
>
|
||||||
<File
|
<File
|
||||||
|
RelativePath=".\sync\data.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
RelativePath=".\sync\device.h"
|
RelativePath=".\sync\device.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user