I wanna import an OBJ-File (it contains already materialnames for example “groundfloor”).
In my Blender file I’ve already a set of materials (Cyclematerials) with the same names as in the OBJ-File.
But when I import the OBJ-File Blender always creates new materials. Instead of using the existing material “groundfloor” Blender creates a new material named “groundfloor.001”.
What do I have to do that Blender assigns automaticly existings materials to the imported OBJ-File ?
Or are there some other methodes, maybe a plugin ?
BTW: The same happens when I import a material from another Blenderscene. I wanna replace the existing material and not create a new material.
Edit:
There should be 2 options when an Obj-File get’s imported and if it has an existing Material:
Use the existing Material in the Blenderfile instead of the imported one
Use the Material from the imported File
And a Checkbox: Always do the selected action when a material already exists in the Blenderfile
How large are your files? Importing a mesh with 8.75 million polygons in .obj format (372MB) worked flawless for me using 2.61. Though memory usage increased to a total of max. 7.4GB while importing.
edit: sorry Alain for going off topic. But since you got this on Campbell’s toDo list, it probably will work sooner or later.
To my knowledge you won’t be able to import a mesh with a material name and have it auto-magically map to a same name material in Blender (or any application for that matter). You will have to select the mesh and use the material pulldown to re-assing to the new material. It’s really not difficult and even with a few dozen materials doesn’t take all that long to do.
Beyond that, you could try to delete the .mtl file (material library) with the .obj but I doubt that will do it. MeshLab I think has some tools to do this, but it’s such a detailed application that I haven’t been able to successfully do anything regarding materials with it. I know that doesn’t answer your question, but hopefully helps to get some direction.
I’m sure you don’t wanna waste your time with re-assigning 30 materials in a scene every time you update it.
My Workflow in architecture visualization is modelling in Sketchup (because it’s very easy, fast and intuitive to use), exporting to an OBJ-File and importing it in Blender. In Blender I add vegetation (tenthousand of instanced grass patches, trees and so on because Cycles supports instanced Objects and saves me ALOT VRAM).
And normaly I have to modify my Sketchup-Modell 3, 4 or n-times because the customer wants some changes.
So I have to restart importing it an assign my 30 materials again… I’m sure you wouldn’t wanna do such a boring and timeconsuming task
It’s no problem to expand the OBJ-Importscript with an automaticly “Assign existing Materials-Function” (Cambpell told me it wouln’t be such a big task for him ;-)).
Sorry, I was trying to offer you possible workarounds. If you are questioning my personal workflow, it’s usually a mute point, I don’t usually have to do multiple exports/imports. In the event that I actually do, I want to simplify the scene and reduce memory (in other words I want my models to be complete, but if something is obscured, I don’t want the textures loaded, same as you, VRAM consideration). I also like to examine every material (even though I have nodes pre-built) to ensure correctness.
Too bad he can’t also fix the importer such that it has the 2.49b options. Often when I import mesh I need it separated by material otherwise the import fails. Right now I import to 2.49b, save the blend and append to a new scene in 2.61. I long for the days I don’t need 2.49b anymore.
Any news with: OBJ-Importscript with an automaticly “Assign existing Materials-Function” , please ?
It´s annoying again and again fix material, material.001, material.002, material.003 …
Thanks.
With the help of Calli (the autor of the german Blenderbook “Das Blender-Buch”) I expandet the script with a checkbox-option “Use Blender-Materials”.
It works pretty well and covers all my needs now.
I hope it does for you as well
Just overwrite the two files in the …\Blender Foundation\Blender\2.61\scripts\addons\io_scene_obj with the ones in the attached Zipfile.
I’ve only tested it for Window.
Edit:
See the Post below for the update of the Script, this one here does not work anymore.
Alain, very, very thanks. It works perfectly, will save a lot of my time.
I have blank file with tens of my tuned materials and I often import into this file objects with tens of materials. These materials have the same name and with this patch they are immediately assigned according its name…
A couple of second after import, I can render with tuned materials. It is fantastic, could be in trunk, i think.
Again, thanks.