From Mike Weiblen, added support for new OSG_IMAGE_FILE_NAME env var for

setting the default name to use when writing out captured images from the
viewer.
This commit is contained in:
Robert Osfield
2006-03-28 10:28:49 +00:00
parent 83ee2f797d
commit 42e4a5841c
2 changed files with 16 additions and 5 deletions

View File

@@ -188,9 +188,12 @@ class OSGPRODUCER_EXPORT Viewer : public OsgCameraGroup, public osgGA::GUIAction
/** Set the filename to write to when the viewer takes an image snapshot on the last frame() when done is enabled.*/
void setWriteImageFileName(const std::string& filename);
/** Set the filename to write to when the viewer takes an image snapshot on the last frame() when done is enabled.*/
/** Get the filename to write to when the viewer takes an image snapshot on the last frame() when done is enabled.*/
const std::string& getWriteImageFileName() const;
/** Get the default filename for writing an image snapshot */
static const char* getDefaultImageFileName();
/** Override the Producer::CameraGroup::setViewByMatrix to catch all changes to view.*/
virtual void setViewByMatrix( const Producer::Matrix & pm);

View File

@@ -140,7 +140,7 @@ Viewer::Viewer():
_setDoneAtFrameNumber(0),
_done(false),
_writeImageWhenDone(false),
_writeImageFileName("saved_image.jpg"),
_writeImageFileName(getDefaultImageFileName()),
_recordingAnimationPath(false),
_recordingStartTime(0.0)
{
@@ -159,7 +159,7 @@ Viewer::Viewer(Producer::CameraConfig *cfg):
_setDoneAtFrameNumber(0),
_done(false),
_writeImageWhenDone(false),
_writeImageFileName("saved_image.jpg"),
_writeImageFileName(getDefaultImageFileName()),
_recordingAnimationPath(false),
_recordingStartTime(0.0)
{
@@ -179,7 +179,7 @@ Viewer::Viewer(const std::string& configFile):
_setDoneAtFrameNumber(0),
_done(false),
_writeImageWhenDone(false),
_writeImageFileName("saved_image.jpg"),
_writeImageFileName(getDefaultImageFileName()),
_recordingAnimationPath(false),
_recordingStartTime(0.0)
{
@@ -198,7 +198,7 @@ Viewer::Viewer(osg::ArgumentParser& arguments):
_setDoneAtFrameNumber(0),
_done(false),
_writeImageWhenDone(false),
_writeImageFileName("saved_image.jpg"),
_writeImageFileName(getDefaultImageFileName()),
_recordingAnimationPath(false),
_recordingStartTime(0.0)
{
@@ -297,6 +297,14 @@ const std::string& Viewer::getWriteImageFileName() const
return _writeImageFileName;
}
static osg::ApplicationUsageProxy Viewer_e0(osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE, "OSG_IMAGE_FILE_NAME <filename>", "name of snapshot image file" );
const char* Viewer::getDefaultImageFileName()
{
const char* name = getenv( "OSG_IMAGE_FILE_NAME" );
return name ? name : "saved_image.jpg";
}
void Viewer::setCoordinateSystemNodePath(const osg::NodePath& nodePath)
{