FBX importer dosen't import uv-maps correctly when there is 2 or more maps (possible fix suggestion here too) #62224

Closed
opened 2019-03-05 18:45:41 +01:00 by Kalle-Samuli Riihikoski · 8 comments

Hi! FBX importer dosen't import uv-maps correctly if uv-map count is 2 or more. The problem is that fbx importer when it is creating those maps it dosen't give a count that
when calling mesh.uv_layers.new method, blender will will create automaticly uv-data for mesh. I was able to make this work if I after uv_layers.new will set all uv location
to (0,0) then leave fbx importer addon to continue its work.

You can find this code from import.fbx.py and line 1012. Adding last 4 lines will make importer to work with multiply uv-sets.

   uv_lay = mesh.uv_layers.new(name=fbx_layer_name)

            if uv_lay is None:
                print("Failed to add {%r %r} UVLayer to %r (probably too many of them?)"
                      "" % (layer_id, fbx_layer_name, mesh.name))
                continue

            blen_data = mesh.uv_layers[-1].data
            for u in blen_data:
                u.uv[0] = 0
                u.uv[1] = 0
Hi! FBX importer dosen't import uv-maps correctly if uv-map count is 2 or more. The problem is that fbx importer when it is creating those maps it dosen't give a count that when calling mesh.uv_layers.new method, blender will will create automaticly uv-data for mesh. I was able to make this work if I after uv_layers.new will set all uv location to (0,0) then leave fbx importer addon to continue its work. You can find this code from import.fbx.py and line 1012. Adding last 4 lines will make importer to work with multiply uv-sets. ``` uv_lay = mesh.uv_layers.new(name=fbx_layer_name) if uv_lay is None: print("Failed to add {%r %r} UVLayer to %r (probably too many of them?)" "" % (layer_id, fbx_layer_name, mesh.name)) continue blen_data = mesh.uv_layers[-1].data for u in blen_data: u.uv[0] = 0 u.uv[1] = 0 ```
Author
Member

Added subscriber: @Kalle-SamuliRiihikoski

Added subscriber: @Kalle-SamuliRiihikoski
Bastien Montagne was assigned by Brecht Van Lommel 2019-03-05 18:54:47 +01:00

Thanks for the suggestion, but will rather update API so that we can generate 'NULL' UVlayers, will be much more efficient. ;)

Thanks for the suggestion, but will rather update API so that we can generate 'NULL' UVlayers, will be much more efficient. ;)
Author
Member

Yes I agree. This was a hacky solution. Thanks for the feedback. So any tips if I want to make this feature into API. Where to start?

Yes I agree. This was a hacky solution. Thanks for the feedback. So any tips if I want to make this feature into API. Where to start?

This issue was referenced by blender/blender@dbdd79fabe

This issue was referenced by blender/blender@dbdd79fabe2934de6184c0230f91b2e8af716a7b

This issue was referenced by 91d241f5b7

This issue was referenced by 91d241f5b7df9a3806072765cc5371c5ee34dbd7

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Hey, already went on and did the fix, sorry. :)

Hey, already went on and did the fix, sorry. :)
Author
Member

Waau. Can I kiss somebody :)

Waau. Can I kiss somebody :)
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#62224
No description provided.