After updating SketchUp SDK from 23.0.397.0 to 2024.0.484.0 textures were changed.
After import all the data from sketchup file I’m trying to save appropriate textures’ images to files via next code:
SUTextureRef texture = SU_INVALID;
const auto get_texture_result = SUMaterialGetTexture(i_su_material, &texture);
if (get_texture_result != SU_ERROR_NO_DATA) {
if (get_texture_result != SU_ERROR_NONE)
throw std::runtime_error("unable to get texture from material");
MSUString texture_file_name;
if (SUTextureGetFileName(texture, &texture_file_name.Access()) != SU_ERROR_NONE)
throw std::runtime_error("unable to get material name");
if (SUTextureWriteToFile(texture, i_file_name) != SU_ERROR_NONE)
throw std::runtime_error("unable to store");
But results are different between different versions of SDK. Output images are visually similar but if I’m trying to compare them pixel-wise (each channel separately) difference can be more than 10 units from 255 for color channel.
Is there any way to prevent changes in behavior? Are there any obvious reasons for such changes in behavior?
Here is example of different images (sorry, new user only one image can be uploaded).
At least some texture information was lost. Two results with exactly the same code, the only difference - SUTextureWriteOriginalToFile vs SUTextureWriteToFile
SUTextureWriteOriginalFile will (or at least should) write an original (embedded) image bytes, in your case it looks like the material has been colorized (check SUMaterialGetType and SUMaterialGetColorizeType).
I have no idea why there is a difference between v23 and v24, maybe the underlying image processing SDK has been changed. Maybe try to export it (from both and compare) as lossless format like PNG.
First of all, you reported problems with an old SDK version, viz …
The SDK core code is at a newer version, and all changes would be made from that “milestone”.
Yes, you should try it and verify that the issue still exists. If the problem was a regression bug, it might have already been fixed in the next (or later) SDK versions.
If the problem is still present in the latest version, then as said, please log a report in the official API issue tracker.
First of all, you reported problems with an old SDK version
It wasn’t old when it was reported at the first time as I remember, but nevertheless appropriate problem exists in the latest SDK version (2024.0.553.0)