Import OBJ but using existing material?

Sorry for necroing but this seems like most relevant place to leave this. I updated obj and fbx import scripts for blender 2.78 with this feature by following the example in this thread. You can download them here: https://drive.google.com/drive/folders/1oEF2iFUoyzfkY8uBdbq2TkJm1il0TNLu?usp=sharing

1 Like

Hallo Eagleshadow,

Thanx for the effort!!

Are these importers with a update and keep material function?

I replaced your .py with the original ones in blender but its not importing at all.

What am i doing wrong?

Hi!
Is there any chance you could update the scripts to make them work with 2.80? :slightly_smiling_face:

1 Like

If you have time and leisure then you can try to port it to Blender 2.8 :slight_smile: by your own:
https://b3d.interplanety.org/en/porting-add-on-from-blender-2-7-to-blender-2-8/

Try this version for 2.8:
https://onlinegdb.com/SJSKPVNIr
just replace files in 2.80\scripts\addons\io_scene_obj\ folder
I hope it helps.

is this a python script ?
I cannot find how to download it on the given link

can you show pic where you can do that !

thanks
happy bl

You can click “Fork this” and You will be able to download “import_obj.py” and “__ init _ .py”.
I would attach files here, but sadly I don’t have permissions yet because I’ve just registered to give an reply.

I would like to download this addon for 2.8, but I have no idea how to get it from the onlinegdb.com link. Could I download a zip file somewhere (to put in my addon folder)?

Then follow @Yodus advise above…

1 Like

Thanks for the help RSEhlers! I managed to install the addon.

I tried the addon but it doesn’t do exactly what I would have expected. The material in the blend file is overwritten by the material in the OBJ that is being imported. I would like it to behave the other way around, where it can keep the changes that were made to the materials. Is this possible?

COOL!!! Glad the hint helped!

I seem to have it working :slight_smile: You gave me a hint with the mtl file. Delete (or rename) the mtl file of the to obj file that is about to be imported. When you import it now, the newly imported file takes over the materials that exist in the blend. Nice :slight_smile:

1 Like

sorry guys I didn’t test those scripts properly. I’ve fixed them and performed basic tests. If you could check new version against different scenarios (e.g. obj containing mixed materials - some existing in blend and other new which should be imported) it would be great!

version 2:
https://onlinegdb.com/BJNIoguUB

cheers

2 Likes

Could someone explain it? How do I re-import model and update it in existing blender file. I would like to update only geometry and keep materials in blender file.

Thank you Yodus, for your help!

I am a new programmer, and was wondering if there could be an easier and safest way for you to make your add-on.

Instead of having to update your script when the original import obj gets updated, can’t you make a script that just calls the import obj, then afterwards your plugin acts only on the materials?

I’ve done things like this making plugins for RPG Maker, in Javascript.

This script removes duplicate materials; it worked well with Blender 2.9:
https://blender.stackexchange.com/a/195474/29628

2 Likes

This should be part of Blender.

I was literally looking for exactly this and made this post a couple of days ago on this forum. However, not for fbx and objs ( although, this is awesome and will save me a ton of time ) but for the Asset Browser.
Is it possible to make the script work for the Asset Browser as well?