Hi there,
I used to automate tasks in touchdesigner and still do,
usually i create loop in python script that change parameters, doing pulses and force cook the nodes each cycle of the loop.
But this time,
I try to loop over paths in folder DAT, the path are part of other blender
process i run each loop.
I cant make the automation work, it always stop after the first time.
any ideas ?
the loop :
[code]folderOBJs = op(‘OBJs’)
animateMachine = op(‘animateMachine’)
objectPath = op(‘objectPath’)
numOBJs = folderOBJs.numRows - 1
print ("Number of objs detected : ",numOBJs)
for path in folderOBJs.rows()[1:] :
objPath = path[0]
animateMachine.par.Rawmodel = objPath
animateMachine.par.Run.pulse()[/code]
the process:
[code]
def onPulse(par):
#acquire paths
scriptFile = str(parent().par.Script)
rawModel = str(parent().par.Rawmodel)
animationFile = str(parent().par.Animationfile)
outputModel = str(parent().par.Outputmodel)
print(scriptFile)
print(rawModel)
print(animationFile)
print(outputModel)
directory = str( os.path.dirname(rawModel)+"/out" )
if not os.path.exists(directory):
os.makedirs(directory)
file_name = rawModel.replace(".obj",".fbx")
outputModel = directory + file_name[file_name.rfind('/'):]
print (outputModel)
process = Popen(
[
r'C:\Program Files\Blender Foundation\Blender\blender.exe',
'--background',
'--python',
scriptFile,
rawModel,
animationFile,
outputModel
],
stdout=PIPE, stderr=PIPE
)
stdout, stderr = process.communicate()
directory = str( os.path.dirname(rawModel)+"/finish" )
if not os.path.exists(directory):
os.makedirs(directory)
print (directory)
print(rawModel, directory + rawModel[rawModel.rfind('/'):])
os.rename(rawModel, directory + rawModel[rawModel.rfind('/'):])
return[/code]