diff --git a/cinema_python/adaptors/paraview/pv_introspect.py b/cinema_python/adaptors/paraview/pv_introspect.py index 6f3cad91c7f56fda0cfe6fb2becde42e8a95f700..ff12cd604826f2cef657a92b222473d1f7f5cb6e 100644 --- a/cinema_python/adaptors/paraview/pv_introspect.py +++ b/cinema_python/adaptors/paraview/pv_introspect.py @@ -530,7 +530,7 @@ def make_cinema_store(proxies, "color"+proxy_name, 'vis', [proxy_name]) fnp = "" - if forcetime: + if forcetime is not False: # time specified, use it, being careful to append if already a list tvalues.append(forcetime) tprop = store.make_parameter('time', tvalues) @@ -809,6 +809,8 @@ def explore(cs, proxies, iSave=True, currentTime=None, userDefined={}, at = project_to_at(eye, _fp, _cr) up = [x for x in view_proxy.CameraViewUp] times = paraview.simple.GetAnimationScene().TimeKeeper.TimestepValues + if currentTime: + times = False cam = paraview.simple.GetActiveCamera() @@ -835,7 +837,11 @@ def explore(cs, proxies, iSave=True, currentTime=None, userDefined={}, nearfar_values.append([x for x in cam.GetClippingRange()]) viewangle_values.append(cam.GetViewAngle()) except (KeyError): - pass + eye_values.append([x for x in eye]) + at_values.append([x for x in at]) + up_values.append([x for x in up]) + nearfar_values.append([x for x in cam.GetClippingRange()]) + viewangle_values.append(cam.GetViewAngle()) cs.add_metadata({'camera_eye': eye_values}) cs.add_metadata({'camera_at': at_values}) cs.add_metadata({'camera_up': up_values}) @@ -865,6 +871,8 @@ def explore(cs, proxies, iSave=True, currentTime=None, userDefined={}, update_all_ranges(cs, arrayRanges) explo.explore({'time': float_limiter(t)}, progressObject) + return cs.get_new_files() + def explore_customized_array_selection( sourceName, source, colorList, userDefined, disableValues): @@ -912,7 +920,7 @@ def explore_customized_array_selection( return numVals -def export_scene(baseDirName, viewSelection, trackSelection, arraySelection): +def export_scene(baseDirName, viewSelection, trackSelection, arraySelection, forcetime=False): ''' This explores a set of user-defined views and tracks. export_scene is called from vtkCinemaExport. The expected order of parameters is as @@ -947,6 +955,7 @@ def export_scene(baseDirName, viewSelection, trackSelection, arraySelection): atLeastOneViewExported = False cinema_dirs = [] + new_files = {} for viewName, viewParams in viewSelection.iteritems(): extension = os.path.splitext(viewParams[0])[1] @@ -1008,7 +1017,7 @@ def export_scene(baseDirName, viewSelection, trackSelection, arraySelection): arrayRanges = {} disableValues = cinemaParams.get('noValues', False) - cs = make_cinema_store(p, filePath, view, forcetime=False, + cs = make_cinema_store(p, filePath, view, forcetime=forcetime, userDefined=userDefValues, specLevel=specLevel, camType=camType, @@ -1022,7 +1031,12 @@ def export_scene(baseDirName, viewSelection, trackSelection, arraySelection): progObj = progress.ProgressObject() progObj.StartEvent() - explore(cs, p, iSave=(pid == 0), userDefined=userDefValues, + currentTime = None + if forcetime is not False: + currentTime = {'time':forcetime} + explore(cs, p, iSave=(pid == 0), + currentTime=currentTime, + userDefined=userDefValues, specLevel=specLevel, camType=camType, tracking=tracking_def, floatValues=enableFloatVal, @@ -1030,6 +1044,8 @@ def export_scene(baseDirName, viewSelection, trackSelection, arraySelection): progressObject=progObj) progObj.EndEvent() + new_files[viewName] = cs.get_new_files() + view.LockBounds = 0 if pid == 0: @@ -1045,7 +1061,7 @@ def export_scene(baseDirName, viewSelection, trackSelection, arraySelection): # restore initial state paraview.simple.SetActiveView(initialView) restore_visibility(pvstate) - print ("Finished exporting Cinema database!") + return new_files def prepare_selection(trackSelection, arraySelection): @@ -1122,7 +1138,7 @@ def make_workspace_file(basedirname, cinema_dirs): pm = paraview.servermanager.vtkProcessModule.GetProcessModule() pid = pm.GetPartitionId() if len(cinema_dirs) > 1 and pid == 0: - workspace = open(basedirname + '/info.json', 'w') + workspace = open(basedirname + 'info.json', 'w') workspace.write('{\n') workspace.write(' "metadata": {\n') workspace.write(' "type": "workbench"\n') diff --git a/cinema_python/database/file_store.py b/cinema_python/database/file_store.py index acd1a058629f75668c71ade6de19a44d33597c4b..86f796f1497ec16273f23ee94890c260d3794bfe 100644 --- a/cinema_python/database/file_store.py +++ b/cinema_python/database/file_store.py @@ -27,6 +27,7 @@ class FileStore(store.Store): self.cached_searches = {} self.cached_files = {} self.metadata = {} + self.__new_files = [] def create(self): """creates a new file store""" @@ -188,6 +189,9 @@ class FileStore(store.Store): super(FileStore, self).insert(document) fname = self._get_filename(document.descriptor, readingFile=False) + if not os.path.exists(fname): + self.__new_files.append((document.descriptor,fname)) + dirname = os.path.dirname(fname) if not os.path.exists(dirname): # In batch mode '-sym', the dir might be created by a different @@ -313,3 +317,6 @@ class FileStore(store.Store): """ optimization of find()[0] for an important case where caller knows exactly what to retrieve.""" return self._load_data(q) + + def get_new_files(self): + return self.__new_files