Script for Surfaces Tab - Sort & Search all Surfaces in Scene

I am converting some older products over from 3Delight to Iray for my own purposes to better learn Iray and improve my own renders. With larger models such as Stonemason's Urban Sprawl 2: http://www.daz3d.com/urban-sprawl-2-the-big-city

The task is so daunting with this model without a search tool that I almost don't want to even start on it. Stonemason and other modelers tend to name all of their same or similar surfaces the same name such as "Bl_Window_Glass" or something like that. Since each building is its own object and each light pole is its own object, it becomes very difficult to grab all glass-related textures and give them all the same Iray preset of "Glass Solid."

So basically I want a way to either sort all of the textures across multiple objects alphabetically so I can find the duplicates or a way to do a search to limit the list of all surfaces so that I see only the one that contain the word "glass." Ignoring upper/lower case should be selectable on that search.

It would be nice if Daz Studio had this option, but I am not seeing one. So, I would gladly pay for a script that helped with sorting and searching through all surfaces in a scene to help with this type of selection.

Comments

  • Do the scripts linked in http://www.daz3d.com/forums/discussion/62783/#first work for you?

  • Thanks Richard,

    That does help more than my method of just scrolling through the textures one by one and finding ones with the word "Window" or "Glass" in it. It isn't as easy to use as a script with a GUI but it does work for me.

    However, I can't figure out how to get it to do partial matches. It seems to look for an exact match. So this becomes a problem with Urban Sprawl 2 in that Stonemason named each set of windows on buildings with names such as "WindowsE1", "WindowsE2", "WindowsA", "WindowsK", etc. So, if I can figure out how to make the script do a partial match just for "Windows" then it will save even more time. I know Javascript and Actionscript so I might be looking into that as an interim solution.

    Overall, though, I would buy a product with a GUI interface that perhaps even applies a shader preset and asks if I want to replace or ignore the textures and so on when applying the preset.

    Thanks again.

  • Ivo ShandorIvo Shandor Posts: 74
    edited October 2015
    // Change surface name here	var searchTerm = "Window";var nNodes = Scene.getNumNodes();for (var i=0; i < nNodes; i++) {	var oNode = Scene.getNode(i)	var oObj = oNode.getObject();	if (! oObj) continue;	var nShapes = oObj.getNumShapes();	for (var j=0; j < nShapes; j++) {		var oShape = oObj.getShape(j);		var nMat = oShape.getNumMaterials();		for (var k=0; k < nMat; k++) {			var oMat = oShape.getMaterial(k);			var sName = oMat.getName();								if (sName.search(searchTerm) != -1) {				oMat.select(true);			}		}	}}

     

    Sweet. I figured out how to change that script to do partial matches. This should make it way easier.

     

     

    Post edited by Ivo Shandor on
Sign In or Register to comment.