lsalzman / iqm

Inter-Quake Model format development kit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Blender addon 2.8 Update problems

shpuld opened this issue · comments

commented

Hey,

I just tried the 2.8 version of the exporter to notice that it doesn't work when exporting any models. I did my homework to see what has changed in 2.8 API that breaks it, and there's only two things.

  • Can't use * for matrix/vector multiplication anymore, you need to use @, this is a quick fix.
  • uv_textures in a Mesh are now gone, to me it seems that it was used to get the image name.

I already "fixed" the addon for myself by breaking the image/material+image-extension options and only using material, but a proper fix would be in order I believe.

I added some commits that I think should fix the issue.

commented

The matrix multiplication works, but the texture getting is still faulty, can't use texture_slots anymore either, seems that this was Blender renderer things, and now there's only Cycles. I tried doing this and it works only if you have texture paint panel open in my testing, which is quite the quirk and probably would make lots of users wonder why it's not working.

            matnames = {}
            if data.materials:
                for idx, mat in enumerate(data.materials):
                    matprefix = mat.name or ''
                    matimage = ''
                    for mtex in mat.texture_paint_images:
                        matimage = os.path.basename(mtex.filepath)
                        break

Alternatively you could go through the node tree and find the image textures there, as explained here https://blender.stackexchange.com/questions/80773/how-to-get-the-name-of-image-of-image-texture-with-python

Then there's just the problem of picking the correct texture, say if you have diffuse/normal/spec all applied in the node editor to see your model the way it should be. I guess in those cases the user shouldn't be using the image/image-ext options.

I added some code that should possibly handle both cases now. Can you test?

commented

I haven't had the chance of trying it out yet, but I can see from the code it's still using the removed texture_slots

I can try it out later today and try to make it work like you intended and make a PR if I succeed

commented

the previous commits fix the issues and everything works fine, so I'm closing this one