Solving issue 1946: "Custom Profile Builder needs more parameters"
The new parameter list is: 1. Image file 2. Default processing profile 3. Cache path (for logging files) 4. ForFlagging (bool; true if the procparams are created for an image being simply flagged - inTrash, colors, rank) 5. F Number 6. Exposure 7. Focal length (remains the same) 8. ISO 9. Lens 10. Camera make (new) 11. Camera model (new) ... those 2 new parameters was "camera" before.
This commit is contained in:
@@ -78,7 +78,8 @@ int CacheImageData::load (const Glib::ustring& fname) {
|
||||
if (keyFile.has_key ("ExifInfo", "ExpComp")) expcomp = keyFile.get_string ("ExifInfo", "ExpComp");
|
||||
}
|
||||
if (keyFile.has_key ("ExifInfo", "Lens")) lens = keyFile.get_string ("ExifInfo", "Lens");
|
||||
if (keyFile.has_key ("ExifInfo", "Camera")) camera = keyFile.get_string ("ExifInfo", "Camera");
|
||||
if (keyFile.has_key ("ExifInfo", "CamMake")) camMake = keyFile.get_string ("ExifInfo", "CamMake");
|
||||
if (keyFile.has_key ("ExifInfo", "CamModel")) camModel = keyFile.get_string ("ExifInfo", "CamModel");
|
||||
}
|
||||
|
||||
if (keyFile.has_group ("FileInfo")) {
|
||||
@@ -159,7 +160,8 @@ int CacheImageData::save (const Glib::ustring& fname) {
|
||||
keyFile.set_string ("ExifInfo", "ExpComp", expcomp);
|
||||
}
|
||||
keyFile.set_string ("ExifInfo", "Lens", lens);
|
||||
keyFile.set_string ("ExifInfo", "Camera", camera);
|
||||
keyFile.set_string ("ExifInfo", "CameraMake", camMake);
|
||||
keyFile.set_string ("ExifInfo", "CameraModel", camModel);
|
||||
keyFile.set_string ("FileInfo", "Filetype", filetype);
|
||||
|
||||
if (format==FT_Raw) {
|
||||
|
@@ -52,7 +52,8 @@ class CacheImageData {
|
||||
float focusDist;
|
||||
unsigned iso;
|
||||
Glib::ustring lens;
|
||||
Glib::ustring camera;
|
||||
Glib::ustring camMake;
|
||||
Glib::ustring camModel;
|
||||
Glib::ustring filetype;
|
||||
Glib::ustring expcomp;
|
||||
|
||||
@@ -76,5 +77,7 @@ class CacheImageData {
|
||||
|
||||
int load (const Glib::ustring& fname);
|
||||
int save (const Glib::ustring& fname);
|
||||
|
||||
Glib::ustring getCamera() const { return Glib::ustring(camMake+" "+camModel); }
|
||||
};
|
||||
#endif
|
||||
|
@@ -1218,8 +1218,10 @@ bool FileBrowser::checkFilter (ThumbBrowserEntryBase* entryb) { // true -> entry
|
||||
if (!filter.exifFilterEnabled)
|
||||
return true;
|
||||
|
||||
Glib::ustring camera(cfs->getCamera());
|
||||
|
||||
if (!cfs->exifValid)
|
||||
return (!filter.exifFilter.filterCamera || filter.exifFilter.cameras.count(cfs->camera)>0)
|
||||
return (!filter.exifFilter.filterCamera || filter.exifFilter.cameras.count(camera)>0)
|
||||
&& (!filter.exifFilter.filterLens || filter.exifFilter.lenses.count(cfs->lens)>0)
|
||||
&& (!filter.exifFilter.filterFiletype || filter.exifFilter.filetypes.count(cfs->filetype)>0)
|
||||
&& (!filter.exifFilter.filterExpComp || filter.exifFilter.expcomp.count(cfs->expcomp)>0);
|
||||
@@ -1230,7 +1232,7 @@ bool FileBrowser::checkFilter (ThumbBrowserEntryBase* entryb) { // true -> entry
|
||||
&& (!filter.exifFilter.filterFocalLen || (cfs->focalLen >= filter.exifFilter.focalFrom-tol && cfs->focalLen <= filter.exifFilter.focalTo+tol))
|
||||
&& (!filter.exifFilter.filterISO || (cfs->iso >= filter.exifFilter.isoFrom && cfs->iso <= filter.exifFilter.isoTo))
|
||||
&& (!filter.exifFilter.filterExpComp || filter.exifFilter.expcomp.count(cfs->expcomp)>0)
|
||||
&& (!filter.exifFilter.filterCamera || filter.exifFilter.cameras.count(cfs->camera)>0)
|
||||
&& (!filter.exifFilter.filterCamera || filter.exifFilter.cameras.count(camera)>0)
|
||||
&& (!filter.exifFilter.filterLens || filter.exifFilter.lenses.count(cfs->lens)>0)
|
||||
&& (!filter.exifFilter.filterFiletype || filter.exifFilter.filetypes.count(cfs->filetype)>0);
|
||||
}
|
||||
@@ -1239,7 +1241,7 @@ void FileBrowser::toTrashRequested (std::vector<FileBrowserEntry*> tbe) {
|
||||
|
||||
for (size_t i=0; i<tbe.size(); i++) {
|
||||
// try to load the last saved parameters from the cache or from the paramfile file
|
||||
tbe[i]->thumbnail->createProcParamsForUpdate(false, false); // this can execute customprofilebuilder to generate param file
|
||||
tbe[i]->thumbnail->createProcParamsForUpdate(false, false, true); // this can execute customprofilebuilder to generate param file in "flagging" mode
|
||||
|
||||
// no need to notify listeners as item goes to trash, likely to be deleted
|
||||
|
||||
@@ -1284,7 +1286,7 @@ void FileBrowser::rankingRequested (std::vector<FileBrowserEntry*> tbe, int rank
|
||||
for (size_t i=0; i<tbe.size(); i++) {
|
||||
|
||||
// try to load the last saved parameters from the cache or from the paramfile file
|
||||
tbe[i]->thumbnail->createProcParamsForUpdate(false, false); // this can execute customprofilebuilder to generate param file
|
||||
tbe[i]->thumbnail->createProcParamsForUpdate(false, false, true); // this can execute customprofilebuilder to generate param file in "flagging" mode
|
||||
|
||||
// notify listeners TODO: should do this ONLY when params changed by customprofilebuilder?
|
||||
tbe[i]->thumbnail->notifylisterners_procParamsChanged(FILEBROWSER);
|
||||
@@ -1309,7 +1311,7 @@ void FileBrowser::colorlabelRequested (std::vector<FileBrowserEntry*> tbe, int c
|
||||
|
||||
for (size_t i=0; i<tbe.size(); i++) {
|
||||
// try to load the last saved parameters from the cache or from the paramfile file
|
||||
tbe[i]->thumbnail->createProcParamsForUpdate(false, false); // this can execute customprofilebuilder to generate param file
|
||||
tbe[i]->thumbnail->createProcParamsForUpdate(false, false, true); // this can execute customprofilebuilder to generate param file in "flagging" mode
|
||||
|
||||
// notify listeners TODO: should do this ONLY when params changed by customprofilebuilder?
|
||||
tbe[i]->thumbnail->notifylisterners_procParamsChanged(FILEBROWSER);
|
||||
|
@@ -608,7 +608,7 @@ void FileCatalog::previewReady (int dir_id, FileBrowserEntry* fdn) {
|
||||
dirEFS.focalTo = cfs->focalLen;
|
||||
}
|
||||
dirEFS.filetypes.insert (cfs->filetype);
|
||||
dirEFS.cameras.insert (cfs->camera);
|
||||
dirEFS.cameras.insert (cfs->getCamera());
|
||||
dirEFS.lenses.insert (cfs->lens);
|
||||
dirEFS.expcomp.insert (cfs->expcomp);
|
||||
}
|
||||
|
@@ -195,7 +195,7 @@ const ProcParams& Thumbnail::getProcParamsU () {
|
||||
* Create default params on demand and returns a new updatable object
|
||||
* The loaded profile may be partial, but it return a complete ProcParams (i.e. without ParamsEdited)
|
||||
*/
|
||||
rtengine::procparams::ProcParams* Thumbnail::createProcParamsForUpdate(bool returnParams, bool forceCPB) {
|
||||
rtengine::procparams::ProcParams* Thumbnail::createProcParamsForUpdate(bool returnParams, bool forceCPB, bool flaggingMode) {
|
||||
// try to load the last saved parameters from the cache or from the paramfile file
|
||||
ProcParams* ldprof = NULL;
|
||||
|
||||
@@ -210,10 +210,15 @@ rtengine::procparams::ProcParams* Thumbnail::createProcParamsForUpdate(bool retu
|
||||
|
||||
// ustring doesn't know int etc formatting, so take these via (unsafe) stream
|
||||
std::ostringstream strm;
|
||||
strm << Glib::ustring("\"") << options.cacheBaseDir.c_str() << Glib::ustring("\" ");
|
||||
strm << flaggingMode << Glib::ustring(" ");
|
||||
strm << cfs->fnumber << Glib::ustring(" ") << cfs->shutter << Glib::ustring(" ");
|
||||
strm << cfs->focalLen << Glib::ustring(" ") << cfs->iso << Glib::ustring(" \"");
|
||||
strm << cfs->lens << Glib::ustring("\" \"") << cfs->camera << Glib::ustring("\"");
|
||||
strm << cfs->lens << Glib::ustring("\" \"") << cfs->camMake << Glib::ustring("\"");
|
||||
strm << Glib::ustring(" \"") << cfs->camModel << Glib::ustring("\"");
|
||||
|
||||
if (options.rtSettings.verbose)
|
||||
printf("Custom profile builder's command line: %s\n", Glib::ustring(cmdLine + strm.str()).c_str());
|
||||
bool success = safe_spawn_command_line_sync (cmdLine + strm.str());
|
||||
|
||||
// Now they SHOULD be there (and potentially "partial"), so try to load them and store it as a full procparam
|
||||
@@ -469,7 +474,7 @@ rtengine::IImage8* Thumbnail::processThumbImage (const rtengine::procparams::Pro
|
||||
}
|
||||
else {
|
||||
// Full thumbnail: apply profile
|
||||
image = tpp->processImage (pparams, h, rtengine::TI_Bilinear, cfs.camera, cfs.focalLen, cfs.focalLen35mm, cfs.focusDist, cfs.shutter, cfs.fnumber, cfs.iso, cfs.expcomp, scale );
|
||||
image = tpp->processImage (pparams, h, rtengine::TI_Bilinear, cfs.getCamera(), cfs.focalLen, cfs.focalLen35mm, cfs.focusDist, cfs.shutter, cfs.fnumber, cfs.iso, cfs.expcomp, scale );
|
||||
}
|
||||
|
||||
tpp->getDimensions(lastW,lastH,lastScale);
|
||||
@@ -494,7 +499,7 @@ rtengine::IImage8* Thumbnail::upgradeThumbImage (const rtengine::procparams::Pro
|
||||
return 0;
|
||||
}
|
||||
|
||||
rtengine::IImage8* image = tpp->processImage (pparams, h, rtengine::TI_Bilinear, cfs.camera, cfs.focalLen, cfs.focalLen35mm, cfs.focusDist,cfs.shutter, cfs.fnumber, cfs.iso, cfs.expcomp, scale );
|
||||
rtengine::IImage8* image = tpp->processImage (pparams, h, rtengine::TI_Bilinear, cfs.getCamera(), cfs.focalLen, cfs.focalLen35mm, cfs.focusDist,cfs.shutter, cfs.fnumber, cfs.iso, cfs.expcomp, scale );
|
||||
tpp->getDimensions(lastW,lastH,lastScale);
|
||||
|
||||
delete tpp;
|
||||
@@ -595,8 +600,9 @@ int Thumbnail::infoFromImage (const Glib::ustring& fname, rtengine::RawMetaDataL
|
||||
cfs.sec = idata->getDateTime().tm_sec;
|
||||
cfs.timeValid = true;
|
||||
cfs.exifValid = true;
|
||||
cfs.lens = idata->getLens();
|
||||
cfs.camera = idata->getCamera();
|
||||
cfs.lens = idata->getLens();
|
||||
cfs.camMake = idata->getMake();
|
||||
cfs.camModel = idata->getModel();
|
||||
|
||||
if (idata->getOrientation()=="Rotate 90 CW") {
|
||||
deg = 90;
|
||||
@@ -610,7 +616,8 @@ int Thumbnail::infoFromImage (const Glib::ustring& fname, rtengine::RawMetaDataL
|
||||
}
|
||||
else {
|
||||
cfs.lens = "Unknown";
|
||||
cfs.camera = "Unknown";
|
||||
cfs.camMake = "Unknown";
|
||||
cfs.camModel = "Unknown";
|
||||
}
|
||||
// get image filetype
|
||||
std::string::size_type idx;
|
||||
|
@@ -85,8 +85,8 @@ class Thumbnail {
|
||||
const rtengine::procparams::ProcParams& getProcParams ();
|
||||
const rtengine::procparams::ProcParams& getProcParamsU (); // Unprotected version
|
||||
|
||||
// Use this to create params on demand for update
|
||||
rtengine::procparams::ProcParams* createProcParamsForUpdate (bool returnParams, bool forceCPB);
|
||||
// Use this to create params on demand for update ; if flaggingMode=true, the procparams is created for a file being flagged (inTrash, rank, colorLabel)
|
||||
rtengine::procparams::ProcParams* createProcParamsForUpdate (bool returnParams, bool forceCPB, bool flaggingMode=false);
|
||||
|
||||
void setProcParams (const rtengine::procparams::ProcParams& pp, ParamsEdited* pe=NULL, int whoChangedIt=-1, bool updateCacheNow=true);
|
||||
void clearProcParams (int whoClearedIt=-1);
|
||||
|
@@ -9,7 +9,7 @@ using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
#endregion
|
||||
|
||||
// *** Raw Therapee sample Custom Profile builder (version 2010-11-15) ***
|
||||
// *** Raw Therapee sample Custom Profile builder (version 2013-08-12) ***
|
||||
// WARNING: PP3 format may change in the future versions! If this happens there will probably be no automatic migration path, you'll have to adjust on your own.
|
||||
// This is a sample, and therefore not supported by the RT team (just by oduis)
|
||||
//
|
||||
@@ -153,6 +153,13 @@ namespace RTProfilerBuilder {
|
||||
// What the user selected as his base profile
|
||||
string defaultProfileFilePath = args[argNo++];
|
||||
|
||||
// Cache directory, for any logging file
|
||||
string cachePath = args[argNo++];
|
||||
|
||||
|
||||
// True if the image is only being flagged as inTrash, rank or colorLabel but still need valid PP3 - actually not used by this script
|
||||
bool forFlaggingPurpose = bool.Parse(args[argNo++], CultureInfo.InvariantCulture);
|
||||
|
||||
// Note that old C++ has no automatic number globalization
|
||||
double fNumber = double.Parse(args[argNo++], CultureInfo.InvariantCulture);
|
||||
double exposureSecs = double.Parse(args[argNo++], CultureInfo.InvariantCulture);
|
||||
@@ -160,7 +167,9 @@ namespace RTProfilerBuilder {
|
||||
long iso = long.Parse(args[argNo++], CultureInfo.InvariantCulture);
|
||||
|
||||
string lens = args[argNo++];
|
||||
string camera = args[argNo++];
|
||||
string cameraMake = args[argNo++];
|
||||
string cameraModel = args[argNo++];
|
||||
string camera = cameraMake + " " + cameraModel;
|
||||
#endregion
|
||||
|
||||
// Read default file as basis
|
||||
|
Reference in New Issue
Block a user