c-koi / gmic-qt

G'MIC-Qt is a versatile front-end to the image processing framework G'MIC.
GNU General Public License v3.0
207 stars 54 forks source link

gimp3 host build fails: error: ‘gimp_image_get_active_layer’ was not declared in this scope #163

Closed slackernetuk closed 9 months ago

slackernetuk commented 2 years ago

OS: Slackware -current gmic-qt: master

[ 90%] Building CXX object CMakeFiles/gmic_gimp_qt.dir/src/Widgets/ZoomLevelSelector.cpp.o
[ 91%] Building CXX object CMakeFiles/gmic_gimp_qt.dir/src/Widgets/SearchFieldWidget.cpp.o
[ 92%] Building CXX object CMakeFiles/gmic_gimp_qt.dir/src/Widgets/LanguageSelectionWidget.cpp.o
[ 93%] Building CXX object CMakeFiles/gmic_gimp_qt.dir/src/Widgets/ProgressInfoWindow.cpp.o
[ 94%] Building CXX object CMakeFiles/gmic_gimp_qt.dir/src/Widgets/VisibleTagSelector.cpp.o
[ 95%] Building CXX object CMakeFiles/gmic_gimp_qt.dir/src/Host/Gimp/host_gimp.cpp.o
/tmp/snuk/gmic/gmic-qt/src/Host/Gimp/host_gimp.cpp: In function ‘void GmicQtHost::getLayersExtent(int*, int*, GmicQt::InputMode)’:
/tmp/snuk/gmic/gmic-qt/src/Host/Gimp/host_gimp.cpp:495:33: error: ‘gimp_image_get_active_layer’ was not declared in this scope; did you mean ‘gimp_image_remove_layer’?
  495 |   _GimpLayerPtr activeLayerID = gimp_image_get_active_layer(gmic_qt_gimp_image_id);
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                 gimp_image_remove_layer
/tmp/snuk/gmic/gmic-qt/src/Host/Gimp/host_gimp.cpp: In function ‘void GmicQtHost::getCroppedImages(cimg_library::CImgList<float>&, cimg_library::CImgList<char>&, double, double, double, double, GmicQt::InputMode)’:
/tmp/snuk/gmic/gmic-qt/src/Host/Gimp/host_gimp.cpp:563:35: error: ‘gimp_image_get_active_layer’ was not declared in this scope; did you mean ‘gimp_image_remove_layer’?
  563 |   _GimpLayerPtr active_layer_id = gimp_image_get_active_layer(gmic_qt_gimp_image_id);
      |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                   gimp_image_remove_layer
/tmp/snuk/gmic/gmic-qt/src/Host/Gimp/host_gimp.cpp: In function ‘void GmicQtHost::outputImages(cimg_library::CImgList<float>&, const cimg_library::CImgList<char>&, GmicQt::OutputMode)’:
/tmp/snuk/gmic/gmic-qt/src/Host/Gimp/host_gimp.cpp:892:37: error: ‘gimp_image_get_active_layer’ was not declared in this scope; did you mean ‘gimp_image_remove_layer’?
  892 |     _GimpLayerPtr active_layer_id = gimp_image_get_active_layer(gmic_qt_gimp_image_id);
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                     gimp_image_remove_layer
/tmp/snuk/gmic/gmic-qt/src/Host/Gimp/host_gimp.cpp:963:11: error: ‘gimp_image_set_active_layer’ was not declared in this scope; did you mean ‘gimp_image_unset_active_channel’?
  963 |           gimp_image_set_active_layer(gmic_qt_gimp_image_id, active_layer_id);
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |           gimp_image_unset_active_channel
/tmp/snuk/gmic/gmic-qt/src/Host/Gimp/host_gimp.cpp:965:11: error: ‘gimp_image_set_active_layer’ was not declared in this scope; did you mean ‘gimp_image_unset_active_channel’?
  965 |           gimp_image_set_active_layer(gmic_qt_gimp_image_id, top_layer_id);
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |           gimp_image_unset_active_channel
/tmp/snuk/gmic/gmic-qt/src/Host/Gimp/host_gimp.cpp:971:37: error: ‘gimp_image_get_active_layer’ was not declared in this scope; did you mean ‘gimp_image_remove_layer’?
  971 |     _GimpLayerPtr active_layer_id = gimp_image_get_active_layer(gmic_qt_gimp_image_id);
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                     gimp_image_remove_layer
gmake[2]: *** [CMakeFiles/gmic_gimp_qt.dir/build.make:1230: CMakeFiles/gmic_gimp_qt.dir/src/Host/Gimp/host_gimp.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:84: CMakeFiles/gmic_gimp_qt.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2
jtojnar commented 2 years ago

GIMP now supports selecting multiple layers so the API was deprecated as described in https://github.com/c-koi/gmic-qt/pull/114#issuecomment-870443397 and https://github.com/c-koi/gmic-qt/pull/104#issuecomment-869909853 and GIMP 2.99.12 removed the deprecated functions altogether.

The plug-in will need to be updated to use gimp_image_list_selected_layers() instead of gimp_image_get_active_layer().

zyy-2022-zyy commented 2 years ago

Looking forward to fixing this bug.

gstalnaker commented 2 years ago

Coming late to this party - may I humbly suggest that information about this API deprecation issue that affects the gmic_gimp_qt plugin be put on the primary GMIC QT plugin download page? Please. I just spent TWO DAYS trying to figure out why the plugin worked in GIMP 2.99.8 but did not work in 2.99.12 before I found this issue here that clearly and unambiguously says why it does not work. Yes, I know 2.99.12 is not a stable release, but 3.00 will be and this issue will remain in all future non 2.10.x versions of GIMP until the QT plugin is updated to use the new API (however far into the future that update may be).

dtschump commented 2 years ago

@gstalnaker : GIMP 2.99.x is known to be a development version, so it is expected that features can be broken or changing at a fast pace (that is indeed the case for the plug-in API of future GIMP 3.0). So to say, we do not suggest using the development version of GIMP if you require sth stable over time, particularly if you use third-party plug-ins (I doubt that many existing 3rd-party plug-ins continue to work with current dev version of GIMP).

When GIMP 3.0 will be out, as a stable version, we'll probably try to make the G'MIC code compatible with the GIMP 3.0 plug-in API, but until then, we won't try to follow the API changes in GIMP 2.99, as things could break and break again until the stable release. If someone wants to do this job for G'MIC, and has the time to so do, then of course he's welcome.

draekko commented 1 year ago

Quick and dirty patch to get this compiling, tested with the latest GIMP git pull (2.99.15 as of this morning). Set the GIMP check to 2.99.12 as i saw some issues on gmic_qt or gmic forget which that listed that there for the first version with that issue though i might be misremembering.

Here's the gist i made for it.

https://gist.github.com/draekko/8f5782a3cff5989d6464ae5415792a95

dtschump commented 1 year ago

https://github.com/c-koi/gmic-qt/commit/b616829854c0e482d63b9fe8eca48e73d7cd3bd8

hfiguiere commented 1 year ago

The commit above fixes this.