diff --git a/LDLib/LDSnapshotTaker.cpp b/LDLib/LDSnapshotTaker.cpp
index 3a8301c..a30da1e 100644
|
a
|
b
|
bool LDSnapshotTaker::saveImage(void) |
| 276 | 276 | stripTrailingPathSeparators(saveDir); |
| 277 | 277 | } |
| 278 | 278 | } |
| | 279 | // Special case for the -ca and -cg options to convert them to proper |
| | 280 | // argument names |
| 279 | 281 | for (i = 0; i < count; i++) |
| 280 | 282 | { |
| 281 | 283 | char *arg = unhandledArgs->stringAtIndex(i); |
| … |
… |
bool LDSnapshotTaker::saveImage(void) |
| 295 | 297 | { |
| 296 | 298 | sprintf(newArg, "-%s=%s", CAMERA_GLOBE_KEY, arg + 3); |
| 297 | 299 | TCUserDefaults::addCommandLineArg(newArg); |
| 298 | | zoomToFit = true; |
| 299 | 300 | } |
| 300 | 301 | } |
| 301 | 302 | for (i = 0; i < count && (saveSnapshots || !retValue); i++) |
| … |
… |
bool LDSnapshotTaker::saveImage(void) |
| 405 | 406 | return retValue; |
| 406 | 407 | } |
| 407 | 408 | |
| 408 | | bool LDSnapshotTaker::shouldZoomToFit(bool zoomToFit) |
| | 409 | bool LDSnapshotTaker::shouldZoomToFit() |
| 409 | 410 | { |
| 410 | | char *cameraGlobe = TCUserDefaults::stringForKey(CAMERA_GLOBE_KEY, NULL, |
| 411 | | false); |
| 412 | | bool retValue = false; |
| 413 | | |
| 414 | | if (zoomToFit) |
| 415 | | { |
| 416 | | retValue = true; |
| 417 | | } |
| 418 | | else if (cameraGlobe) |
| 419 | | { |
| 420 | | float globeRadius; |
| 421 | | |
| 422 | | if (sscanf(cameraGlobe, "%*f,%*f,%f", &globeRadius) == 1) |
| 423 | | { |
| 424 | | retValue = true; |
| 425 | | } |
| 426 | | } |
| 427 | | delete cameraGlobe; |
| 428 | | return retValue; |
| | 411 | int zoomToFit = TCUserDefaults::longForKey(SAVE_ZOOM_TO_FIT_KEY, -1, false); |
| | 412 | if (zoomToFit < 0 ) { |
| | 413 | // default to not ZoomToFit unless we have a reason to do otherwise |
| | 414 | zoomToFit = 0; |
| | 415 | // User didn't explicitly specify, default to something sensible based |
| | 416 | // on the other arguments the user did pass. |
| | 417 | // -cg should default to ZoomToFit to be compatible with L3P |
| | 418 | char *cameraGlobe = TCUserDefaults::stringForKey(CAMERA_GLOBE_KEY, NULL, |
| | 419 | false); |
| | 420 | if (cameraGlobe) { |
| | 421 | zoomToFit = 1; |
| | 422 | delete cameraGlobe; |
| | 423 | } |
| | 424 | // But if the center of the model has been specified, ZoomToFit would conflict with it |
| | 425 | char *modelCenter = TCUserDefaults::stringForKey(MODEL_CENTER_KEY, NULL, false); |
| | 426 | if (modelCenter) { |
| | 427 | zoomToFit = 0; |
| | 428 | delete modelCenter; |
| | 429 | } |
| | 430 | } |
| | 431 | return (bool) zoomToFit; |
| 429 | 432 | } |
| 430 | 433 | |
| 431 | 434 | bool LDSnapshotTaker::saveImage( |
| … |
… |
bool LDSnapshotTaker::saveStepImage( |
| 633 | 636 | { |
| 634 | 637 | bool saveAlpha = false; |
| 635 | 638 | TCByte *buffer = grabImage(imageWidth, imageHeight, |
| 636 | | shouldZoomToFit(zoomToFit), NULL, &saveAlpha); |
| | 639 | shouldZoomToFit(), NULL, &saveAlpha); |
| 637 | 640 | |
| 638 | 641 | if (buffer) |
| 639 | 642 | { |
diff --git a/LDLib/LDSnapshotTaker.h b/LDLib/LDSnapshotTaker.h
index 2fda699..9ec26df 100644
|
a
|
b
|
protected: |
| 75 | 75 | bool canSaveAlpha(void); |
| 76 | 76 | void renderOffscreenImage(void); |
| 77 | 77 | bool imageProgressCallback(CUCSTR message, float progress); |
| 78 | | bool shouldZoomToFit(bool zoomToFit); |
| | 78 | bool shouldZoomToFit(); |
| 79 | 79 | void grabSetup(void); |
| 80 | 80 | bool saveStepImage(const char *filename, int imageWidth, int imageHeight, |
| 81 | 81 | bool zoomToFit); |