Is there a Script that can quickly switch textures between channels in materials?
Hello everyone,
I'm sorry if I posted this in the wrong forum but i believe this may be the correct one. I had posted in a previous post asking about how the obj importer looked for tags that worked with "normal" maps. In DAZ once imported it places the normal maps into the bump channel and I have been looking around for a script that can move that texture from the bump channel to the normal channel than move to the next material and loop in one click. Ofcourse this is easily done by hand but when there are dozens of materials from importing an obj custom enviorment and props it becomes dreadful. If said script does not already exist is it possible to commission someone to create it?
I never really did well in my coding classes in college but imagine the thought process would be something like this:
0 - User selects mesh than runs script
1 - Script selects first material
2 - It access "bump"channel; - If "bump" is empty it skips to step 7
3 - It copies "bump" texture's file path
4 - It clears "bump" texture's file path from "bump" channel
5 - It access "normal" channel
6 - It paste the "bump" texture's file path into the "normal" channel
7 - It moves to the next material on the mesh; - If no next material it ends the script
8 - Loop starting at step 2
Thanks for taking the time to read this lengthy post and hopefully this post's responses can also help those that are searching for a similar script.
Comments
This demonstrates gettign materials http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/material/deep_copy/start and this is the base object for materials, though it doesn't acess bump or normal so you would need to look at the derived objects to get them http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/material_dz
Just a thought, this looks like the .mat files is setup wrong. Wouldn't it be easier to edit the .mat files before you import the objs?
Documentation is always a nice thing to have. As for the .mat that comes with the obj I had the same thought and tried several tags hopingg that it would actually put the normal map into the correct channel. But it always either put it into the bump channel or no channel at all. In my previous post I had hope that someone had the tags that DAZ looked for when assigning the textures to the imported obj file. But from the response I had seen it seems that DAZ did not have one. Here was my original post about it.
https://www.daz3d.com/forums/discussion/652516/what-string-keywords-tags-does-the-obj-importer-look-for-in-daz#latest
Do you happen to know if there is a tag that is linked to the actual normal channel?