Multiple property editor views on the same item

77 views
Skip to first unread message

je...@vitei.com

unread,
Sep 2, 2016, 5:39:16 AM9/2/16
to Authoring Tools Framework
Hello!

Is it possible to set up the Property Editor such that there are multiple "views" on the selected item?  For example, if the Property Editor currently has these categories:
  • Health
  • Armor
  • Weapon
is it possible to split out these categories into separate panels (or property editors)?  If this is not possible, what is the recommended way to approach setting this up?

Thank you.

(Thanks for all your work on ATF and LevelEditor!)

Ron2

unread,
Sep 2, 2016, 11:39:08 AM9/2/16
to Authoring Tools Framework
Hi Jetha,

You can create multiple instances of PropertyEditor by sub-classing PropertyEditor and adding each of these custom types to your TypeCatalog.

Then, somehow, you need to filter the property descriptors that are given to PropertyView in this line here in PropertyView.cs:
m_propertyDescriptors = m_editingContext.PropertyDescriptors.ToArray();

A PropertyEditor owns a PropertyGrid which owns a PropertyGridView which derives from PropertyView. I find this really confusing, so I created this diagram a while back:

Option 1
To do that filtering, it may be easiest to modify PropertyView to accept a delegate, and that delegate can do the filtering of the results of the PropertyDescriptors.ToArray() call above. If you can do this in a general-purpose way, then please consider adding a pull request!
The delegate could be passed to PropertyView by your custom PropertyEditor.

Option 2
1. You could supply a custom IPropertyEditingContext that implements the PropertyDescriptors property to provide the "view" of the selected object that you want.
2. You could give this IPropertyEditingContext to PropertyView by setting its EditingContext property.
I haven't looked at where you might set this EditingContext property, but it should be possible somehow. By default, the IContextRegistry raises events which cause the EditingContext to be set, so there may be conflict with this.

Option 3
1. Same as in option 2, you could supply a custom IPropertyEditingContext.
2. To have your custom IPropertyEditingContext used automatically, you could provide a custom IContextRegistry in the PropertyEditor's constructor. This IContextRegistry would be used just for one particular instance of PropertyEditor. You could copy the ATF's ContextRegistry implementation.
This option sounds like it has more code overall, but at least you wouldn't have to modify ATF's source code.

That's all that I can think of at the moment. Please share whatever solution you come up with; it's likely you'll help others!

--Ron
Reply all
Reply to author
Forward
0 new messages