SU_ERROR_SERIALISATION when using SUTextureWriteToFile on macOS 2021 SDK

Hello all. I’m in the process of updating the sketchup importer for blender to work with version 2.9.
So far all seems to work but the textures. It seems that SUTextureWriteToFile always returns the error. SU_ERROR_SERIALISATION

in python:

                tex_name ="/")[-1]
                temp_dir = tempfile.gettempdir()
                skp_fname = self.filepath.split("/")[-1].split(".")[0]
                temp_dir += "/" + skp_fname
                if not os.path.isdir(temp_dir):
                temp_file_path = os.path.realpath(os.path.join(temp_dir, tex_name))
                skp_log(f"Texture saved temporarily at {temp_file_path}")
                img =
                # os.remove(temp_file_path)

i do this and the cpython wrapper uses.

cdef class Texture:
cdef SUTextureRef tex_ref

def __cinit__(self):
    self.tex_ref.ptr = <void*> 0

def write(self, filename):
    py_byte_string = filename.encode('UTF-8')
    cdef const char* file_path = py_byte_string
    check_result(SUTextureWriteToFile(self.tex_ref, file_path))

property name:
    def __get__(self):
        cdef SUStringRef n
        n.ptr = <void*> 0
        check_result(SUTextureGetFileName(self.tex_ref, &n))
        return StringRef2Py(n)

property dimensions:
    def __get__(self):
        cdef double s_scale = 1.0
        cdef double t_scale = 1.0
        cdef size_t width = 0
        cdef size_t height = 0
        cdef SUMaterialRef mat
        check_result(SUTextureGetDimensions(self.tex_ref, &width, &height, &s_scale, &t_scale))
        return width, height, s_scale, t_scale

property use_alpha_channel:
    def __get__(self):
        cdef bool alpha_channel_used
        check_result(SUTextureGetUseAlphaChannel(self.tex_ref, &alpha_channel_used))
        return alpha_channel_used

I have the strong suspicion this has to do with string -> byte conversion done in the .pyx
Python3 vs Python2 eventually.

source can be found here.

Not mine but the relevant parts.

It would be very nice if someone with more C knowledge that me could have a look.

Same error in 2020SDKmac and 2019SDKmac

Windows10 works as expected.

regards u3real

Hello, I’ve built the same source and come to the same conclusion.
I can only load sketchup models without textures in blender
I’m also trying to display path with sky_log but do not see the result in the console…
Did you find a way to fix it ?

Please also follow this thread:

Now after more than one year without any answer from the devs i have the strong suspicion this is intentional. Especially now that SU needs a costly supscription.

This bug seems to be present in all mac SDK versions.
Not only in write texture but in all methods i tried to get textures from the .skp file.
I think it has something to do with little/big endian in string-> byte conversion.
If no dev has a look at it there will be no working mac version — ever.

Please file an issue in our issue tracker so we get this up on our radar.

Done Thanks alot for the reply

1 Like