Skip to content
Snippets Groups Projects
Commit 10b87258 authored by Mark Winter's avatar Mark Winter
Browse files

Moved handling of "user" changelabel errors out. ChangeLabel done through the...

Moved handling of "user" changelabel errors out. ChangeLabel done through the edit action always completes successfully or throws an error. This makes sure that the graph edits only get set when the change works.
parent 3b35a7c7
Branches
Tags
No related merge requests found
......@@ -40,6 +40,17 @@ function ContextChangeLabel(time,trackID)
end
curHull = CellTracks(newTrackID).hulls(1);
if ( newTrackID == trackID )
warndlg('New label is the same as the current label.');
return;
end
if ( time < CellTracks(newTrackID).startTime )
warn = sprintf('Cannot change label from %d to %d, track %d does not exist until frame %d.',trackID, newTrackID,newTrackID, CellTracks(newTrackID).startTime);
warndlg(warn);
return
end
bErr = Editor.ReplayableEditAction(@Editor.ChangeLabelAction, trackID,newTrackID,time);
if ( bErr )
return;
......
......@@ -6,19 +6,16 @@
% ChangeLog:
% EW 6/7/12 created
function droppedTracks = ChangeLabel(currentTrack, desiredTrack, time)
function [droppedTracks bErr] = ChangeLabel(currentTrack, desiredTrack, time)
global CellTracks
bErr = 1;
droppedTracks = [];
if (~exist('time','var'))
time = CellTracks(currentTrack).startTime;
end
if (time<CellTracks(desiredTrack).startTime)
return
end
children = CellTracks(currentTrack).childrenTracks;
%Pass the work off to the lower function
......@@ -29,4 +26,6 @@ if(length(intersect(droppedTracks,children))==2)
Families.ReconnectParentWithChildren(desiredTrack,children);
droppedTracks = setdiff(droppedTracks,children);
end
bErr = 0;
end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment