/// <summary> /// Initializes a mainwindow GUI with logic. /// </summary> public MainWindow() { //Projectstate this.projectstate = new ProjectState(); this.projectstate.PropertyChanged += projectstate_PropertyChanged; //Framescontainer this.framesContainer = new FramesContainer(); this.framesContainer.PropertyChanged += framesContainer_PropertyChanged; this.timeLinePanel = new SliderPanel(framesContainer); InitPathCreation(); InitializeComponent(); InitOpenGL(); CreateExporter(); Interpolator interpolator = new PyramidOpticalFlowInterpolator(renderState); interpolationControl = new InterpolationControl(interpolator, framesContainer); interpolationControl.NextFrameContainsCurves += interpolationControl_NextFrameContainsCurves; InactivateUIElementsOnEmptyProject(); }
/// <summary> /// Gets called when a .dcip needs to be loaded into memory. /// </summary> public static void Load() { // Configure open file dialog box System.Windows.Forms.OpenFileDialog fileDialog = new System.Windows.Forms.OpenFileDialog(); fileDialog.Filter = "DCIP Files|*.dcip"; fileDialog.Title = "Choose project to open: "; System.Windows.Forms.DialogResult result = fileDialog.ShowDialog(); //Save user filename if (result == System.Windows.Forms.DialogResult.OK) { destfile = fileDialog.FileName; BinaryFormatter formatter = new BinaryFormatter(); StreamReader framesOpen = null, stateOpen = null; FramesContainer container = null; ProjectState projectState = null; string destfilenoext = destfile.Substring(0, destfile.Length - 5); try { LoadSave.UnZipFolder(destfilenoext); framesOpen = new StreamReader(destfilenoext + @"\data.frames"); stateOpen = new StreamReader(destfilenoext + @"\data.state"); container = (FramesContainer)formatter.Deserialize(framesOpen.BaseStream); projectState = (ProjectState)formatter.Deserialize(stateOpen.BaseStream); stateOpen.Close(); framesOpen.Close(); LoadSave.DeleteOriginalFolder(destfilenoext); } catch (SerializationException e) { Prompt("Application error", e.Message); return; } //Event to fire back StateEventArgs stateeventargs = new StateEventArgs(); stateeventargs.Framescontainer = container; stateeventargs.Projectstate = projectState; //Return values to caller // Check if there are any Subscribers if (LoadSaveEvent != null) { LoadSaveEvent(null, stateeventargs); } } }
public DiffusionExport(IDiffusionRenderer renderer, RenderState renderState, RenderStateControl renderControl, DiffusionPathControl pathControl, DiffusionBuffers buffers, FramesContainer framesContainer) { this.renderState = renderState; this.buffers = buffers; this.renderControl = renderControl; this.renderer = renderer; this.pathControl = pathControl; this.framesContainer = framesContainer; }
/// <summary> /// Gets called when a project needs to be saved to the disk. /// </summary> /// <param name="givenprojectstate"></param> /// <returns>void</returns> public static void Save(ProjectState givenprojectstate, FramesContainer framescontainer) { string pathstring = ValidateInput.PathString(givenprojectstate.FileName, givenprojectstate.Destination); LoadSave.UnZipFolder(pathstring); File.Delete(pathstring + ".dcip"); WriteData(pathstring, givenprojectstate, framescontainer); LoadSave.ZipFolderRenameToDCIP(pathstring); LoadSave.DeleteOriginalFolder(pathstring); }
public static string Transform(TextureDescription textureDescription, TextureRepository textureRepository) { _outputlog = new StringBuilder(); _textureRepository = textureRepository; _textureDescription = textureDescription; _textureAssetPath = AssetDatabase.GetAssetPath(_textureDescription.Texture); _rawContainer = Domain.Domain.LoadContainer(_textureDescription.JsonDataFile); _newSpriteDescriptions = new List <SpriteDescription>(); using (var textureImporterWrapper = new TextureImporterWrapper(_textureAssetPath)) { textureImporterWrapper.ClearSpritesMetaData(); MapRepository(textureImporterWrapper); } EditorUtility.SetDirty(_textureDescription); SetSprites(); return(_outputlog.ToString()); }
/// <summary> /// Constructor for Sliderpanel. /// </summary> /// <param name="container"></param> public SliderPanel(FramesContainer container) { InitializeComponent(); Slider.ApplyTemplate(); framesContainer = container; framesContainer.CollectionChanged += framesContainer_CollectionChanged; framesContainer.PropertyChanged += framesContainer_PropertyChanged; Slider.Value = framesContainer.CursorIndex; Slider.Maximum = framesContainer.Count - 1; Slider.ValueChanged += Slider_ValueChanged; adorner = new PreviewAdorner(Slider, previewSize); previewTimer = new DispatcherTimer(); previewTimer.Interval = new TimeSpan(previewInterval); previewTimer.Tick += previewTimer_Tick; _track = this.Slider.Template.FindName("PART_Track", this.Slider) as Track; }
public void TearDown() { testFramesContainer = null; called = false; }
public void SetUp() { called = false; testFramesContainer = new FramesContainer(); this.testFramesContainer.CollectionChanged += (o, e) => { called = true; }; }
/// <summary> /// Constructor for InterpolationControl. /// </summary> /// <param name="interpolator"></param> /// <param name="frameList"></param> public InterpolationControl(Interpolator interpolator, FramesContainer frameList) { this.interpolator = interpolator; this.frameList = frameList; }
/// <summary> ///// Write data to file. /// </summary> /// <param name="pathstring"></param> /// <param name="givenprojectstate"></param> /// <param name="framescontainer"></param> public static void WriteData(string pathstring, ProjectState givenprojectstate, FramesContainer framescontainer) { StreamWriter frames = new StreamWriter(pathstring + @"\data.frames"); StreamWriter state = new StreamWriter(pathstring + @"\data.state"); BinaryFormatter formatter = new BinaryFormatter(); try { formatter.Serialize(frames.BaseStream, framescontainer); formatter.Serialize(state.BaseStream, givenprojectstate); } catch (SerializationException e) { Console.WriteLine("Failed to serialize. Reason: " + e.Message); throw; } frames.Close(); state.Close(); }