private void BtnAdd_Click(object sender, EventArgs e) { if (scene.CurrentList is List <PathPoint> points) { //add new pathpoint to path PathPoint point; if (points.Count > 0) { scene.Add(scene.CurrentList, point = new PathPoint(points.Last().Position, Vector3.Zero, Vector3.Zero)); } else { scene.Add(scene.CurrentList, point = new PathPoint(Vector3.Zero, Vector3.Zero, Vector3.Zero)); } } else { //add new TransformableObject to the scene scene.Add(scene.CurrentList, new TransformableObject(Vector3.Zero, Vector3.Zero, Vector3.One)); } sceneListView1.UpdateAutoScrollHeight(); }
private void button1_Click(object sender, EventArgs e) { Color rand = Color.FromArgb(rng.Next()); listBox1.Items.Add("block"); //make sure to add the entry before you add an object because the SelectionChanged event will be fired scene.Add(new EditableObject() { CubeColor = new Vector4(rand.R / 255f, rand.G / 255f, rand.B / 255f, 1f) }); }