There are several issues with the Edit IPTC and Edit XMP functions, and generally a review and overhaul of these functions is needed. But the highest priority issue at the moment is one of data integrity.
When a user has XnViewMP configured to use Sidecar Files with the following options:
Create or Update XMP Sidecar=ON
Update Master File=OFF
The expectation is that metadata changes will be written to the sidecar file and NOT to the master file. That is the whole point of "Update Master File=OFF"
Edit IPTC has several option modes: "XMP Only", "XMP update or create IPTC", "IPTC create or update XMP", and "IPTC-IIM only".
These modes are not documented and are not well understood, but it would seem clear the intention of "XMP Only" is to use IPTC<->XMP mappings to encapsulate IPTC metadata in XMP. This is a known capability, and is referenced in IPTC documentation:
"Be aware that IPTC Core and IPTC Extension fields can be saved as XMP "sidecar files" for camera Raw files as some of these file formats do not support embedded metadata."
https://www.iptc.org/std/photometadata/ ... userguide/
I think Pierre feels that "XMP Only" is an option that should be removed, but I think it should stay. IPTC encapsulation in XMP is an essential function for metadata compatibility. But the function does need to be tamed, so it performs appropriately, by honoring the global metadata sidecar/master-file settings. I think the "XMP Only" option has a place alongside other options to preserve the capability to solely use IPTC encapsulation in XMP.
It is debatable what should happen when the remaining mode options are used, but certainly in the case of "XMP Only" the master file should not be touched when the explicit settings made by the user are to not touch it.
In some use cases it is important to be able to maintain the originality of source files, and the enforcement of sidecar rules allows this. Writing the master file when told not to causes a data integrity issue.
Steps to Reproduce:
Settings:
Create or Update XMP Sidecar=ON
Update Master File=OFF
Edit IPTC Options Mode: XMP only
1. Edit IPTC
2. Make a change to Caption, or Keywords. Click Write.
Expected behavior: master file untouched, XMP sidecar written immediately.
(Master file is also written with "XMP, update or create IPTC" , and "IPTC create or update XMP".)
Note: The "Edit XMP" dialog behaves differently and does not have a similar problem. If "Edit XMP" is used, and Edit XMP Options Mode="XMP and IPTC", the master file is not touched and the sidecar file is updated immediately. This is good behavior.