I’ve just done a few tutorials with Wrap and I’m quite impressed. Not only have you succeeded to create great wrapping results, the ui of wrap is very clear too.
I’m working with series of scans and wrapping with the batch feature would be great. In the tutorials you use pound characters to create unique filenames. E.g. “output###.obj” becomes “output001.obj”, “output002.obj” and so on. Are there more symbols available? In my workflow I’m more interested in the original filename of the scan. For instance “$_output.obj” would become “scanFilename_output.obj”. In this case the dollar character is replaced by the original filename of the scan.
In my workflow that would save me lots of work.
Thank you! That will be available later when we implement Python scripting for node parameters.
Thanks Andrew, looking forward to it.
+1 for that function.
I’m doing a set a blendshapes and renaming one by one isn’t as much fun as I thought it would be.
+1 !!! ![]()
I know, I know guys! Will do!
+1 to this one
I found a solution for batching and renaming filenames of objs using python. Sick of the pesky obj###? Check this out. It’s not pretty code but hopefully understandable for anyone looking for an answer. This code was made specifically for batch replacing geometry given a polygroup.txt file and keeping the file names of objs. The code assumes that you have saved inside a directory the following: (a python file, a windows batch file, a wrap file with the nodes set up, a polygroup.txt file, a source obj, a folder containing all the objs to batch). The code looks at all the objs inside the folder and runs wrap individually for each. The python code edits the wrap file outputs and then uses the subprocess command to call the batch file and run the edited wrap file. You just have to run the python script.
—PYTHON CODE—
import json
import sys
import os
import subprocess
import glob
#get filename directories to replace in wrap file
cwd = os.getcwd()
batchList = glob.glob(‘*.bat’)
batchPath = cwd + “\” + batchList[0]
wrapList = glob.glob(‘*.wrap’)
wrapPath = cwd + “\” + wrapList[0]
polyList = glob.glob(‘*.txt’)
polyPath = cwd + “\” + polyList[0]
polyPathNew = str(polyPath)
origObjList = glob.glob(‘*.obj’)
origObj = cwd + “\” + origObjList[0]
#create list of subdirectory paths (all folders containing objs)
subdirs =
cwdContents = os.listdir(cwd)
for item in cwdContents:
if os.path.isdir(item):
path = cwd + “\” + item
subdirs.append(path)
#create list of objs from each subdirectory
objList =
pathsList =
for folder in subdirs:
os.chdir(folder)
myObj = glob.glob(‘*.obj’)
for obj in myObj:
objList.append(obj)
pathsList.append(folder)
#change wrap file information for each obj
for num, obj in enumerate(objList):
change = pathsList[num] + “\” + obj
save = pathsList[num] + “\” + “completed” + “\” + os.path.splitext(obj)[0] + “_replaced.obj”
saveNew = str(save)
f = open(wrapPath, ‘r’)
project = json.loads(f.read())
project[‘nodes’][‘GeomToChange’][‘params’][‘fileNames’][‘value’] = [change]
project[‘nodes’][‘GeomToCopy’][‘params’][‘fileNames’][‘value’] = [origObj]
project[‘nodes’][‘SaveGeom’][‘params’][‘fileName’][‘value’] = save
project[‘nodes’][‘SelectPolygons’][‘params’][‘fileName’][‘value’] = polyPath
f.close()
f = open(wrapPath, ‘w’)
f.write(json.dumps(project))
f.close()
#run wrap for each obj
subprocess.call([batchPath, obj])
print ("SAVED NEW OBJ: " + save)
input(‘Press ENTER to exit’)
—BATCH CODE—
C:
cd C:\Program Files\R3DS\Wrap 3.4
start Wrap3.exe
wrap3cmd compute “C:\replaceTest.wrap” -s 0 -e 0
Thank you for sharing the script!
Meanwhile Wrap3.4.17 with python scripting for parameters will be available as beta version the next week.