private void MigrateLipSyncFrom5To6(XElement content) { //This migration deals with changing the LipSync matrix elements from version 4 to 5 //Get the standard namespaces that are needed in the sequence var namespaces = GetStandardNamespaces(); //Add in the ones for this effect XNamespace d2p1 = "http://schemas.datacontract.org/2004/07/VixenModules.Effect.LipSync"; namespaces.AddNamespace("d2p1", d2p1.NamespaceName); //Find the Chase effects. IEnumerable <XElement> lipSyncElements = content.XPathSelectElements( "_dataModels/d1p1:anyType[@i:type = 'd2p1:LipSyncData']", namespaces); var datamodel = content.XPathSelectElement("_dataModels", namespaces); LipSyncMapLibrary library = ApplicationServices.Get <IAppModuleInstance>(LipSyncMapDescriptor.ModuleID) as LipSyncMapLibrary; if (library != null) { foreach (var lipSyncElement in lipSyncElements.ToList()) { LipSyncMapData mapData; var lipSyncData = DeSerializer <LipSyncData>(lipSyncElement); if (library.Library.TryGetValue(lipSyncData.PhonemeMapping, out mapData)) { if (!mapData.IsMatrix) { lipSyncData.MappingType = MappingType.FaceDefinition; } } else { lipSyncData.MappingType = MappingType.FaceDefinition; } //Remove the old version lipSyncElement.Remove(); //Build up a temporary container similar to the way sequences are stored to //make all the namespace prefixes line up. IModuleDataModel[] dm = { lipSyncData }; DataContainer dc = new DataContainer { _dataModels = dm }; //Serialize the object into a xelement XElement glp = Serializer(dc, new[] { typeof(LipSyncData), typeof(IModuleDataModel[]), typeof(DataContainer) }); //Extract the new data model that we want and insert it in the tree datamodel.Add(glp.XPathSelectElement("//*[local-name()='anyType']", namespaces)); } } }
public LipSyncEditorControl() { InitializeComponent(); imageListView.View = View.LargeIcon; imageListView.LabelEdit = false; imageListView.AllowColumnReorder = false; imageListView.CheckBoxes = false; imageListView.FullRowSelect = false; imageListView.GridLines = false; imageListView.Sorting = SortOrder.Ascending; imageListView.MultiSelect = false; imageListView.HideSelection = false; imageList1.ImageSize = new Size(48,48); _library = ApplicationServices.Get<IAppModuleInstance>(LipSyncMapDescriptor.ModuleID) as LipSyncMapLibrary; foreach (LipSyncMapData data in _library.Library.Values) { mappingComboBox.Items.Add(data.ToString()); } LoadResourceBitmaps(); }
public LipSyncEditorControl() { InitializeComponent(); imageListView.View = View.LargeIcon; imageListView.LabelEdit = false; imageListView.AllowColumnReorder = false; imageListView.CheckBoxes = false; imageListView.FullRowSelect = false; imageListView.GridLines = false; imageListView.Sorting = SortOrder.Ascending; imageListView.MultiSelect = false; imageListView.HideSelection = false; imageList1.ImageSize = new Size(48, 48); _library = ApplicationServices.Get <IAppModuleInstance>(LipSyncMapDescriptor.ModuleID) as LipSyncMapLibrary; foreach (LipSyncMapData data in _library.Library.Values) { mappingComboBox.Items.Add(data.ToString()); } LoadResourceBitmaps(); }
public LipSync() { _data = new LipSyncData(); LoadResourceBitmaps(); _library = ApplicationServices.Get <IAppModuleInstance>(LipSyncMapDescriptor.ModuleID) as LipSyncMapLibrary; }
private void TimedSequenceEditorForm_Load(object sender, EventArgs e) { settingsPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Vixen", "TimedSequenceEditorForm.xml"); ColorCollectionsPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Vixen", "ColorCollections.xml"); if (File.Exists(settingsPath)) { dockPanel.LoadFromXml(settingsPath, new DeserializeDockContent(DockingPanels_GetContentFromPersistString)); } else { GridForm.Show(dockPanel); ToolsForm.Show(dockPanel, DockState.DockLeft); MarksForm.Show(dockPanel, DockState.DockLeft); EffectsForm.Show(dockPanel, DockState.DockLeft); } XMLProfileSettings xml = new XMLProfileSettings(); //Get preferences _autoSaveTimer.Interval = xml.GetSetting(XMLProfileSettings.SettingType.Preferences, string.Format("{0}/AutoSaveInterval", Name), 300000); //Restore App Settings dockPanel.DockLeftPortion = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/DockLeftPortion", Name), 150); dockPanel.DockRightPortion = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/DockRightPortion", Name), 150); autoSaveToolStripMenuItem.Checked = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/AutoSaveEnabled", Name), true); toolStripButton_SnapTo.Checked = toolStripMenuItem_SnapTo.Checked = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/SnapToSelected", Name), true); PopulateSnapStrength(xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/SnapStrength", Name), 2)); toolStripMenuItem_ResizeIndicator.Checked = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/ResizeIndicatorEnabled", Name),false); toolStripButton_DrawMode.Checked = TimelineControl.grid.EnableDrawMode = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/DrawModeSelected", Name), false); toolStripButton_SelectionMode.Checked = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/SelectionModeSelected", Name), true); ToolsForm.LinkCurves = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/ToolPaletteLinkCurves", Name), false); ToolsForm.LinkGradients = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/ToolPaletteLinkGradients", Name), false); cADStyleSelectionBoxToolStripMenuItem.Checked = TimelineControl.grid.aCadStyleSelectionBox = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/CadStyleSelectionBox", Name), false); CheckRiColorMenuItem(xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/ResizeIndicatorColor", Name), "Red")); foreach (ToolStripItem toolStripItem in toolStripDropDownButton_SnapToStrength.DropDownItems) { var toolStripMenuItem = toolStripItem as ToolStripMenuItem; if (toolStripMenuItem != null) { if(TimelineControl.grid.SnapStrength.Equals(Convert.ToInt32(toolStripMenuItem.Tag))) { toolStripMenuItem.PerformClick(); break; } } } WindowState = FormWindowState.Normal; if (xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowState", Name), "Normal").Equals("Maximized")) { WindowState = FormWindowState.Maximized; } else { var desktopBounds = new Rectangle(new Point(xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowLocationX", Name), Location.X), xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowLocationY", Name), Location.Y)),new Size(xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowWidth", Name), Size.Width), xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowHeight", Name), Size.Height))); if (IsVisibleOnAnyScreen(desktopBounds)) { DesktopBounds = desktopBounds; } } _effectNodeToElement = new Dictionary<EffectNode, Element>(); _elementNodeToRows = new Dictionary<ElementNode, List<Row>>(); TimelineControl.grid.RenderProgressChanged += OnRenderProgressChanged; TimelineControl.ElementChangedRows += ElementChangedRowsHandler; TimelineControl.ElementsMovedNew += timelineControl_ElementsMovedNew; TimelineControl.ElementDoubleClicked += ElementDoubleClickedHandler; TimelineControl.DataDropped += timelineControl_DataDropped; TimelineControl.ColorDropped += timelineControl_ColorDropped; TimelineControl.CurveDropped += timelineControl_CurveDropped; TimelineControl.GradientDropped += timelineControl_GradientDropped; TimelineControl.PlaybackCurrentTimeChanged += timelineControl_PlaybackCurrentTimeChanged; TimelineControl.RulerClicked += timelineControl_RulerClicked; TimelineControl.RulerBeginDragTimeRange += timelineControl_RulerBeginDragTimeRange; TimelineControl.RulerTimeRangeDragged += timelineControl_TimeRangeDragged; TimelineControl.MarkMoved += timelineControl_MarkMoved; TimelineControl.DeleteMark += timelineControl_DeleteMark; EffectsForm.EscapeDrawMode += EscapeDrawMode; MarksForm.MarkCollectionChecked += MarkCollection_Checked; MarksForm.EditMarkCollection += MarkCollection_Edit; MarksForm.ChangedMarkCollection += MarkCollection_Changed; ToolsForm.StartColorDrag += ToolPalette_ColorDrag; ToolsForm.StartCurveDrag += ToolPalette_CurveDrag; ToolsForm.StartGradientDrag += ToolPalette_GradientDrag; TimelineControl.SelectionChanged += TimelineControlOnSelectionChanged; TimelineControl.grid.MouseDown += TimelineControl_MouseDown; TimeLineSequenceClipboardContentsChanged += TimelineSequenceTimeLineSequenceClipboardContentsChanged; TimelineControl.CursorMoved += CursorMovedHandler; TimelineControl.ElementsSelected += timelineControl_ElementsSelected; TimelineControl.ContextSelected += timelineControl_ContextSelected; TimelineControl.SequenceLoading = false; TimelineControl.TimePerPixelChanged += TimelineControl_TimePerPixelChanged; TimelineControl.grid.SelectedElementsCloneDelegate = CloneElements; TimelineControl.grid.StartDrawMode += DrawElement; _virtualEffectLibrary = ApplicationServices.Get<IAppModuleInstance>(VirtualEffectLibraryDescriptor.Guid) as VirtualEffectLibrary; _curveLibrary = ApplicationServices.Get<IAppModuleInstance>(CurveLibraryDescriptor.ModuleID) as CurveLibrary; if (_curveLibrary != null) { _curveLibrary.CurveChanged += CurveLibrary_CurveChanged; } _colorGradientLibrary = ApplicationServices.Get<IAppModuleInstance>(ColorGradientLibraryDescriptor.ModuleID) as ColorGradientLibrary; if (_colorGradientLibrary != null) { _colorGradientLibrary.GradientChanged += ColorGradientLibrary_CurveChanged; } LoadAvailableEffects(); PopulateDragBoxFilterDropDown(); InitUndo(); updateButtonStates(); UpdatePasteMenuStates(); LoadVirtualEffects(); LoadColorCollections(); _library = ApplicationServices.Get<IAppModuleInstance>(LipSyncMapDescriptor.ModuleID) as LipSyncMapLibrary; #if DEBUG ToolStripButton b = new ToolStripButton("[Debug Break]"); b.Click += b_Click; toolStripOperations.Items.Add(b); #endif }
public LipSync() { _data = new LipSyncData(); LoadResourceBitmaps(); _library = ApplicationServices.Get<IAppModuleInstance>(LipSyncMapDescriptor.ModuleID) as LipSyncMapLibrary; }
private void TimedSequenceEditorForm_Load(object sender, EventArgs e) { _settingsPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Vixen", "TimedSequenceEditorForm.xml"); _colorCollectionsPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Vixen", "ColorCollections.xml"); if (File.Exists(_settingsPath)) { try { //Try to load the dock settings fro ma file. Somehow users manage to corrupt this file, so if it can be used //Then just reconfigure to the defaults. dockPanel.LoadFromXml(_settingsPath, DockingPanels_GetContentFromPersistString); } catch (Exception ex) { DestroyAndRecreateDockPanel(ex); } } else { SetDockDefaults(); } if (GridForm.IsHidden) { GridForm.DockState = DockState.Document; } if (EffectEditorForm.DockState == DockState.Unknown) { EffectEditorForm.Show(dockPanel, DockState.DockRight); } if (LayerEditor.DockState == DockState.Unknown) { LayerEditor.Show(dockPanel, DockState.DockRight); } XMLProfileSettings xml = new XMLProfileSettings(); //Get preferences _autoSaveTimer.Interval = xml.GetSetting(XMLProfileSettings.SettingType.Preferences, string.Format("{0}/AutoSaveInterval", Name), 300000); //Restore App Settings dockPanel.DockLeftPortion = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/DockLeftPortion", Name), 150); dockPanel.DockRightPortion = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/DockRightPortion", Name), 150); autoSaveToolStripMenuItem.Checked = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/AutoSaveEnabled", Name), true); toolStripButton_SnapTo.Checked = toolStripMenuItem_SnapTo.Checked = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/SnapToSelected", Name), true); PopulateSnapStrength(xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/SnapStrength", Name), 2)); TimelineControl.grid.CloseGap_Threshold = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/CloseGapThreshold", Name), ".100"); AlignTo_Threshold = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/AlignToThreshold", Name), ".800"); toolStripMenuItem_ResizeIndicator.Checked = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/ResizeIndicatorEnabled", Name), false); toolStripButton_DrawMode.Checked = TimelineControl.grid.EnableDrawMode = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/DrawModeSelected", Name), false); toolStripButton_SelectionMode.Checked = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/SelectionModeSelected", Name), true); ToolsForm.LinkCurves = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/ToolPaletteLinkCurves", Name), false); ToolsForm.LinkGradients = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/ToolPaletteLinkGradients", Name), false); cADStyleSelectionBoxToolStripMenuItem.Checked = TimelineControl.grid.aCadStyleSelectionBox = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/CadStyleSelectionBox", Name), false); CheckRiColorMenuItem(xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/ResizeIndicatorColor", Name), "Red")); zoomUnderMousePositionToolStripMenuItem.Checked = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/ZoomUnderMousePosition", Name), false); TimelineControl.waveform.Height = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WaveFormHeight", Name), 50); TimelineControl.ruler.Height = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/RulerHeight", Name), 50); foreach (ToolStripItem toolStripItem in toolStripDropDownButton_SnapToStrength.DropDownItems) { var toolStripMenuItem = toolStripItem as ToolStripMenuItem; if (toolStripMenuItem != null) { if (TimelineControl.grid.SnapStrength.Equals(Convert.ToInt32(toolStripMenuItem.Tag))) { toolStripMenuItem.PerformClick(); break; } } } foreach (ToolStripItem toolStripItem in toolStripSplitButton_CloseGaps.DropDownItems) { var toolStripMenuItem = toolStripItem as ToolStripMenuItem; if (toolStripMenuItem != null) { if (TimelineControl.grid.CloseGap_Threshold.Equals(toolStripMenuItem.Tag)) { toolStripMenuItem.PerformClick(); break; } } } foreach (ToolStripItem toolStripItem in toolStripDropDownButton_AlignTo.DropDownItems) { var toolStripMenuItem = toolStripItem as ToolStripMenuItem; if (toolStripMenuItem != null) { if (AlignTo_Threshold.Equals(toolStripMenuItem.ToString())) { toolStripMenuItem.PerformClick(); break; } } } WindowState = FormWindowState.Normal; var desktopBounds = new Rectangle( new Point( xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowLocationX", Name), Location.X), xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowLocationY", Name), Location.Y)), new Size( xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowWidth", Name), Size.Width), xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowHeight", Name), Size.Height))); var windowState = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowState", Name), "Normal"); if (IsVisibleOnAnyScreen(desktopBounds)) { StartPosition = FormStartPosition.Manual; DesktopBounds = desktopBounds; if (windowState.Equals("Maximized")) { WindowState = FormWindowState.Maximized; } } else { // this resets the upper left corner of the window to windows standards StartPosition = FormStartPosition.WindowsDefaultLocation; if (windowState.Equals("Minimized")) { //Somehow we were closed in a minimized state. All bets are off, so put use back in some sensible default. WindowState = FormWindowState.Normal; // this resets the upper left corner of the window to windows standards StartPosition = FormStartPosition.WindowsDefaultLocation; Size = new Size(800, 600); } else { // we can still apply the saved size Size = new Size(desktopBounds.Width, desktopBounds.Height); } } _effectNodeToElement = new Dictionary<EffectNode, Element>(); _elementNodeToRows = new Dictionary<ElementNode, List<Row>>(); TimelineControl.grid.RenderProgressChanged += OnRenderProgressChanged; TimelineControl.ElementChangedRows += ElementChangedRowsHandler; TimelineControl.ElementsMovedNew += timelineControl_ElementsMovedNew; TimelineControl.ElementDoubleClicked += ElementDoubleClickedHandler; //TimelineControl.DataDropped += timelineControl_DataDropped; TimelineControl.PlaybackCurrentTimeChanged += timelineControl_PlaybackCurrentTimeChanged; TimelineControl.RulerClicked += timelineControl_RulerClicked; TimelineControl.RulerBeginDragTimeRange += timelineControl_RulerBeginDragTimeRange; TimelineControl.RulerTimeRangeDragged += timelineControl_TimeRangeDragged; TimelineControl.MarkMoved += timelineControl_MarkMoved; TimelineControl.DeleteMark += timelineControl_DeleteMark; TimelineControl.SelectionChanged += TimelineControlOnSelectionChanged; TimelineControl.grid.MouseDown += TimelineControl_MouseDown; TimeLineSequenceClipboardContentsChanged += TimelineSequenceTimeLineSequenceClipboardContentsChanged; TimelineControl.CursorMoved += CursorMovedHandler; TimelineControl.ElementsSelected += timelineControl_ElementsSelected; TimelineControl.ContextSelected += timelineControl_ContextSelected; TimelineControl.SequenceLoading = false; TimelineControl.TimePerPixelChanged += TimelineControl_TimePerPixelChanged; TimelineControl.VisibleTimeStartChanged += TimelineControl_VisibleTimeStartChanged; TimelineControl.grid.SelectedElementsCloneDelegate = CloneElements; TimelineControl.grid.StartDrawMode += DrawElement; TimelineControl.grid.DragOver += TimelineControlGrid_DragOver; TimelineControl.grid.DragEnter += TimelineControlGrid_DragEnter; TimelineControl.grid.DragDrop += TimelineControlGrid_DragDrop; Row.RowHeightChanged += TimeLineControl_Row_RowHeightChanged; _curveLibrary = ApplicationServices.Get<IAppModuleInstance>(CurveLibraryDescriptor.ModuleID) as CurveLibrary; if (_curveLibrary != null) { _curveLibrary.CurveChanged += CurveLibrary_CurveChanged; } _colorGradientLibrary = ApplicationServices.Get<IAppModuleInstance>(ColorGradientLibraryDescriptor.ModuleID) as ColorGradientLibrary; if (_colorGradientLibrary != null) { _colorGradientLibrary.GradientChanged += ColorGradientLibrary_CurveChanged; } LoadAvailableEffects(); PopulateDragBoxFilterDropDown(); InitUndo(); UpdateButtonStates(); UpdatePasteMenuStates(); LoadColorCollections(); _library = ApplicationServices.Get<IAppModuleInstance>(LipSyncMapDescriptor.ModuleID) as LipSyncMapLibrary; Cursor.Current = Cursors.Default; if (_sequence.DefaultSplitterDistance != 0) { TimelineControl.splitContainer.SplitterDistance = _sequence.DefaultSplitterDistance; } else { TimelineControl.splitContainer.SplitterDistance = (int) (TimelineControl.DefaultSplitterDistance*_scaleFactor); } if (_sequence.DefaultPlaybackEndTime != TimeSpan.Zero) { _mPrevPlaybackStart = TimelineControl.PlaybackStartTime = _sequence.DefaultPlaybackStartTime; _mPrevPlaybackEnd = TimelineControl.PlaybackEndTime = _sequence.DefaultPlaybackEndTime; } #if DEBUG ToolStripButton b = new ToolStripButton("[Debug Break]"); b.Click += b_Click; toolStripOperations.Items.Add(b); #endif }