Added some debugging tools to the preview assets.

This commit is contained in:
phr0z3nt04st
2010-07-08 13:24:10 -05:00
parent 82aef8fa4c
commit c0ad0f82a9
16 changed files with 1091 additions and 45 deletions

View File

@@ -1684,7 +1684,39 @@ void LLPreviewLSL::reshape(S32 width, S32 height, BOOL called_from_parent)
gSavedSettings.setRect("PreviewScriptRect", getRect());
}
}
// <edit>
// virtual
BOOL LLPreviewLSL::canSaveAs() const
{
return TRUE;
}
// virtual
void LLPreviewLSL::saveAs()
{
std::string default_filename("untitled.lsl");
const LLInventoryItem *item = getItem();
if(item)
{
default_filename = LLDir::getScrubbedFileName(item->getName());
}
LLFilePicker& file_picker = LLFilePicker::instance();
if( !file_picker.getSaveFile( LLFilePicker::FFSAVE_LSL, default_filename ) )
{
// User canceled or we failed to acquire save file.
return;
}
// remember the user-approved/edited file name.
std::string filename = file_picker.getFirstFile();
std::string utf8text = mScriptEd->mEditor->getText();
LLFILE* fp = LLFile::fopen(filename, "wb");
fputs(utf8text.c_str(), fp);
fclose(fp);
fp = NULL;
}
// </edit>
/// ---------------------------------------------------------------------------
/// LLLiveLSLEditor
/// ---------------------------------------------------------------------------