private void SetVectorLayout(MaterialProperty prop, int size, Vector4 data) { Vector4Control tb = new Vector4Control(); tb.Fill(data, size); tb.Dock = DockStyle.Fill; tb.TextChanged += OnVectorChanged; panelPropertyValue.Controls.Add(tb); mPropertyControl = tb; }
private void OnVectorChanged(object sender, EventArgs e) { Vector4Control control = (Vector4Control)sender; object data = mProperty.Data; switch (mProperty.Type) { case MaterialPropertyType.Vector2: data = new Vector2(control.X, control.Y); break; case MaterialPropertyType.Vector3: data = new Vector3(control.X, control.Y, control.Z); break; case MaterialPropertyType.Vector4: data = new Vector4(control.X, control.Y, control.Z, control.W); break; } mProperty.Data = data; }