public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { IWindowsFormsEditorService svc = (IWindowsFormsEditorService) provider.GetService(typeof(IWindowsFormsEditorService)); if (svc != null) { PolygonCutterTimeline.PolygonCutterKeyFrame KeyFrame = (PolygonCutterTimeline.PolygonCutterKeyFrame)context.Instance; PolygonCutterHelper NewSpawner = new PolygonCutterHelper(KeyFrame.ActiveLayer.renderTarget, KeyFrame.ListPolygon, false); if (NewSpawner.ShowDialog() == System.Windows.Forms.DialogResult.OK) { value = NewSpawner.PolygonCutterViewer.ListPolygon; } } return(value); }
public override List <VisibleTimeline> CreateNewEditorItem(AnimationClass ActiveAnimation, AnimationClass.AnimationLayer ActiveLayer, int KeyFrame, System.Drawing.Point MousePosition) { List <VisibleTimeline> ReturnValue = new List <VisibleTimeline>(); Vector2[] LocalPoints = new Vector2[4] { new Vector2(MousePosition.X - 40, MousePosition.Y - 40), new Vector2(MousePosition.X - 40, MousePosition.Y + 40), new Vector2(MousePosition.X + 40, MousePosition.Y + 40), new Vector2(MousePosition.X + 40, MousePosition.Y - 40), }; PolygonCutterTimeline NewCreatePolygonCutterEvent = new PolygonCutterTimeline("New Polygon Cutter", Vector2.Zero, ActiveLayer); PolygonCutterHelper NewSpawner = new PolygonCutterHelper(ActiveLayer.renderTarget, NewCreatePolygonCutterEvent.ListPolygon, true); NewSpawner.PolygonCutterViewer.ListPolygon.Add(new Polygon(LocalPoints, GameScreen.GraphicsDevice.Viewport.Width, GameScreen.GraphicsDevice.Viewport.Height)); if (NewSpawner.ShowDialog() == System.Windows.Forms.DialogResult.OK) { NewCreatePolygonCutterEvent.SpawnFrame = KeyFrame; NewCreatePolygonCutterEvent.DeathFrame = KeyFrame + 10; NewCreatePolygonCutterEvent.IsUsed = true;//Disable the spawner as we spawn the timeline manually. PolygonCutterKeyFrame NewPolygonCutterKeyFrame = new PolygonCutterKeyFrame(ActiveLayer, NewCreatePolygonCutterEvent.Position, true, -1); foreach (Polygon NewPolygon in NewSpawner.PolygonCutterViewer.ListPolygon) { NewPolygonCutterKeyFrame.ListPolygon.Add(new Polygon(NewPolygon)); } NewCreatePolygonCutterEvent.ListPolygon.AddRange(NewSpawner.PolygonCutterViewer.ListPolygon); NewCreatePolygonCutterEvent.Add(KeyFrame, NewPolygonCutterKeyFrame); ReturnValue.Add(NewCreatePolygonCutterEvent); } return(ReturnValue); }