Exemple #1
0
 def save_geometry(self, session, flags):
     '''
     Return state for saving Model and Drawing geometry that can be restored
     with restore_geometry().
     '''
     from chimerax.graphics.gsession import DrawingState
     data = {
         'model state': Model.take_snapshot(self, session, flags),
         'drawing state': DrawingState.take_snapshot(self, session, flags),
         'version': 1
     }
     return data
 def take_snapshot(self, session, flags):
     from chimerax.graphics.gsession import DrawingState
     data = {}
     data['version'] = AtomicShapeDrawing.SESSION_VERSION
     data['drawing'] = DrawingState.take_snapshot(self, session, flags)
     data['shapes'] = list(
         (s.triangle_range, s.description, s.atoms) for s in self._shapes)
     data['selected'] = [
         i for i in range(len(self._shapes))
         if self._shapes[i] in self._selected_shapes
     ]
     return data
Exemple #3
0
 def take_snapshot(self, session, flags):
     p = self.parent
     if p is session.models.scene_root_model:
         p = None  # Don't include root as a parent since root is not saved.
     data = {
         'name': self.name,
         'id': self.id,
         'parent': p,
         'positions': self.positions.array(),
         'display_positions': self.display_positions,
         'allow_depth_cue': self.allow_depth_cue,
         'accept_shadow': self.accept_shadow,
         'accept_multishadow': self.accept_multishadow,
         'version': MODEL_STATE_VERSION,
     }
     if hasattr(self, 'clip_cap'):
         data['clip_cap'] = self.clip_cap
     if self.SESSION_SAVE_DRAWING:
         from chimerax.graphics.gsession import DrawingState
         data['drawing state'] = DrawingState.take_snapshot(
             self, session, flags, include_children=False)
     return data