Hey folks,
I'm having trouble setting up (at runtime) a custom property editor for an object in my game's engine...
So say I have an engine object with a texture ID attribute, and to modify that ID I want to pop up a texture browser. I can't specify the editor to use for the attribute in the engine object source file, as I don't want there to be any UI stuff in my engine project, but I have added a custom attribute:
class Object
{
[TextureIDAttribute]
public int TextureID
{
get;
set;
}
}
In my editor I've created an ICustomTypeDescriptor for my engine objects :
class EngineObjectDescriptor : ICustomTypeDescriptor
{
...
private Object myEngineObject;
}
And the GetProperties() method loops through all of the Object's properties, adding an instance of my custom PropertyDescriptor (ObjectPropertyDescriptor) for each one.
The trouble is no matter what I return from the overridden ComponentType & PropertyType accessors in the PropertyDescriptor, the GetEditor() function (which I assume is used to display a custom editor for the property) is never called (it isn't called in the ObjectPropertyDescriptor class either) - the ID of the object is always displayed as a non-editable integer.
I can change PropretyType to int32, and then I get a little value scroll thing, but what I really want is to have a button displayed that launches a texture browser and then sets the ID that way :

I've checked that the IsReadOnly attribute of the PropertyDescriptor is set to false, so not sure what's going on.
Any advice would be greatly appreciated ![]()







