Project

General

Profile

lensfun-broken-tca-changed.patch

Pascal de Bruijn, 08/22/2014 07:41 PM

View differences:

src/iop/lens.c
1875 1875
{
1876 1876
  dt_iop_lensfun_params_t   *p = (dt_iop_lensfun_params_t   *)self->params;
1877 1877
  dt_iop_lensfun_gui_data_t *g = (dt_iop_lensfun_gui_data_t *)self->gui_data;
1878
  dt_iop_lensfun_global_data_t *gd = (dt_iop_lensfun_global_data_t *)self->data;
1879

  
1880
  lfDatabase *dt_iop_lensfun_db = (lfDatabase *)gd->db;
1881

  
1878 1882
  const float val = dt_bauhaus_slider_get(slider);
1879 1883
  if(slider == g->tca_r) p->tca_r = val;
1880 1884
  else                   p->tca_b = val;
1881
  if(p->tca_r != 1.0 || p->tca_b != 1.0) p->tca_override = 1;
1885
  if(p->tca_r != 1.0 || p->tca_b != 1.0)
1886
  {
1887
    p->tca_override = 1;
1888

  
1889
    const lfLens **lenslist = lf_db_find_lenses_hd (dt_iop_lensfun_db, g->camera, NULL, p->lens, LF_SEARCH_SORT_AND_UNIQUIFY);
1890
    if(!lenslist)
1891
    {
1892
      fprintf(stderr, "[iop_lens]: !lenslist\n");
1893
      // generic lens model is required for manual tca correction to work
1894
      snprintf (p->lens, sizeof (p->lens), "Generic, Crop factor %.4f", p->crop);
1895
      dt_pthread_mutex_lock(&darktable.plugin_threadsafe);
1896

  
1897
      const lfLens **genericlenslist = lf_db_find_lenses_hd (dt_iop_lensfun_db, g->camera, "Generic", p->lens, LF_SEARCH_SORT_AND_UNIQUIFY);
1898

  
1899
      if(genericlenslist)
1900
      { lens_set (self, genericlenslist[0]);
1901
        fprintf(stderr, "[iop_lens]: genericlenslist\n");
1902
      }
1903
      else{                lens_set (self, NULL);
1904
        fprintf(stderr, "[iop_lens]: !genericlenslist\n");
1905

  
1906
      }
1907

  
1908
      lf_free (genericlenslist);
1909
      dt_pthread_mutex_unlock(&darktable.plugin_threadsafe);
1910
    }
1911
    else
1912
           fprintf(stderr, "[iop_lens]: lenslist\n");
1913
    lf_free (lenslist);
1914
  }
1882 1915
  p->modified = 1;
1883 1916
  dt_dev_add_history_item(darktable.develop, self, TRUE);
1884 1917
}
Go to top