I gave it a quick look. I don't know if changing the export_obj.py script in Blender, for such a specific case, would be the right thing to do. After all if C4D cannot edit the associated material that seems like a bug to me.
One thing that can be done, and it's the fastest to implement, is to use Perl's in-place editing. If you are unfamiliar with that, it's a neat little trick of Perl that allows you to edit a file with a replacement expression from the command line. When you use it, Perl scans the file, applies the substitution, creates a backup copy of the original file and updates the file on disk. All with a one-liner. Pretty p[powerful stuff.
For example, in the .obj file materials are defined with the "usemtl name" statement, where "name" is the name of the material. We can automatically get rid of that by using this from the command line:
perl -i.bak -p -e 's/^usemtl\s+.+//' test.obj
Of course you would replace "test.obj" with the name of the file that you want to change. The result is that you will have a new test.obj without the material defined. At that point you can load it in C4D and continue from there. The expression inside is interepreted as:
- Starting at the beginning of the line (the ^)
- Check if there's a string as "usemtl"
- followed by one or more spaces (\s+)
- followed by any number of other characters (.+)
- If so, then replace it with nothing (//)
If you have multiple files, like in the scenario that you have described, simply change the file expression to include wildcards:
perl -i.bak -p -e 's/^usemtl\s+.+//' test*.obj
This will work on any unix-like OS like Linux and Mac OS, no idea how Windows treats wildcard or if it supports that feature at all. If it doesn't you might want to resort to use some batch file or install a copy of a shell program like bash.
One word of advice, Perl will apply the changes without asking you for anything. It assumes that you know what you're doing. If you have a typo, or anything that matches different file there will not be any "Are you sure ?" prompt. So, be sure that you use this inside a dedicated subdirectory, where all your OBJS, and only the OBJS, are saves. Be sure that that subdir is the active dir and double check your syntax. I am, as always, not responsible for possible damage caused by using the above commands.
Cheers.
--
Paolo Ciccone
Pret-A-3D
http://www.preta3d.com
http://www.paolociccone.com