You cannot have a native class as value member in a managed class, but you are allowed to have pointers to native classes.
So if "Matrix" is your native class you cannot do:
ref class Model
{
public:
Matrix matrix;
};
but you can do:
ref class Model
{
public:
Matrix* matrix;
};
In your constructor, you have to construct the native matrix with new Matrix().
Having said that, I think you have a bigger problem here as your architecture is totally wrong. A "Model" class should be living the native side of the code, because it is not strictly an "editor" thing... your editor will create and edit models that will then be used by the native engine in the game. In this case what you do? You'll have to implement one model for the native side and one model for the managed side? That is really asking for troubles.
You should have a Model class in native and then, you create a EditorModel managed class that just wraps the native class with properties and member functions.
ref class EditorModel
{
public:
EditorModel()
{
model=new Model();
}
float getWhatever()
{
return model->getWhatever();
}
private:
Model* model;
};
Edited by kunos, 05 August 2012 - 12:59 PM.