mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -04:00
add make_screenshot_filename()
This commit is contained in:
parent
942e64ae60
commit
bda902a6d6
@ -424,14 +424,15 @@ output(ostream &out) const {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplayRegion::save_screenshot_default
|
||||
// Access: Published
|
||||
// Description: Saves a screenshot of the region to a default
|
||||
// filename, and returns the filename, or empty string
|
||||
// if the screenshot failed. The default filename is
|
||||
// generated from the supplied prefix and from the
|
||||
// Config variable screenshot-filename, which contains
|
||||
// the following strings:
|
||||
// Function: DisplayRegion::make_screenshot_filename
|
||||
// Access: Published, Static
|
||||
// Description: Synthesizes a suitable default filename for passing
|
||||
// to save_screenshot().
|
||||
//
|
||||
// The default filename is generated from the supplied
|
||||
// prefix and from the Config variable
|
||||
// screenshot-filename, which contains the following
|
||||
// strings:
|
||||
//
|
||||
// %~p - the supplied prefix
|
||||
// %~f - the frame count
|
||||
@ -439,7 +440,7 @@ output(ostream &out) const {
|
||||
// All other % strings in strftime().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
Filename DisplayRegion::
|
||||
save_screenshot_default(const string &prefix) {
|
||||
make_screenshot_filename(const string &prefix) {
|
||||
time_t now = time(NULL);
|
||||
struct tm *ttm = localtime(&now);
|
||||
int frame_count = ClockObject::get_global_clock()->get_frame_count();
|
||||
@ -496,7 +497,21 @@ save_screenshot_default(const string &prefix) {
|
||||
}
|
||||
}
|
||||
|
||||
Filename filename = filename_strm.str();
|
||||
return Filename(filename_strm.str());
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplayRegion::save_screenshot_default
|
||||
// Access: Published
|
||||
// Description: Saves a screenshot of the region to a default
|
||||
// filename, and returns the filename, or empty string
|
||||
// if the screenshot failed. The filename is generated
|
||||
// by make_screenshot_filename().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
Filename DisplayRegion::
|
||||
save_screenshot_default(const string &prefix) {
|
||||
Filename filename = make_screenshot_filename(prefix);
|
||||
if (save_screenshot(filename)) {
|
||||
return filename;
|
||||
}
|
||||
|
@ -97,6 +97,7 @@ PUBLISHED:
|
||||
|
||||
void output(ostream &out) const;
|
||||
|
||||
static Filename make_screenshot_filename(const string &prefix = "screenshot");
|
||||
Filename save_screenshot_default(const string &prefix = "screenshot");
|
||||
bool save_screenshot(const Filename &filename);
|
||||
bool get_screenshot(PNMImage &image);
|
||||
|
@ -265,8 +265,8 @@ make_display_region(float l, float r, float b, float t) {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GraphicsOutput::save_screenshot_default
|
||||
// Access: Published
|
||||
// Function: GraphicsOutput::make_screenshot_filename
|
||||
// Access: Published, Static
|
||||
// Description: Saves a screenshot of the region to a default
|
||||
// filename, and returns the filename, or empty string
|
||||
// if the screenshot failed. The default filename is
|
||||
@ -280,6 +280,19 @@ make_display_region(float l, float r, float b, float t) {
|
||||
// All other % strings in strftime().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE Filename GraphicsOutput::
|
||||
make_screenshot_filename(const string &prefix) {
|
||||
return DisplayRegion::make_screenshot_filename(prefix);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GraphicsOutput::save_screenshot_default
|
||||
// Access: Published
|
||||
// Description: Saves a screenshot of the region to a default
|
||||
// filename, and returns the filename, or empty string
|
||||
// if the screenshot failed. The filename is generated
|
||||
// by make_screenshot_filename().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE Filename GraphicsOutput::
|
||||
save_screenshot_default(const string &prefix) {
|
||||
return _default_display_region->save_screenshot_default(prefix);
|
||||
}
|
||||
|
@ -115,6 +115,7 @@ PUBLISHED:
|
||||
GraphicsOutput *make_cube_map(const string &name, int size, bool to_ram,
|
||||
NodePath &camera_rig, DrawMask camera_mask);
|
||||
|
||||
INLINE static Filename make_screenshot_filename(const string &prefix = "screenshot");
|
||||
INLINE Filename save_screenshot_default(const string &prefix = "screenshot");
|
||||
INLINE bool save_screenshot(const Filename &filename);
|
||||
INLINE bool get_screenshot(PNMImage &image);
|
||||
|
Loading…
x
Reference in New Issue
Block a user