lsalzman / iqm

Inter-Quake Model format development kit
MIT License
239 stars 73 forks source link

Blender addon 2.8 Update problems #32

Closed shpuld closed 5 years ago

shpuld commented 5 years ago

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.

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.

lsalzman commented 5 years ago

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

shpuld commented 5 years ago

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.

lsalzman commented 5 years ago

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

shpuld commented 5 years ago

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

shpuld commented 5 years ago

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