Identify Tcl Commands
---------------------

.open_project [-working] <project path>

  Opens the given project file.  If -working is specified, then a window
  appears indicating that the project is being opened while this command
  is running.


.set_project_opened_proc <proc>

  Makes it where the given <proc> will be called whenever a project is opened.
  If <proc> is an empty string, then no proc will be called instead.


.set_marked_frames_changed_proc <proc>
  Makes it where the given <proc> will be called whenever the marked frames
  change.  If <proc> is an empty string, then no proc will be called instead.


.save_project [<project path>]

  Saves the current project.  If the project path is given, then the project
  is saved there, otherwise it is saved to the current location.


.project_file_name

  Returns the full path of the current project.  If there is no current path,
  an empty string is returned.


.save_raw_data [<.raw path>]

  Saves the raw data to the given path and changes the current raw data
  path in the project.

.save_glob_ids [<.gid path>]

  Saves the glob IDs to the given path and changes the current glob ids
  path in the project.

.add_tool <tool name> <Tcl command>

  Adds a push button to the Tools pulldown menu that will execute the
  given tcl command when the button is pressed.

  Parameters:

    <tool name>

      The label of the push button that will appear in the Tools pulldown.

      This can be of the form <menu1>|<menu2>|...|<name>, in which case
      a cascading menu is created where <name1> is a sub-menu of the Tools
      menu, <name2> is a sub-menu of <menu1>, etc., and finally <name> is
      the actual tool at the lowest level of the menu cascade.

    <Tcl command>

      The Tcl command that will be executed when the button is pressed.

  Examples:

    .add_tool "Print Project File Name" { puts [.project_file_name] }
    .add_tool "A|B|C" my_tool


.exit [-no_confirm] [<exit code>]

  Exits the application.

  If -no_confirm is given, the application will exit immediately, otherwise a
  window will pop up asking the user to confirm that they want to exit.

  If <exit code> is given, then the given code is returned to the parent
  process, otherwise 0 will be returned.

.set_current_frame <frame id>

.current_frame_id

.last_frame_id

.set_viewed_range <first frame id> <last frame id>

  Sets the viewed frame range on the frame scale.

.current_marker_id

.selected_marker_ids
  Returns the selected real or artificial marker IDs.  This does not include
  temps.

.set_selected_marker_ids_changed_proc <proc>

.select_marker_ids { <id> ... }
  Makes the given real or artificial marker IDs not be selected.  Temp markers
  are not considered.

.current_camera_id

.set_current_camera

.camera_ids

.selected_sysvar_ids

.sysvar_value <sysvar id>

.sysvar_name <sysvar id>

.set_sysvar_lower_limit <sysvar id> <value>

.set_sysvar_upper_limit <sysvar id> <value>

.set_sysvar_guide <sysvar id> <value>

.set_sysvar_lower_limit_weight <sysvar id> <value>
  If <value> is an empty string, then the weight is cleared.

.set_sysvar_upper_limit_weight <sysvar id> <value>
  If <value> is an empty string, then the weight is cleared.

.set_sysvar_guide_weight <sysvar id> <value>

.track_range [-active_marker_ids { <id> ... }] <first frame id> <last frame id>

.analyze_range <first frame id> <last frame id>

.delete_motion_range <first frame id> <last frame id>

.export_pattern_for_range <path> <first frame id> <last frame id>

  Generates a point pattern based on the given frame range and writes it
  to the given path.  <path> becomes the default point pattern for this
  project.

.set_first_marked_frame <frame id>

.set_last_marked_frame <frame id>

.first_marked_frame_id

.last_marked_frame_id

.frame_timecode <frame id>

.unid_globs_for_range <ids> <first frame id> <last frame_id>

  Unidentifies any globs in the given range with the given ids in all
  cameras.

.save_all_changes

  Saves any changes to files using their current name if there is one
  or using their default name if there is no current name.

.scale

.generate_all_locals -adjust_artificial_pairs <yes|no>

  Generates locals for all real markers.  Optionally also generates the locals
  of the artificial pairs.  Raises an error if the locals cannot be generated.

.save_scale [-generate_locals] [-overwrite] [-motion <path>] [-bodydef <path>]

  Saves all scaling files.

  If -generate_locals is given, then locals will be generated before saving,
  otherwise the current locals will be saved.

  If -overwrite is specified, then any existing files will be overwritten,
  otherwise if there is an existing file .save_scale will return an error.

  If -motion is given, then <path> will be used for the motion instead of the
  default.

  If -bodydef is given, then <path> will be used for the bodydef instead of the
  default.

.body_names [-root]
  Returns the body names of the loaded project's problem definition.

  If -root is given then only the root body names will be returned.

