Name match: Set objects copied from ext file 2 use host file's mat. props

I’m working with an OBJ file that’s regularly updated by a third party. After import in Rhino I have made final texture changes to the imported materials without altering their original names. My goal is that geometry of future updates to the OBJ can be re-imported, with objects matching by material name inheriting the adjusted material settings from Rhino.

Ideally, this would function like layers with matching names that merge, preserving only the host file’s settings.
However, in contrast to how it works for layers, it behaves differently for materials: I end up wwith 2 materials, both keeping their settings, with “[imported]” appended to the new one, instead of the materials merging.

Is there a setting I can change to achieve the desired behaviour: having the materials merge into one: the one from my working file (host file)?

Thank You

Hi @Kliefhead ,

I would suggest using material assignment by layer and then importing new versions of the obj to that layer. This way your original edited material will get used as it will be assigned to the layer where the updated geometry gets located. I hope that helps.

Thank you for the idea, but in my case it is not feasible to integrate my current layer structure to one that uses material assignment by layer.

I think the easiest way in my case would be to first copy all the new geometry in and then run a one-time python script that simply merges all materials that go by the name of “MaterialName [imported]” to their respective “MaterialName”. Followed by the -purge command to get rid of the unused [imported] materials.

Perhaps someone who knows how to write this and would be willing to help? Any input appreciated!