def add_exports(self):
outfiles = set()
for d in self.new_exports:
logger.debug("Adding new export.")
should_terminate = Value(c_bool, False)
frames_to_export = Value(c_int, 0)
current_frame = Value(c_int, 0)
start_frame = None
end_frame = None
export_dir = d
user_dir = self.g_pool.user_dir
# we need to know the timestamps of our exports.
try: # 0.4
frames_to_export.value = len(np.load(os.path.join(export_dir, 'world_timestamps.npy')))
except: # <0.4
frames_to_export.value = len(np.load(os.path.join(export_dir, 'timestamps.npy')))
# Here we make clones of every plugin that supports it.
# So it runs in the current config when we lauch the exporter.
plugins = self.g_pool.plugins.get_initializers()
# make a unique name created from rec_session and dir name
rec_session, rec_dir = export_dir.rsplit(os.path.sep, 2)[1:]
out_name = rec_session+"_"+rec_dir+".mp4"
out_file_path = os.path.join(self.destination_dir, out_name)
if out_file_path in outfiles:
logger.error("This export setting would try to save {} at least twice please rename dirs to prevent this. Skipping File".format(out_file_path))
else:
outfiles.add(out_file_path)
logger.info("Exporting to: {}".format(out_file_path))
process = Export_Process(target=export, args=(should_terminate, frames_to_export, current_frame,
export_dir, user_dir, self.g_pool.min_data_confidence,
start_frame, end_frame, plugins, out_file_path))
self.exports.append(process)
评论列表
文章目录