In my application I am using a PropertyGrid for setting attributes related to loading data, setting the scene, etc. I have a small issue though, when it comes to using a Vector3 as a property. It turns out that if I try to use an OpenTK Vector3 struct as a field of the PropertyGrid, it deactivates the field(it shows up as gray and cannot be altered). I am assuming that this is due to the fact that a struct is immutable, thus it cannot be edited. I want to know if there is a way around this though. I know that I could define my own Vector3 as a class, which would work, but I want to continue using the OpenTK Vector3.
Here is a screen grab of my application:
And here is the PropertyGrid settings class:
using System.ComponentModel;
using OpenTK;
using StardustModeling.Modeling.IOFilters;
namespace StardustModeling.Modeling
{
public class ModelBuilderSceneSettings
{
[Description( "The name of the compiled model." ),
Category( "Information" )]
public string Name { get; set; } = "";
[Description( "The geometry data for the model." ),
Category( "Data" ),
Editor(
typeof( WavefrontModelFilter ) ,
typeof( System.Drawing.Design.UITypeEditor ) )]
public string GeometryMesh { get; set; } = "";
[Description( "The Diffuse Texture of the model." ),
Category( "Texturing" ), Editor(
typeof( BitmapFilter ) ,
typeof( System.Drawing.Design.UITypeEditor ) )]
public string Diffuse { get; set; } = "";
[Description( "The NormalMap for the model." ),
Category( "Texturing" ), Editor(
typeof( BitmapFilter ) ,
typeof( System.Drawing.Design.UITypeEditor ) )]
public string Normals { get; set; } = "";
[Description( "Position of the scene lamp." ),
Category( "Scene" )]
public Vector3 Lamp { get; set; } = new Vector3(2,2,2);
[Description( "Model Position." ),
Category( "Scene" )]
public Vector3 ModelLocation { get; set; } = new Vector3(); // Default 0,0,0
}
}