Page MenuHome

Collada Importer Material Assignment Fix
ClosedPublic

Authored by Trevor Glauz (TSGlauz) on Jan 10 2019, 2:24 AM.

Details

Reviewers
Gaia Clary (gaiaclary)
Group Reviewers
Collada
Summary

If multiple primitives in a single mesh in an imported collada file overlapped, blender would merge those primitives into one upon import. But this invalidated some pointers to the mesh's polygons from the mappings of materials to primitives. By delaying a call to BKE_mesh_validate until after the materials have been assigned to the polygons, those pointers stay valid.

Attached is a zip file containing a collada model file and texture images that get assigned incorrectly upon import.

Diff Detail

Repository
rB Blender
Branch
arcpatch-D4187 (branched from master)
Build Status
Buildable 2716
Build 2716: arc lint + arc unit

Event Timeline

Trevor Glauz (TSGlauz) edited the summary of this revision. (Show Details)
  • fix unreported: collada mesh importer: Remove duplicate calculation of Normals.

Hi, Trevor

Thanks for the patch! It looks ok to me.

While testing it i found an oddity: normals are calculated twice. I fixed that as well.
Please can you double check that removing the duplicate normal calculation
works in general.

cheers,
Gaia

You're right, that's an unnecessary extra normals calculation.

This revision is now accepted and ready to land.Jan 10 2019, 8:30 PM

Hi, Trevor;

Thanks again for the patch.
It is now commit to master

cheers,
Gaia

Excuse me, can I ask about the "primitive deletion" thing? Something like this happens in many importers, and it is making working with Blender very difficult, since I work with game data, that is always importing/exporting. I provided an example of an OBJ file (3DS does it too but less so) in a bug report a little while back and a real **** (awful developer) here named Sebastian tanked it immediately saying deleted polygons is a beloved feature of Blender. I'm just curious if there could be a connection. (In games overlapping elements is required and fundamental, and also in Blender I've never had a problem with this. Normally importers that lose data or destroy things are not published, and heads roll. I don't understand Blender culture. It's like a den full of nasty punks. The opposite of what you want for software work.)

Removing duplicate edges/faces is just how blender works since it is considered invalid data. You can have duplicate vertices, though. And with duplicate vertices, you can overlap faces that use entirely different vertices that sit in the exact same positions. You can also duplicate triangles into separate meshes and overlap them that way.

Removing duplicate edges/faces is just how blender works since it is considered invalid data. You can have duplicate vertices, though. And with duplicate vertices, you can overlap faces that use entirely different vertices that sit in the exact same positions. You can also duplicate triangles into separate meshes and overlap them that way.

Okay, but even if that's so... nobody on earth would think to remove faces from a 3D data set... or call it invalid. The importers job is to translate from one system to another. I've worked on hundreds of algorithms that convert model data in my day, and never once have I implemented or encountered anything that throws out faces or edges from 3D data. Blender should model at a minimum how 3D hardware like OpenGL and Direct3D work. I have a hate-hate relationship with Blender, because it's so awful (developers) and the community is so awful, and as much as I'd like to develop an alternative, I've yet to find the time. It's the worst possible relationship to have to something. I don't understand why Blender is so messed up, especially considering how many poor souls don't really have an alternative. I'm not sure what is being called "duplicate" data, but it's obviously the job of an importer to duplicate vertices or edges if necessary to avoid throwing away faces. It's not like this is Blender's only messed up aspect... there's like countless things about Blender that are just humiliating and time sucking atrocities. It's rare that something is a nonstarter like being unable to work with data that everything else consumes/generates without issue, whereas normally Blender just forces you to perform the same humiliating task that takes 100 times longer than it should for a 100 times on end, because it's the opposite of productivity software. (It's only worse for being a step up from no software at all.)

I don't want to rant. But it's so obvious that "invalid data" is just idiotically irresponsible.

Blender should not loose vertices, edges or faces on import, at least not with Collada.

If you want to help improving the Collada Importer then please create another ticket which contains:

  • A blend file with the original model (as simple as possible)
  • A collada file that contains the original model
  • A brief description about what you expect to happen and how it fails.

Then i (or whoever feels entitled to help with programming the fix) can inspect what happens during import of the dae file and fix the issue.

Please do not reuse this ticket for discussion.
thanks

@Gaia Clary (gaiaclary) Sure, but the thrust of this (COLLADA) ticket IS losing primitives. The materials are lost because the primitives are discarded @Trevor Glauz (TSGlauz) says this defect is something core to Blender.