Help: solution for collecting ALL maps from a DS4 scene ?

Hello

here is my problem: I want to gather ALL textures used in my DS4 scene (I use an external renderer).

Export obj with "collect maps" option doesn't gather all of them (normal,..) may be because of the node configuration.

Do you know if there solution to do it (script? , tool ?,...)  In Poser there was a script "collect scene inventory " if I remember well. I didn't found the equivalent for DS4  

Thanks for your help

Comments

  • alembic has an option that does but that plugin is rather pricey 

    I use it sometimes with Octane but you still need to load all the maps

    FBX grabs a few more maps than obj

  • You can try the script below.  It's quick and dirty but appears to work, at least on Windows using DS4.12.

    Change line 8 to enter the path to the folder you want to copy the images to before you run it.  Don't put a '/' at the end.  It should find all the images textures used in the current scene and copy them to the folder specified.

    const aNodes = Scene.getNodeList();var allImgs = [];var uniqueImgs;var imgMgr = App.getImageMgr();var oSettings = new DzFileIOSettings();// Path to copy images tovar saveImgPath = 'C:/Users/You/Pictures/Dump'function processNode(node) {		var obj = node.getObject();	if (obj) {		//print("Node", node.name, "Object", obj.name);				var shape = obj.getCurrentShape();		if (shape) {						var aMaterials = shape.getAllMaterials();			print("Shape ", shape.name);			print("Num materials ", shape.getNumMaterials());			aMaterials.forEach(				function(mat) 				{ 					//print(mat.name)					// Collect images for this 'material'					var aMaps = mat.getAllMaps();					var aMatImgs = aMaps.map(						function(m) {							return m.getFilename()						}					);										// Add images for this material to all images array					var aTmpImgs = allImgs;					allImgs = aTmpImgs.concat(aMatImgs);				}				);							// Strip out dupes			var uniqueImgs = allImgs.filter(				function(v, i, self) {					return self.indexOf(v) === i;				}			);						// Copy each unique image file to the save path			uniqueImgs.forEach(				function(i) {					 print("Image filename: ", i);					 var img = imgMgr.findImage(i);					 var imgFile = new DzFile(i);					 rtn = imgFile.copy([saveImgPath, '/', i.split('/').pop()].join(''));					 if (rtn) {					 	print("File copied");					 } else {						 print("File copy failed!");					 }				}			);		}	}}aNodes.forEach(processNode);

     

  • smaker1smaker1 Posts: 281

    Thanks to you !!

    I'm gonna try both idea ! Not a tech guy but I though a script could be the solution.

    Thanks again and,as soon as possible, I'll give you feedback

  • smaker1smaker1 Posts: 281

    Hello again

    Andya: your script is perfect ! I made a test with a scene:

    - Abc export : 30 textures copied (no normals)

    - Obj export : 40 textures (no normals)

    - Script :  105 textures !! (normals)

    Many thanks for your help ! Happy I am to have a solution :-) !

  • I need this same thing. How do you run this script in DAZ?

  • smaker1smaker1 Posts: 281

    Open the tab Script IDE (if I remember well) , copy the script in the window, change line 8 to where you want the texture to be saved, then execute the script and you'll see in the log all copied textures 

    You can also save the script for futur use in your script folder. If you run it from the scripts folder, it's so quick that it seems that nothing happened but textures are copied.

     

  • Thank you for this Andy, it's a real time saver.

    A quick heads up for anyone that's having problems - if you copy and paste your path from elsewhere it may change the forward slash to a backslash and the script will fail. Just make sure the path has forward slashes in it

  • RobinsonRobinson Posts: 751

    Thanks for this Andy.  Very useful.

  • vukiolvukiol Posts: 66

    This is perfect! Thank you andya! <3

  • sofaxsofax Posts: 37

    I wrote a script that collects all the maps referenced by the currently selected node, stores them in a user-selected folder and then reassigns the node's maps to the new location. 

    I've only tested it on a private product I'm working on, and it's my very first DAZ script ever, so there _might_ be an easier solution, but it works fine for me. :)

     

    dse
    dse
    CollectAllMaps.dse
    3K
  • marcelocaparozmarcelocaparoz Posts: 7
    edited July 2021

    sofax said:

    I wrote a script that collects all the maps referenced by the currently selected node, stores them in a user-selected folder and then reassigns the node's maps to the new location. 

    I've only tested it on a private product I'm working on, and it's my very first DAZ script ever, so there _might_ be an easier solution, but it works fine for me. :)

    sofax, thanks for your contribution, it's perfect!
    I tested it on Daz 4.15, on Gen 3, 8 and 8.1, it works perfectly without any errors!
    What I liked the most was that I was making some clothes at Marvelous, and I always had to copy the textures and set them manually, now with your script, in a single click, everything is ready!
    Thank you very much!

    Post edited by Richard Haseltine on
  • romboutvromboutv Posts: 3

    Thanks both guys for make these script. Much appreciated! Very helpfor when doing obj or fbx exports

  • sofax said:

    I wrote a script that collects all the maps referenced by the currently selected node, stores them in a user-selected folder and then reassigns the node's maps to the new location. 

    I've only tested it on a private product I'm working on, and it's my very first DAZ script ever, so there _might_ be an easier solution, but it works fine for me. :)

    Thank you for sharing your script! It works perfectly! :D

  • Is not working for 4.16 or i'm doing something wrong, testing copying manual scripting and the script download that they provide :( 

  • barbultbarbult Posts: 24,240

    There is a commercial product that may fit your needs, too.

    Maps Copier Gatherer Renamer

  • sofax said:

    I wrote a script that collects all the maps referenced by the currently selected node, stores them in a user-selected folder and then reassigns the node's maps to the new location. 

    I've only tested it on a private product I'm working on, and it's my very first DAZ script ever, so there _might_ be an easier solution, but it works fine for me. :)

    I just wanted to thank you for this. It still works in Daz Studio 4.21.0.5 (Mac) and was a real time-saver.

Sign In or Register to comment.