parameters: (self)
docstring: Toggle the display of the key frames preview
docstring_summary: Toggle the display of the key frames preview
docstring_tokens: Toggle the display of the key frames preview
function: def toggle_key_frames(self) -> None:
          """
          Toggle the display of the key frames preview
          """
          if not self.motion:
              logger.error("Error: a motion is not loaded")
              return
  
          if (
              self.preview_mode in [Preview.KEYFRAMES, Preview.ALL]
              and not self.key_frame_models
          ):
              data = self.user_metadata
  
              for k in self.key_frames:
  
                  self.key_frame_models.append(
                      self.art_obj_mgr.add_articulated_object_from_urdf(
                          filepath=data["urdf_path"], fixed_base=True
                      )
                  )
  
                  (
                      new_pose,
                      new_root_translate,
                      new_root_rotation,
                  ) = self.convert_CMUamass_single_pose(k, self.key_frame_models[LAST])
  
                  self.key_frame_models[LAST].motion_type = phy.MotionType.KINEMATIC
                  self.key_frame_models[LAST].joint_positions = new_pose
                  self.key_frame_models[LAST].rotation = new_root_rotation
                  self.key_frame_models[LAST].translation = new_root_translate
  
          elif self.key_frame_models:
              for m in self.key_frame_models:
                  # removes key frames
                  self.art_obj_mgr.remove_object_by_handle(m.handle)
              self.key_frame_models = []
function_tokens: def toggle_key_frames ( self ) -> None : if not self . motion : logger . error ( "Error: a motion is not loaded" ) return if ( self . preview_mode in [ Preview . KEYFRAMES , Preview . ALL ] and not self . key_frame_models ) : data = self . user_metadata for k in self . key_frames : self . key_frame_models . append ( self . art_obj_mgr . add_articulated_object_from_urdf ( filepath = data [ "urdf_path" ] , fixed_base = True ) ) ( new_pose , new_root_translate , new_root_rotation , ) = self . convert_CMUamass_single_pose ( k , self . key_frame_models [ LAST ] ) self . key_frame_models [ LAST ] . motion_type = phy . MotionType . KINEMATIC self . key_frame_models [ LAST ] . joint_positions = new_pose self . key_frame_models [ LAST ] . rotation = new_root_rotation self . key_frame_models [ LAST ] . translation = new_root_translate elif self . key_frame_models : for m in self . key_frame_models : # removes key frames self . art_obj_mgr . remove_object_by_handle ( m . handle ) self . key_frame_models = [ ]