.hide_body_with_descendants <body name>
  Hide the body with the given name and hide all bodies below it in the
  hierarchy.

.unhide_body_with_descendants <body name>
  Unhide the body with the given name and unhide all bodies below it in the
  hierarchy.

.real_marker_ids
  Return a list of the real marker ids from the loaded project's problem
  definition.

.identified_point_positions [<options>]
  Returns a list of the identified point positions.

  The list entries are of the form:
    {
      <frame id>
      {<point id> {<x> <y> <z>}}
      {<point id> {<x> <y> <z>}}
      ...
    }

  Options:
    -frame_range <first> <last>
      If -frame_range is not given, then the current frame is used.
    -ids {<id1> <id2> ...}
      If -ids is not given, then all point IDs are considered.

  Notes:
    If a frame has motion, then the positions of points with only single-camera
    visibility will also be returned by using the motion and the local to
    estimate the position.  If a frame does not have motion, then the point
    must be visible in at least two cameras to be included.

.identified_point_cameras [-frame <frame id>] <point id>
  Returns a list of camera IDs that have globs labeled with the given point ID.

.identified_point_position <id>
  Returns the position of the point with the given id on the current frame.
  Returns an empty string if no point has the given id or if the point does not
  have a position.

.identified_point_positions_for_range <id> <first> <last>
  Returns a list of pairs of frame ids and 3D positions, i.e.
    {101 {1.5 2.5 3.5}} {103 {7.0 3.5 4.2}} ...

.unidentified_point_positions
  Returns a list of the positions of all unidentified points on the current
  frame.

.identify_point {<x> <y> <z>} <id>
  Sets the ID of the unidentified point closest to the given position.

.unidentify_point <id>
  Unidentifies the point with the given ID.

.decouple_unidentified_point {<x> <y> <z>}
  Disassociates the globs that make up the point at the given location, so
  that the point no longer exists.

.delete_unidentified_point_globs [-camera_ids {<id> ...}] {<x> <y> <z>}
  Deletes all globs associated with the unidentified point closest to the
  given coordinates.  If a list of camera ids are given, then only the
  globs in the given camera ids will be deleted.

.delete_identified_point_globs [<options>] <point id>
  Deletes all globs associated with point with the given ID.  If the
  -frame_range is not given, then it uses the current frame.

  Options:
    -frame_range <first> <last>
    -camera_ids { <id> ... }        Only delete globs in the given cameras.

.generate_points [-min_visibility <int>] [-max_point_error <float>]
  Generates unidentified points on the current frame.  If -min_visibility
  or -max_point_error are not specified, then the current defaults are used.
  An error is returned if there is no current calibration file.

.create_projected_globs [<options>] {<x> <y> <z>}
.create_projected_globs [<options>] { {<frame id> {<x> <y> <z>} } ... }
  Creates globs whose rays will go through the given <x> <y> <z> position.
  The globs will be considered a single point.
  The first form creates globs for the current frame only.
  The second form creates globs over multiple frames.

  Options:
    -camera_ids {<id> ...}   Only create globs in the given cameras
                             instead of in all cameras.
    -in_view_only            If a glob would not be visible in a camera,
                             ignore that camera instead of giving an
                             error.
    -marker_id <id>          Assign the given <id> to all created globs
                             instead of leaving them unidentified.
    -best_n_cameras <n>      Create globs in only the best n cameras.
                             Camera A is considered better than camera B
                             if the projected glob position in camera A
                             is closer to the center of the image.  An
                             error is given if fewer than <n> cameras can
                             be used unless the -in_view_only option is
                             also specified.

.unsaved_file_types
  Returns a list of file types that have changed since last loaded or saved.

.identified_point_exists <id>
  Returns 1 if there is a point on the current frame with the given ID.
  Returns 0 otherwise.

.current_point_position
  Returns the 3D position of the currently selected point.  If the currently
  selected point has no 3D position, then an empty string is return.  If
  there is no currently selected point, then an error is given.

.max_point_error
  Returns the current max point error.

.set_max_point_error <float>
  Sets the current max point error.  The value must be greater than zero.

.marker_radius
  Returns the current marker radius.

.set_marker_radius <float>
  Sets the current marker radius.  The value must not be negative.

.point_generation_min_visibility
  Returns the minimum number of rays needed to create points during
  automatic point generation.

.set_point_generation_min_visibility <int>
  Sets the minimum numbers of rays to use when creating points during
  automatic point generation.  This value must be at least two.

.auto_generate_state
  Returns 1 if the auto generate points is currently turned on.  Returns 0
  otherwise.

.set_auto_generate_state <bool>
  Sets the current auto generate state.  Points for the current frame will
  be generated if this is turned on and a calibration is loaded.

.set_rotation_handle_multiplier <float>
  The rotation speed of body rotation handles will be multiplied by the given
  value.

