Commit 1a34ef7
authored
feat: oiiotool --mergemeta pt 2: fold into --pastemeta (#4674)
After merging #4672, we noticed some things that could be improved, so
this is a further revision (and partial retraction).
There was already an oiiotool flag, `--metamerge`, which in retrospect
make it seem unnecessarily confusing to add --mergemeta. So this PR
removes this extra new command, instead simply piggy-backing on the
existing --pastemeta by adding to it optional modifiers:
- `:merge=` controls the merge strategy, 0 (default) means discard the
existing metadata entirely and use only the pasted, matching the
original --pastemeta behavior; 1 means merge nondestructively (no
existing metadata will be altered or removed); 2 means destructive
merge, where pasted metadata will overwrite existing metadata having the
same name, but conflict-free existing metadata will remain.
- `:pattern=` regex selects only some metadata.
Additionally, we noticed an interesting corner case that surprised users
when testing the new metadata merging feature from the last PR: What
happens if the metadata source image has fewer subimages than the pixel
source images? The behavior generally for oiiotool is that when binary
operations (those taking two images as input) are on images with
differing numbers of subimages, the output gets the number of subimges
as the FIRST input (assuming -a instructed us to consider subimages at
all). But that's not what we want here! If the metadata source has one
subimage and the pixel source has many, clearly the intuitive result is
for that one metadata set to be pasted into all of the subimages from
the pixel-supplying image.
So we fix that so that for --pastemeta, it's the second input image (not
the first) that takes the lead in determining the number of subimages we
will process. This in turn took a bit of extra infrastructure fixing in
the OiiotoolOp class that controls this logic.
Signed-off-by: Larry Gritz <[email protected]>1 parent 7fc6a7b commit 1a34ef7
File tree
7 files changed
+166
-65
lines changed- src
- doc
- include/OpenImageIO
- oiiotool
- testsuite/oiiotool-copy
- ref
7 files changed
+166
-65
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2996 | 2996 | | |
2997 | 2997 | | |
2998 | 2998 | | |
2999 | | - | |
3000 | | - | |
3001 | | - | |
3002 | | - | |
3003 | | - | |
3004 | | - | |
3005 | | - | |
3006 | | - | |
3007 | | - | |
3008 | | - | |
3009 | | - | |
3010 | | - | |
3011 | | - | |
3012 | | - | |
3013 | | - | |
3014 | | - | |
3015 | | - | |
3016 | | - | |
| 2999 | + | |
| 3000 | + | |
| 3001 | + | |
3017 | 3002 | | |
3018 | 3003 | | |
3019 | 3004 | | |
3020 | | - | |
3021 | | - | |
3022 | | - | |
3023 | | - | |
3024 | | - | |
3025 | | - | |
| 3005 | + | |
| 3006 | + | |
| 3007 | + | |
| 3008 | + | |
| 3009 | + | |
| 3010 | + | |
| 3011 | + | |
| 3012 | + | |
| 3013 | + | |
| 3014 | + | |
| 3015 | + | |
3026 | 3016 | | |
3027 | 3017 | | |
3028 | 3018 | | |
3029 | 3019 | | |
3030 | | - | |
| 3020 | + | |
3031 | 3021 | | |
3032 | | - | |
| 3022 | + | |
| 3023 | + | |
| 3024 | + | |
| 3025 | + | |
| 3026 | + | |
3033 | 3027 | | |
3034 | 3028 | | |
3035 | | - | |
3036 | | - | |
3037 | | - | |
| 3029 | + | |
| 3030 | + | |
| 3031 | + | |
3038 | 3032 | | |
3039 | | - | |
3040 | 3033 | | |
3041 | 3034 | | |
3042 | 3035 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
333 | 333 | | |
334 | 334 | | |
335 | 335 | | |
| 336 | + | |
336 | 337 | | |
337 | 338 | | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
338 | 345 | | |
339 | 346 | | |
340 | 347 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4757 | 4757 | | |
4758 | 4758 | | |
4759 | 4759 | | |
4760 | | - | |
4761 | | - | |
4762 | | - | |
4763 | | - | |
4764 | | - | |
4765 | | - | |
4766 | | - | |
4767 | | - | |
4768 | | - | |
4769 | | - | |
4770 | | - | |
4771 | | - | |
| 4760 | + | |
| 4761 | + | |
| 4762 | + | |
| 4763 | + | |
| 4764 | + | |
| 4765 | + | |
| 4766 | + | |
| 4767 | + | |
| 4768 | + | |
| 4769 | + | |
| 4770 | + | |
4772 | 4771 | | |
4773 | | - | |
4774 | | - | |
4775 | | - | |
4776 | | - | |
| 4772 | + | |
| 4773 | + | |
| 4774 | + | |
| 4775 | + | |
| 4776 | + | |
| 4777 | + | |
4777 | 4778 | | |
4778 | 4779 | | |
4779 | 4780 | | |
| |||
6799 | 6800 | | |
6800 | 6801 | | |
6801 | 6802 | | |
6802 | | - | |
| 6803 | + | |
6803 | 6804 | | |
6804 | | - | |
6805 | | - | |
6806 | | - | |
6807 | 6805 | | |
6808 | 6806 | | |
6809 | 6807 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
781 | 781 | | |
782 | 782 | | |
783 | 783 | | |
784 | | - | |
| 784 | + | |
| 785 | + | |
785 | 786 | | |
786 | 787 | | |
787 | 788 | | |
788 | 789 | | |
789 | 790 | | |
| 791 | + | |
790 | 792 | | |
791 | 793 | | |
792 | 794 | | |
| |||
803 | 805 | | |
804 | 806 | | |
805 | 807 | | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
806 | 814 | | |
807 | 815 | | |
808 | 816 | | |
| |||
891 | 899 | | |
892 | 900 | | |
893 | 901 | | |
894 | | - | |
895 | | - | |
896 | | - | |
897 | | - | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
898 | 908 | | |
899 | 909 | | |
900 | 910 | | |
| |||
1010 | 1020 | | |
1011 | 1021 | | |
1012 | 1022 | | |
1013 | | - | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
1014 | 1052 | | |
1015 | 1053 | | |
1016 | 1054 | | |
| |||
1112 | 1150 | | |
1113 | 1151 | | |
1114 | 1152 | | |
| 1153 | + | |
1115 | 1154 | | |
1116 | 1155 | | |
1117 | 1156 | | |
| |||
File renamed without changes.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
87 | | - | |
| 86 | + | |
| 87 | + | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
148 | 205 | | |
149 | 206 | | |
150 | 207 | | |
| |||
202 | 259 | | |
203 | 260 | | |
204 | 261 | | |
205 | | - | |
| 262 | + | |
206 | 263 | | |
207 | 264 | | |
208 | 265 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | 98 | | |
103 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
104 | 104 | | |
| 105 | + | |
| 106 | + | |
105 | 107 | | |
| 108 | + | |
| 109 | + | |
106 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
107 | 114 | | |
108 | 115 | | |
109 | 116 | | |
| |||
146 | 153 | | |
147 | 154 | | |
148 | 155 | | |
149 | | - | |
| 156 | + | |
150 | 157 | | |
151 | 158 | | |
152 | 159 | | |
| |||
0 commit comments