void trackFilter_AddTrackItem(string name, Object trackUserObject) { ShowPropSubActionPrototype actionPrototype = (ShowPropSubActionPrototype)trackUserObject; ShowPropSubAction subAction = actionPrototype.createSubAction(); subAction.StartTime = timelineView.MarkerTime; if (subAction is MovePropAction) { //This is a bit hacky, but if the action is a MovePropAction grab the //current location and set that for the move position. //This makes editing easier. MovePropAction moveProp = (MovePropAction)subAction; if (timelineView.CurrentData != null && timelineView.CurrentData.Track == "Move") { MovePropAction currentMoveProp = (MovePropAction)((PropTimelineData)timelineView.CurrentData).Action; moveProp.Translation = currentMoveProp.Translation; moveProp.Rotation = currentMoveProp.Rotation; } else { moveProp.Translation = propData.Translation; moveProp.Rotation = propData.Rotation; } } propData.addSubAction(subAction); }
/// <summary> /// Add the actions from the container to the timeline. This will NOT /// create copies of the actions and relies on the clipboard to do this. /// </summary> /// <param name="propData"></param> /// <param name="propTimeline"></param> /// <param name="markerTime"></param> /// <param name="totalDuration"></param> public void addActionsToTimeline(ShowPropAction propData, PropTimeline propTimeline, float markerTime, float totalDuration) { foreach (ShowPropSubAction copiedAction in copiedActions) { copiedAction.StartTime = copiedAction.StartTime - startTimeZeroOffset + markerTime; if (copiedAction.EndTime > totalDuration) { copiedAction.StartTime -= (copiedAction.EndTime - totalDuration); if (copiedAction.StartTime < 0) { copiedAction.StartTime = 0.0f; copiedAction.Duration = totalDuration; } } propData.addSubAction(copiedAction); } }