.create_additional_camera
  Returns an <additional camera> object that has it's own tcl commands.

<additional camera>.load_movie <path>
  Loads a background movie into the additional camera.

<additional camera>.has_background_movie
  Returns 1 or 0 indicating if the additional camera has a loaded background
  movie.

<additional camera>.has_background_images
  Returns 1 or 0 indicating if the additional camera has a loaded set of
  background images.

<additional camera>.set_frame_offset <offset>
<additional camera>.set_show_in_3d_background <bool>
<additional camera>.background_movie_path

.import_temporary_short_cuts <file>
  Temporarily overrides short cuts with those from a file.

.clear_temporary_short_cuts
  Restores the saved short cuts if they are overridden by imported temporary
  short cuts.

.export_wcam [<options>] <camera id> <path>
  Exports the given camera as a wcam file.
  Options:
    -default_image_region <left edge> <right edge> <top edge> <bottom edge>
      Use this image region for the camera if the calibration doesn't specify
      one.

.export_range_as_nuance_marker_paths [<options>]
  Exports all markers to a Nuance .mkr file as marker paths.
  Options:
    -path <path>           Write the .mkr file here instead of the default.
    -range <first> <last>  Write only the given range of frames instead of
                           all the frames.

.export_range_as_amc [<options>]
  Exports all markers as a .amc file
  Options:
    -path <path>                Write the .amc file here instead of the default.
    -point_geo_radius <radius>  Use the given radius for the marker geo instead
                                of the default.
    -length_units <units>       Use the given units instead of the default.
                                Valid units are "inches" and "centimeters".

.set_marker_local_key
  Adds or replaces a key for the selected marker local position to the current
  value on the current frame.

.set_marker_weight_key
  Adds or replaces a key for the selected marker weight to the current
  value on the current frame.

.set_sysvar_lower_limit_key
.set_sysvar_upper_limit_key
.set_sysvar_lower_limit_weight_key
.set_sysvar_upper_limit_weight_key
  These commands key the respective limit properties of the current sysvar.
  There is only a current sysvar if exactly one sysvar is selected.

.set_active_view <view>
  Changes the main window's active view tab. Valid view values are 2D or 3D.

.active_view
  Returns the main window's active view which can be either 2D or 3D.

.set_marked_body_color <color>

.set_custom_frame_range_auto_mark <bool>
  Enabled or disabled auto-marking for custom frame ranges.

.set_custom_frame_range_auto_mark_mode <mode>
  <mode> can be one of
  * selected_range
  * any_range
  * any_range_current_frame
  * selected_range_current_frame

.add_custom_frame_range [-name <name>] [-range <first> <last>]

.remove_custom_frame_ranges

.set_marked_body_auto_hide <bool>
  Enables or disables marked body auto-hiding.

.select_unidentified_point <position>
  Makes the unidentified point closest to the given position be selected.

.select_body <body name>
  Makes the body with the given name be the only selected body.

.selected_bodies
  Returns the names of all the selected bodies.

.add_marker
  Adds a marker at the position of the currently selected unidentified point.
  The new marker is added to the selected body.
  The point is labeled with the ID of the new marker.
  Returns the ID of the new marker.

.aim_at_selected_body
  Same as using the Aim At Selected Body Icon.  If no body is selected, then
  the aim does not change and there is no error.

.id_points_from_pattern
  Identifies any unidentified points using the currently loaded point pattern.

.marker_body_name <marker id>
  Returns the body that the marker is attached to.

.marker_distance <marker id>
  Returns the distance between the predicted and measured positions of the
  marker.


.marker_distances [<options>]
  Returns a list of the distances between the predicted and measured positions
  of markers.

  The list entries are of the form:
    {
      <frame id>
      {<point id> <distance>}
      {<point id> <distance>}
      ...
    }

  Options:
    -frame_range <first> <last>
      If -frame_range is not given, then the current frame is used.
    -ids {<id1> <id2> ...}
      If -ids is not given, then all point IDs are considered.


.marker_predicted_positions [<options>]
  Returns a list of the predicted positions of real markers.

  The list entries are of the form:
    {
      <frame id>
      {<marker id> <distance>}
      {<marker id> <distance>}
      ...
    }

  Options:
    -frame_range <first> <last>
      If -frame_range is not given, then the current frame is used.
    -ids {<id1> <id2> ...}
      If -ids is not given, then all real marker IDs are considered.


.open_keys_window

.open_additional_cameras_window

.set_max_guide_weight (<weight>|none)

.set_custom_tools_area_width <width>
  Sets the width of the area to the right of the camera buttons.

.undo

.redo

.identify_version
  Returns the version of the application as a list with this form:
    {<major> <minor> <patch>}
